state
stringlengths 0
159k
| srcUpToTactic
stringlengths 387
167k
| nextTactic
stringlengths 3
9k
| declUpToTactic
stringlengths 22
11.5k
| declId
stringlengths 38
95
| decl
stringlengths 16
1.89k
| file_tag
stringlengths 17
73
|
---|---|---|---|---|---|---|
V : Type u_2
P : Type u_1
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
c c₁ c₂ p₁ p₂ p x✝ : P
⊢ x✝ ∈ ↑⊤ → x✝ ∈ ↑(perpBisector p p) | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by | simp [mem_perpBisector_iff_inner_eq_inner] | @[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by | Mathlib.Geometry.Euclidean.PerpBisector.110_0.WKtplj3xHYGfYbJ | @[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ | Mathlib_Geometry_Euclidean_PerpBisector |
V : Type u_2
P : Type u_1
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
c c₁ c₂ p₁ p₂ : P
⊢ perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
| refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩ | @[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
| Mathlib.Geometry.Euclidean.PerpBisector.113_0.WKtplj3xHYGfYbJ | @[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ | Mathlib_Geometry_Euclidean_PerpBisector |
V : Type u_2
P : Type u_1
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
c c₁ c₂ p₁ p₂ : P
h : perpBisector p₁ p₂ = ⊤
⊢ p₁ = p₂ | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
| rw [← left_mem_perpBisector, h] | @[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
| Mathlib.Geometry.Euclidean.PerpBisector.113_0.WKtplj3xHYGfYbJ | @[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ | Mathlib_Geometry_Euclidean_PerpBisector |
V : Type u_2
P : Type u_1
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
c c₁ c₂ p₁ p₂ : P
h : perpBisector p₁ p₂ = ⊤
⊢ p₁ ∈ ⊤ | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
rw [← left_mem_perpBisector, h]
| trivial | @[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
rw [← left_mem_perpBisector, h]
| Mathlib.Geometry.Euclidean.PerpBisector.113_0.WKtplj3xHYGfYbJ | @[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ | Mathlib_Geometry_Euclidean_PerpBisector |
V : Type u_2
P : Type u_1
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
c c₁ c₂ p₁ p₂ : P
⊢ perpBisector p₁ p₂ ≠ ⊥ | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
rw [← left_mem_perpBisector, h]
trivial
@[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ := by
| rw [← nonempty_iff_ne_bot] | @[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ := by
| Mathlib.Geometry.Euclidean.PerpBisector.118_0.WKtplj3xHYGfYbJ | @[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ | Mathlib_Geometry_Euclidean_PerpBisector |
V : Type u_2
P : Type u_1
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
c c₁ c₂ p₁ p₂ : P
⊢ Set.Nonempty ↑(perpBisector p₁ p₂) | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
rw [← left_mem_perpBisector, h]
trivial
@[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ := by
rw [← nonempty_iff_ne_bot]; | exact perpBisector_nonempty | @[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ := by
rw [← nonempty_iff_ne_bot]; | Mathlib.Geometry.Euclidean.PerpBisector.118_0.WKtplj3xHYGfYbJ | @[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ | Mathlib_Geometry_Euclidean_PerpBisector |
V : Type u_2
P : Type u_1
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
c₁ c₂ p₁ p₂ : P
hc₁ : dist p₁ c₁ = dist p₂ c₁
hc₂ : dist p₁ c₂ = dist p₂ c₂
⊢ inner (c₂ -ᵥ c₁) (p₂ -ᵥ p₁) = 0 | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
rw [← left_mem_perpBisector, h]
trivial
@[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ := by
rw [← nonempty_iff_ne_bot]; exact perpBisector_nonempty
end AffineSubspace
open AffineSubspace
namespace EuclideanGeometry
/-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 := by
| rw [← Submodule.mem_orthogonal_singleton_iff_inner_left, ← direction_perpBisector] | /-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 := by
| Mathlib.Geometry.Euclidean.PerpBisector.127_0.WKtplj3xHYGfYbJ | /-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 | Mathlib_Geometry_Euclidean_PerpBisector |
V : Type u_2
P : Type u_1
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
c₁ c₂ p₁ p₂ : P
hc₁ : dist p₁ c₁ = dist p₂ c₁
hc₂ : dist p₁ c₂ = dist p₂ c₂
⊢ c₂ -ᵥ c₁ ∈ direction (perpBisector p₁ p₂) | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
rw [← left_mem_perpBisector, h]
trivial
@[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ := by
rw [← nonempty_iff_ne_bot]; exact perpBisector_nonempty
end AffineSubspace
open AffineSubspace
namespace EuclideanGeometry
/-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 := by
rw [← Submodule.mem_orthogonal_singleton_iff_inner_left, ← direction_perpBisector]
| apply vsub_mem_direction | /-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 := by
rw [← Submodule.mem_orthogonal_singleton_iff_inner_left, ← direction_perpBisector]
| Mathlib.Geometry.Euclidean.PerpBisector.127_0.WKtplj3xHYGfYbJ | /-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 | Mathlib_Geometry_Euclidean_PerpBisector |
case hp1
V : Type u_2
P : Type u_1
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
c₁ c₂ p₁ p₂ : P
hc₁ : dist p₁ c₁ = dist p₂ c₁
hc₂ : dist p₁ c₂ = dist p₂ c₂
⊢ c₂ ∈ perpBisector p₁ p₂ | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
rw [← left_mem_perpBisector, h]
trivial
@[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ := by
rw [← nonempty_iff_ne_bot]; exact perpBisector_nonempty
end AffineSubspace
open AffineSubspace
namespace EuclideanGeometry
/-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 := by
rw [← Submodule.mem_orthogonal_singleton_iff_inner_left, ← direction_perpBisector]
apply vsub_mem_direction <;> | rwa [mem_perpBisector_iff_dist_eq'] | /-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 := by
rw [← Submodule.mem_orthogonal_singleton_iff_inner_left, ← direction_perpBisector]
apply vsub_mem_direction <;> | Mathlib.Geometry.Euclidean.PerpBisector.127_0.WKtplj3xHYGfYbJ | /-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 | Mathlib_Geometry_Euclidean_PerpBisector |
case hp2
V : Type u_2
P : Type u_1
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
c₁ c₂ p₁ p₂ : P
hc₁ : dist p₁ c₁ = dist p₂ c₁
hc₂ : dist p₁ c₂ = dist p₂ c₂
⊢ c₁ ∈ perpBisector p₁ p₂ | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
rw [← left_mem_perpBisector, h]
trivial
@[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ := by
rw [← nonempty_iff_ne_bot]; exact perpBisector_nonempty
end AffineSubspace
open AffineSubspace
namespace EuclideanGeometry
/-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 := by
rw [← Submodule.mem_orthogonal_singleton_iff_inner_left, ← direction_perpBisector]
apply vsub_mem_direction <;> | rwa [mem_perpBisector_iff_dist_eq'] | /-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 := by
rw [← Submodule.mem_orthogonal_singleton_iff_inner_left, ← direction_perpBisector]
apply vsub_mem_direction <;> | Mathlib.Geometry.Euclidean.PerpBisector.127_0.WKtplj3xHYGfYbJ | /-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 | Mathlib_Geometry_Euclidean_PerpBisector |
V : Type u_4
P : Type u_1
V' : Type u_3
P' : Type u_2
inst✝⁷ : NormedAddCommGroup V
inst✝⁶ : InnerProductSpace ℝ V
inst✝⁵ : MetricSpace P
inst✝⁴ : NormedAddTorsor V P
inst✝³ : NormedAddCommGroup V'
inst✝² : InnerProductSpace ℝ V'
inst✝¹ : MetricSpace P'
inst✝ : NormedAddTorsor V' P'
f : P → P'
h : Isometry f
p₁ p₂ : P
⊢ f ⁻¹' ↑(perpBisector (f p₁) (f p₂)) = ↑(perpBisector p₁ p₂) | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
rw [← left_mem_perpBisector, h]
trivial
@[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ := by
rw [← nonempty_iff_ne_bot]; exact perpBisector_nonempty
end AffineSubspace
open AffineSubspace
namespace EuclideanGeometry
/-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 := by
rw [← Submodule.mem_orthogonal_singleton_iff_inner_left, ← direction_perpBisector]
apply vsub_mem_direction <;> rwa [mem_perpBisector_iff_dist_eq']
#align euclidean_geometry.inner_vsub_vsub_of_dist_eq_of_dist_eq EuclideanGeometry.inner_vsub_vsub_of_dist_eq_of_dist_eq
end EuclideanGeometry
variable [NormedAddCommGroup V'] [InnerProductSpace ℝ V'] [MetricSpace P']
variable [NormedAddTorsor V' P']
theorem Isometry.preimage_perpBisector {f : P → P'} (h : Isometry f) (p₁ p₂ : P) :
f ⁻¹' (perpBisector (f p₁) (f p₂)) = perpBisector p₁ p₂ := by
| ext x | theorem Isometry.preimage_perpBisector {f : P → P'} (h : Isometry f) (p₁ p₂ : P) :
f ⁻¹' (perpBisector (f p₁) (f p₂)) = perpBisector p₁ p₂ := by
| Mathlib.Geometry.Euclidean.PerpBisector.141_0.WKtplj3xHYGfYbJ | theorem Isometry.preimage_perpBisector {f : P → P'} (h : Isometry f) (p₁ p₂ : P) :
f ⁻¹' (perpBisector (f p₁) (f p₂)) = perpBisector p₁ p₂ | Mathlib_Geometry_Euclidean_PerpBisector |
case h
V : Type u_4
P : Type u_1
V' : Type u_3
P' : Type u_2
inst✝⁷ : NormedAddCommGroup V
inst✝⁶ : InnerProductSpace ℝ V
inst✝⁵ : MetricSpace P
inst✝⁴ : NormedAddTorsor V P
inst✝³ : NormedAddCommGroup V'
inst✝² : InnerProductSpace ℝ V'
inst✝¹ : MetricSpace P'
inst✝ : NormedAddTorsor V' P'
f : P → P'
h : Isometry f
p₁ p₂ x : P
⊢ x ∈ f ⁻¹' ↑(perpBisector (f p₁) (f p₂)) ↔ x ∈ ↑(perpBisector p₁ p₂) | /-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Joseph Myers
-/
import Mathlib.Analysis.InnerProductSpace.Orthogonal
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Perpendicular bisector of a segment
We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment
`[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular
bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that
define this subspace.
## Keywords
euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant
-/
set_option autoImplicit true
open Set
open scoped BigOperators RealInnerProductSpace
variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
/-- Perpendicular bisector of a segment in a Euclidean affine space. -/
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to
`c -ᵥ midpoint ℝ p₁ p₂`. -/
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
/-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is
orthogonal to `p₂ -ᵥ p₁`. -/
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
theorem perpBisector_comm (p₁ p₂ : P) : perpBisector p₁ p₂ = perpBisector p₂ p₁ := by
ext c; simp only [mem_perpBisector_iff_dist_eq, eq_comm]
@[simp] theorem right_mem_perpBisector : p₂ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
simpa [mem_perpBisector_iff_inner_eq_inner] using eq_comm
@[simp] theorem left_mem_perpBisector : p₁ ∈ perpBisector p₁ p₂ ↔ p₁ = p₂ := by
rw [perpBisector_comm, right_mem_perpBisector, eq_comm]
@[simp] theorem perpBisector_self (p : P) : perpBisector p p = ⊤ :=
top_unique <| fun _ ↦ by simp [mem_perpBisector_iff_inner_eq_inner]
@[simp] theorem perpBisector_eq_top : perpBisector p₁ p₂ = ⊤ ↔ p₁ = p₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ perpBisector_self _⟩
rw [← left_mem_perpBisector, h]
trivial
@[simp] theorem perpBisector_ne_bot : perpBisector p₁ p₂ ≠ ⊥ := by
rw [← nonempty_iff_ne_bot]; exact perpBisector_nonempty
end AffineSubspace
open AffineSubspace
namespace EuclideanGeometry
/-- Suppose that `c₁` is equidistant from `p₁` and `p₂`, and the same applies to `c₂`. Then the
vector between `c₁` and `c₂` is orthogonal to that between `p₁` and `p₂`. (In two dimensions, this
says that the diagonals of a kite are orthogonal.) -/
theorem inner_vsub_vsub_of_dist_eq_of_dist_eq {c₁ c₂ p₁ p₂ : P} (hc₁ : dist p₁ c₁ = dist p₂ c₁)
(hc₂ : dist p₁ c₂ = dist p₂ c₂) : ⟪c₂ -ᵥ c₁, p₂ -ᵥ p₁⟫ = 0 := by
rw [← Submodule.mem_orthogonal_singleton_iff_inner_left, ← direction_perpBisector]
apply vsub_mem_direction <;> rwa [mem_perpBisector_iff_dist_eq']
#align euclidean_geometry.inner_vsub_vsub_of_dist_eq_of_dist_eq EuclideanGeometry.inner_vsub_vsub_of_dist_eq_of_dist_eq
end EuclideanGeometry
variable [NormedAddCommGroup V'] [InnerProductSpace ℝ V'] [MetricSpace P']
variable [NormedAddTorsor V' P']
theorem Isometry.preimage_perpBisector {f : P → P'} (h : Isometry f) (p₁ p₂ : P) :
f ⁻¹' (perpBisector (f p₁) (f p₂)) = perpBisector p₁ p₂ := by
ext x; | simp [mem_perpBisector_iff_dist_eq, h.dist_eq] | theorem Isometry.preimage_perpBisector {f : P → P'} (h : Isometry f) (p₁ p₂ : P) :
f ⁻¹' (perpBisector (f p₁) (f p₂)) = perpBisector p₁ p₂ := by
ext x; | Mathlib.Geometry.Euclidean.PerpBisector.141_0.WKtplj3xHYGfYbJ | theorem Isometry.preimage_perpBisector {f : P → P'} (h : Isometry f) (p₁ p₂ : P) :
f ⁻¹' (perpBisector (f p₁) (f p₂)) = perpBisector p₁ p₂ | Mathlib_Geometry_Euclidean_PerpBisector |
I : Type u
f : I → Type v
x y : (i : I) → f i
i✝ : I
α : Type u_1
inst✝² : (i : I) → SMul α (f i)
inst✝¹ : ∀ (i : I), Nonempty (f i)
i : I
inst✝ : FaithfulSMul α (f i)
m₁✝ m₂✝ : α
h : ∀ (a : (i : I) → f i), m₁✝ • a = m₂✝ • a
a : f i
⊢ m₁✝ • a = m₂✝ • a | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
| classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this | /-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
| Mathlib.GroupTheory.GroupAction.Pi.102_0.o1qTP9EuP25B013 | /-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i✝ : I
α : Type u_1
inst✝² : (i : I) → SMul α (f i)
inst✝¹ : ∀ (i : I), Nonempty (f i)
i : I
inst✝ : FaithfulSMul α (f i)
m₁✝ m₂✝ : α
h : ∀ (a : (i : I) → f i), m₁✝ • a = m₂✝ • a
a : f i
⊢ m₁✝ • a = m₂✝ • a | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
| have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i | /-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
| Mathlib.GroupTheory.GroupAction.Pi.102_0.o1qTP9EuP25B013 | /-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i✝ : I
α : Type u_1
inst✝² : (i : I) → SMul α (f i)
inst✝¹ : ∀ (i : I), Nonempty (f i)
i : I
inst✝ : FaithfulSMul α (f i)
m₁✝ m₂✝ : α
h : ∀ (a : (i : I) → f i), m₁✝ • a = m₂✝ • a
a : f i
this :
(m₁✝ • Function.update (fun j => Classical.choice (_ : Nonempty (f j))) i a) i =
(m₂✝ • Function.update (fun j => Classical.choice (_ : Nonempty (f j))) i a) i
⊢ m₁✝ • a = m₂✝ • a | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
| simpa using this | /-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
| Mathlib.GroupTheory.GroupAction.Pi.102_0.o1qTP9EuP25B013 | /-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i : I
g : I → Type u_1
n : (i : I) → Zero (g i)
inst✝ : (i : I) → SMulZeroClass (f i) (g i)
⊢ ∀ (a : (i : I) → f i), a • 0 = 0 | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by | intros | instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by | Mathlib.GroupTheory.GroupAction.Pi.151_0.o1qTP9EuP25B013 | instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i : I
g : I → Type u_1
n : (i : I) → Zero (g i)
inst✝ : (i : I) → SMulZeroClass (f i) (g i)
a✝ : (i : I) → f i
⊢ a✝ • 0 = 0 | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; | ext x | instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; | Mathlib.GroupTheory.GroupAction.Pi.151_0.o1qTP9EuP25B013 | instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero | Mathlib_GroupTheory_GroupAction_Pi |
case h
I : Type u
f : I → Type v
x✝ y : (i : I) → f i
i : I
g : I → Type u_1
n : (i : I) → Zero (g i)
inst✝ : (i : I) → SMulZeroClass (f i) (g i)
a✝ : (i : I) → f i
x : I
⊢ (a✝ • 0) x = OfNat.ofNat 0 x | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; | exact smul_zero _ | instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; | Mathlib.GroupTheory.GroupAction.Pi.151_0.o1qTP9EuP25B013 | instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i : I
g : I → Type u_1
n : (i : I) → AddZeroClass (g i)
inst✝ : (i : I) → DistribSMul (f i) (g i)
⊢ ∀ (a : (i : I) → f i), a • 0 = 0 | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by | intros | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by | Mathlib.GroupTheory.GroupAction.Pi.162_0.o1qTP9EuP25B013 | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i : I
g : I → Type u_1
n : (i : I) → AddZeroClass (g i)
inst✝ : (i : I) → DistribSMul (f i) (g i)
a✝ : (i : I) → f i
⊢ a✝ • 0 = 0 | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; | ext x | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; | Mathlib.GroupTheory.GroupAction.Pi.162_0.o1qTP9EuP25B013 | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero | Mathlib_GroupTheory_GroupAction_Pi |
case h
I : Type u
f : I → Type v
x✝ y : (i : I) → f i
i : I
g : I → Type u_1
n : (i : I) → AddZeroClass (g i)
inst✝ : (i : I) → DistribSMul (f i) (g i)
a✝ : (i : I) → f i
x : I
⊢ (a✝ • 0) x = OfNat.ofNat 0 x | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; | exact smul_zero _ | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; | Mathlib.GroupTheory.GroupAction.Pi.162_0.o1qTP9EuP25B013 | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i : I
g : I → Type u_1
n : (i : I) → AddZeroClass (g i)
inst✝ : (i : I) → DistribSMul (f i) (g i)
⊢ ∀ (a : (i : I) → f i) (x y : (i : I) → g i), a • (x + y) = a • x + a • y | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by | intros | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by | Mathlib.GroupTheory.GroupAction.Pi.162_0.o1qTP9EuP25B013 | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i : I
g : I → Type u_1
n : (i : I) → AddZeroClass (g i)
inst✝ : (i : I) → DistribSMul (f i) (g i)
a✝ : (i : I) → f i
x✝ y✝ : (i : I) → g i
⊢ a✝ • (x✝ + y✝) = a✝ • x✝ + a✝ • y✝ | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; | ext x | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; | Mathlib.GroupTheory.GroupAction.Pi.162_0.o1qTP9EuP25B013 | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero | Mathlib_GroupTheory_GroupAction_Pi |
case h
I : Type u
f : I → Type v
x✝¹ y : (i : I) → f i
i : I
g : I → Type u_1
n : (i : I) → AddZeroClass (g i)
inst✝ : (i : I) → DistribSMul (f i) (g i)
a✝ : (i : I) → f i
x✝ y✝ : (i : I) → g i
x : I
⊢ (a✝ • (x✝ + y✝)) x = (a✝ • x✝ + a✝ • y✝) x | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; | exact smul_add _ _ _ | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; | Mathlib.GroupTheory.GroupAction.Pi.162_0.o1qTP9EuP25B013 | instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i : I
g : I → Type u_1
m : (i : I) → Monoid (f i)
n : (i : I) → Monoid (g i)
inst✝ : (i : I) → MulDistribMulAction (f i) (g i)
⊢ ∀ (r : (i : I) → f i) (x y : (i : I) → g i), r • (x * y) = r • x * r • y | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
| intros | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
| Mathlib.GroupTheory.GroupAction.Pi.207_0.o1qTP9EuP25B013 | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i : I
g : I → Type u_1
m : (i : I) → Monoid (f i)
n : (i : I) → Monoid (g i)
inst✝ : (i : I) → MulDistribMulAction (f i) (g i)
r✝ : (i : I) → f i
x✝ y✝ : (i : I) → g i
⊢ r✝ • (x✝ * y✝) = r✝ • x✝ * r✝ • y✝ | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
| ext x | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
| Mathlib.GroupTheory.GroupAction.Pi.207_0.o1qTP9EuP25B013 | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul | Mathlib_GroupTheory_GroupAction_Pi |
case h
I : Type u
f : I → Type v
x✝¹ y : (i : I) → f i
i : I
g : I → Type u_1
m : (i : I) → Monoid (f i)
n : (i : I) → Monoid (g i)
inst✝ : (i : I) → MulDistribMulAction (f i) (g i)
r✝ : (i : I) → f i
x✝ y✝ : (i : I) → g i
x : I
⊢ (r✝ • (x✝ * y✝)) x = (r✝ • x✝ * r✝ • y✝) x | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
| apply smul_mul' | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
| Mathlib.GroupTheory.GroupAction.Pi.207_0.o1qTP9EuP25B013 | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i : I
g : I → Type u_1
m : (i : I) → Monoid (f i)
n : (i : I) → Monoid (g i)
inst✝ : (i : I) → MulDistribMulAction (f i) (g i)
⊢ ∀ (r : (i : I) → f i), r • 1 = 1 | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
| intros | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
| Mathlib.GroupTheory.GroupAction.Pi.207_0.o1qTP9EuP25B013 | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f : I → Type v
x y : (i : I) → f i
i : I
g : I → Type u_1
m : (i : I) → Monoid (f i)
n : (i : I) → Monoid (g i)
inst✝ : (i : I) → MulDistribMulAction (f i) (g i)
r✝ : (i : I) → f i
⊢ r✝ • 1 = 1 | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
intros
| ext x | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
intros
| Mathlib.GroupTheory.GroupAction.Pi.207_0.o1qTP9EuP25B013 | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul | Mathlib_GroupTheory_GroupAction_Pi |
case h
I : Type u
f : I → Type v
x✝ y : (i : I) → f i
i : I
g : I → Type u_1
m : (i : I) → Monoid (f i)
n : (i : I) → Monoid (g i)
inst✝ : (i : I) → MulDistribMulAction (f i) (g i)
r✝ : (i : I) → f i
x : I
⊢ (r✝ • 1) x = OfNat.ofNat 1 x | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
intros
ext x
| apply smul_one | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
intros
ext x
| Mathlib.GroupTheory.GroupAction.Pi.207_0.o1qTP9EuP25B013 | instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f✝ : I → Type v
x✝ y : (i : I) → f✝ i
i : I
R : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝ : SMul R γ
r : R
f : α → β
g : α → γ
e : β → γ
x : β
⊢ extend f (r • g) (r • e) x = (r • extend f g e) x | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
intros
ext x
apply smul_one
#align pi.mul_distrib_mul_action' Pi.mulDistribMulAction'
end Pi
namespace Function
/-- Non-dependent version of `Pi.smul`. Lean gets confused by the dependent instance if this
is not present. -/
@[to_additive
"Non-dependent version of `Pi.vadd`. Lean gets confused by the dependent instance
if this is not present."]
instance hasSMul {ι R M : Type*} [SMul R M] : SMul R (ι → M) :=
Pi.instSMul
#align function.has_smul Function.hasSMul
#align function.has_vadd Function.hasVAdd
/-- Non-dependent version of `Pi.smulCommClass`. Lean gets confused by the dependent instance if
this is not present. -/
@[to_additive
"Non-dependent version of `Pi.vaddCommClass`. Lean gets confused by the dependent
instance if this is not present."]
instance smulCommClass {ι α β M : Type*} [SMul α M] [SMul β M] [SMulCommClass α β M] :
SMulCommClass α β (ι → M) :=
Pi.smulCommClass
#align function.smul_comm_class Function.smulCommClass
#align function.vadd_comm_class Function.vaddCommClass
@[to_additive]
theorem update_smul {α : Type*} [∀ i, SMul α (f i)] [DecidableEq I] (c : α) (f₁ : ∀ i, f i)
(i : I) (x₁ : f i) : update (c • f₁) i (c • x₁) = c • update f₁ i x₁ :=
funext fun j => (apply_update (β := f) (fun _ => (c • ·)) f₁ i x₁ j).symm
#align function.update_smul Function.update_smul
#align function.update_vadd Function.update_vadd
end Function
namespace Set
@[to_additive]
theorem piecewise_smul {α : Type*} [∀ i, SMul α (f i)] (s : Set I) [∀ i, Decidable (i ∈ s)]
(c : α) (f₁ g₁ : ∀ i, f i) : s.piecewise (c • f₁) (c • g₁) = c • s.piecewise f₁ g₁ :=
s.piecewise_op (δ' := f) f₁ _ fun _ => (c • ·)
#align set.piecewise_smul Set.piecewise_smul
#align set.piecewise_vadd Set.piecewise_vadd
end Set
section Extend
@[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e :=
funext fun x => by
-- Porting note: Lean4 is unable to automatically call `Classical.propDecidable`
| haveI : Decidable (∃ a : α, f a = x) := Classical.propDecidable _ | @[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e :=
funext fun x => by
-- Porting note: Lean4 is unable to automatically call `Classical.propDecidable`
| Mathlib.GroupTheory.GroupAction.Pi.267_0.o1qTP9EuP25B013 | @[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f✝ : I → Type v
x✝ y : (i : I) → f✝ i
i : I
R : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝ : SMul R γ
r : R
f : α → β
g : α → γ
e : β → γ
x : β
this : Decidable (∃ a, f a = x)
⊢ extend f (r • g) (r • e) x = (r • extend f g e) x | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
intros
ext x
apply smul_one
#align pi.mul_distrib_mul_action' Pi.mulDistribMulAction'
end Pi
namespace Function
/-- Non-dependent version of `Pi.smul`. Lean gets confused by the dependent instance if this
is not present. -/
@[to_additive
"Non-dependent version of `Pi.vadd`. Lean gets confused by the dependent instance
if this is not present."]
instance hasSMul {ι R M : Type*} [SMul R M] : SMul R (ι → M) :=
Pi.instSMul
#align function.has_smul Function.hasSMul
#align function.has_vadd Function.hasVAdd
/-- Non-dependent version of `Pi.smulCommClass`. Lean gets confused by the dependent instance if
this is not present. -/
@[to_additive
"Non-dependent version of `Pi.vaddCommClass`. Lean gets confused by the dependent
instance if this is not present."]
instance smulCommClass {ι α β M : Type*} [SMul α M] [SMul β M] [SMulCommClass α β M] :
SMulCommClass α β (ι → M) :=
Pi.smulCommClass
#align function.smul_comm_class Function.smulCommClass
#align function.vadd_comm_class Function.vaddCommClass
@[to_additive]
theorem update_smul {α : Type*} [∀ i, SMul α (f i)] [DecidableEq I] (c : α) (f₁ : ∀ i, f i)
(i : I) (x₁ : f i) : update (c • f₁) i (c • x₁) = c • update f₁ i x₁ :=
funext fun j => (apply_update (β := f) (fun _ => (c • ·)) f₁ i x₁ j).symm
#align function.update_smul Function.update_smul
#align function.update_vadd Function.update_vadd
end Function
namespace Set
@[to_additive]
theorem piecewise_smul {α : Type*} [∀ i, SMul α (f i)] (s : Set I) [∀ i, Decidable (i ∈ s)]
(c : α) (f₁ g₁ : ∀ i, f i) : s.piecewise (c • f₁) (c • g₁) = c • s.piecewise f₁ g₁ :=
s.piecewise_op (δ' := f) f₁ _ fun _ => (c • ·)
#align set.piecewise_smul Set.piecewise_smul
#align set.piecewise_vadd Set.piecewise_vadd
end Set
section Extend
@[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e :=
funext fun x => by
-- Porting note: Lean4 is unable to automatically call `Classical.propDecidable`
haveI : Decidable (∃ a : α, f a = x) := Classical.propDecidable _
| rw [extend_def, Pi.smul_apply, Pi.smul_apply, extend_def] | @[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e :=
funext fun x => by
-- Porting note: Lean4 is unable to automatically call `Classical.propDecidable`
haveI : Decidable (∃ a : α, f a = x) := Classical.propDecidable _
| Mathlib.GroupTheory.GroupAction.Pi.267_0.o1qTP9EuP25B013 | @[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e | Mathlib_GroupTheory_GroupAction_Pi |
I : Type u
f✝ : I → Type v
x✝ y : (i : I) → f✝ i
i : I
R : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝ : SMul R γ
r : R
f : α → β
g : α → γ
e : β → γ
x : β
this : Decidable (∃ a, f a = x)
⊢ (if h : ∃ a, f a = x then (r • g) (Classical.choose h) else r • e x) =
r • if h : ∃ a, f a = x then g (Classical.choose h) else e x | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
intros
ext x
apply smul_one
#align pi.mul_distrib_mul_action' Pi.mulDistribMulAction'
end Pi
namespace Function
/-- Non-dependent version of `Pi.smul`. Lean gets confused by the dependent instance if this
is not present. -/
@[to_additive
"Non-dependent version of `Pi.vadd`. Lean gets confused by the dependent instance
if this is not present."]
instance hasSMul {ι R M : Type*} [SMul R M] : SMul R (ι → M) :=
Pi.instSMul
#align function.has_smul Function.hasSMul
#align function.has_vadd Function.hasVAdd
/-- Non-dependent version of `Pi.smulCommClass`. Lean gets confused by the dependent instance if
this is not present. -/
@[to_additive
"Non-dependent version of `Pi.vaddCommClass`. Lean gets confused by the dependent
instance if this is not present."]
instance smulCommClass {ι α β M : Type*} [SMul α M] [SMul β M] [SMulCommClass α β M] :
SMulCommClass α β (ι → M) :=
Pi.smulCommClass
#align function.smul_comm_class Function.smulCommClass
#align function.vadd_comm_class Function.vaddCommClass
@[to_additive]
theorem update_smul {α : Type*} [∀ i, SMul α (f i)] [DecidableEq I] (c : α) (f₁ : ∀ i, f i)
(i : I) (x₁ : f i) : update (c • f₁) i (c • x₁) = c • update f₁ i x₁ :=
funext fun j => (apply_update (β := f) (fun _ => (c • ·)) f₁ i x₁ j).symm
#align function.update_smul Function.update_smul
#align function.update_vadd Function.update_vadd
end Function
namespace Set
@[to_additive]
theorem piecewise_smul {α : Type*} [∀ i, SMul α (f i)] (s : Set I) [∀ i, Decidable (i ∈ s)]
(c : α) (f₁ g₁ : ∀ i, f i) : s.piecewise (c • f₁) (c • g₁) = c • s.piecewise f₁ g₁ :=
s.piecewise_op (δ' := f) f₁ _ fun _ => (c • ·)
#align set.piecewise_smul Set.piecewise_smul
#align set.piecewise_vadd Set.piecewise_vadd
end Set
section Extend
@[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e :=
funext fun x => by
-- Porting note: Lean4 is unable to automatically call `Classical.propDecidable`
haveI : Decidable (∃ a : α, f a = x) := Classical.propDecidable _
rw [extend_def, Pi.smul_apply, Pi.smul_apply, extend_def]
| split_ifs | @[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e :=
funext fun x => by
-- Porting note: Lean4 is unable to automatically call `Classical.propDecidable`
haveI : Decidable (∃ a : α, f a = x) := Classical.propDecidable _
rw [extend_def, Pi.smul_apply, Pi.smul_apply, extend_def]
| Mathlib.GroupTheory.GroupAction.Pi.267_0.o1qTP9EuP25B013 | @[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e | Mathlib_GroupTheory_GroupAction_Pi |
case pos
I : Type u
f✝ : I → Type v
x✝ y : (i : I) → f✝ i
i : I
R : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝ : SMul R γ
r : R
f : α → β
g : α → γ
e : β → γ
x : β
this : Decidable (∃ a, f a = x)
h✝ : ∃ a, f a = x
⊢ (r • g) (Classical.choose h✝) = r • g (Classical.choose h✝) | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
intros
ext x
apply smul_one
#align pi.mul_distrib_mul_action' Pi.mulDistribMulAction'
end Pi
namespace Function
/-- Non-dependent version of `Pi.smul`. Lean gets confused by the dependent instance if this
is not present. -/
@[to_additive
"Non-dependent version of `Pi.vadd`. Lean gets confused by the dependent instance
if this is not present."]
instance hasSMul {ι R M : Type*} [SMul R M] : SMul R (ι → M) :=
Pi.instSMul
#align function.has_smul Function.hasSMul
#align function.has_vadd Function.hasVAdd
/-- Non-dependent version of `Pi.smulCommClass`. Lean gets confused by the dependent instance if
this is not present. -/
@[to_additive
"Non-dependent version of `Pi.vaddCommClass`. Lean gets confused by the dependent
instance if this is not present."]
instance smulCommClass {ι α β M : Type*} [SMul α M] [SMul β M] [SMulCommClass α β M] :
SMulCommClass α β (ι → M) :=
Pi.smulCommClass
#align function.smul_comm_class Function.smulCommClass
#align function.vadd_comm_class Function.vaddCommClass
@[to_additive]
theorem update_smul {α : Type*} [∀ i, SMul α (f i)] [DecidableEq I] (c : α) (f₁ : ∀ i, f i)
(i : I) (x₁ : f i) : update (c • f₁) i (c • x₁) = c • update f₁ i x₁ :=
funext fun j => (apply_update (β := f) (fun _ => (c • ·)) f₁ i x₁ j).symm
#align function.update_smul Function.update_smul
#align function.update_vadd Function.update_vadd
end Function
namespace Set
@[to_additive]
theorem piecewise_smul {α : Type*} [∀ i, SMul α (f i)] (s : Set I) [∀ i, Decidable (i ∈ s)]
(c : α) (f₁ g₁ : ∀ i, f i) : s.piecewise (c • f₁) (c • g₁) = c • s.piecewise f₁ g₁ :=
s.piecewise_op (δ' := f) f₁ _ fun _ => (c • ·)
#align set.piecewise_smul Set.piecewise_smul
#align set.piecewise_vadd Set.piecewise_vadd
end Set
section Extend
@[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e :=
funext fun x => by
-- Porting note: Lean4 is unable to automatically call `Classical.propDecidable`
haveI : Decidable (∃ a : α, f a = x) := Classical.propDecidable _
rw [extend_def, Pi.smul_apply, Pi.smul_apply, extend_def]
split_ifs <;>
| rfl | @[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e :=
funext fun x => by
-- Porting note: Lean4 is unable to automatically call `Classical.propDecidable`
haveI : Decidable (∃ a : α, f a = x) := Classical.propDecidable _
rw [extend_def, Pi.smul_apply, Pi.smul_apply, extend_def]
split_ifs <;>
| Mathlib.GroupTheory.GroupAction.Pi.267_0.o1qTP9EuP25B013 | @[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e | Mathlib_GroupTheory_GroupAction_Pi |
case neg
I : Type u
f✝ : I → Type v
x✝ y : (i : I) → f✝ i
i : I
R : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
inst✝ : SMul R γ
r : R
f : α → β
g : α → γ
e : β → γ
x : β
this : Decidable (∃ a, f a = x)
h✝ : ¬∃ a, f a = x
⊢ r • e x = r • e x | /-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.Group.Pi
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.group_action.pi from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# Pi instances for multiplicative actions
This file defines instances for `MulAction` and related structures on `Pi` types.
## See also
* `GroupTheory.GroupAction.option`
* `GroupTheory.GroupAction.prod`
* `GroupTheory.GroupAction.sigma`
* `GroupTheory.GroupAction.sum`
-/
universe u v w
variable {I : Type u}
-- The indexing type
variable {f : I → Type v}
-- The family of types already equipped with instances
variable (x y : ∀ i, f i) (i : I)
namespace Pi
@[to_additive]
instance smul' {g : I → Type*} [∀ i, SMul (f i) (g i)] : SMul (∀ i, f i) (∀ i : I, g i) :=
⟨fun s x => fun i => s i • x i⟩
#align pi.has_smul' Pi.smul'
#align pi.has_vadd' Pi.vadd'
@[to_additive (attr := simp)]
theorem smul_apply' {g : I → Type*} [∀ i, SMul (f i) (g i)] (s : ∀ i, f i) (x : ∀ i, g i) :
(s • x) i = s i • x i :=
rfl
#align pi.smul_apply' Pi.smul_apply'
#align pi.vadd_apply' Pi.vadd_apply'
-- Porting note: `to_additive` fails to correctly translate name
@[to_additive Pi.vaddAssocClass]
instance isScalarTower {α β : Type*} [SMul α β] [∀ i, SMul β <| f i]
[∀ i, SMul α <| f i] [∀ i, IsScalarTower α β (f i)] : IsScalarTower α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_assoc x y (z i)⟩
#align pi.is_scalar_tower Pi.isScalarTower
#align pi.vadd_assoc_class Pi.vaddAssocClass
@[to_additive Pi.vaddAssocClass']
instance isScalarTower' {g : I → Type*} {α : Type*} [∀ i, SMul α <| f i]
[∀ i, SMul (f i) (g i)] [∀ i, SMul α <| g i] [∀ i, IsScalarTower α (f i) (g i)] :
IsScalarTower α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_assoc x (y i) (z i)⟩
#align pi.is_scalar_tower' Pi.isScalarTower'
#align pi.vadd_assoc_class' Pi.vaddAssocClass'
@[to_additive Pi.vaddAssocClass'']
instance isScalarTower'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (f i) (g i)]
[∀ i, SMul (g i) (h i)] [∀ i, SMul (f i) (h i)] [∀ i, IsScalarTower (f i) (g i) (h i)] :
IsScalarTower (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_assoc (x i) (y i) (z i)⟩
#align pi.is_scalar_tower'' Pi.isScalarTower''
#align pi.vadd_assoc_class'' Pi.vaddAssocClass''
@[to_additive]
instance smulCommClass {α β : Type*} [∀ i, SMul α <| f i] [∀ i, SMul β <| f i]
[∀ i, SMulCommClass α β (f i)] : SMulCommClass α β (∀ i : I, f i) :=
⟨fun x y z => funext fun i => smul_comm x y (z i)⟩
#align pi.smul_comm_class Pi.smulCommClass
#align pi.vadd_comm_class Pi.vaddCommClass
@[to_additive]
instance smulCommClass' {g : I → Type*} {α : Type*} [∀ i, SMul α <| g i]
[∀ i, SMul (f i) (g i)] [∀ i, SMulCommClass α (f i) (g i)] :
SMulCommClass α (∀ i : I, f i) (∀ i : I, g i) :=
⟨fun x y z => funext fun i => smul_comm x (y i) (z i)⟩
#align pi.smul_comm_class' Pi.smulCommClass'
#align pi.vadd_comm_class' Pi.vaddCommClass'
@[to_additive]
instance smulCommClass'' {g : I → Type*} {h : I → Type*} [∀ i, SMul (g i) (h i)]
[∀ i, SMul (f i) (h i)] [∀ i, SMulCommClass (f i) (g i) (h i)] :
SMulCommClass (∀ i, f i) (∀ i, g i) (∀ i, h i) :=
⟨fun x y z => funext fun i => smul_comm (x i) (y i) (z i)⟩
#align pi.smul_comm_class'' Pi.smulCommClass''
#align pi.vadd_comm_class'' Pi.vaddCommClass''
@[to_additive]
instance isCentralScalar {α : Type*} [∀ i, SMul α <| f i] [∀ i, SMul αᵐᵒᵖ <| f i]
[∀ i, IsCentralScalar α (f i)] : IsCentralScalar α (∀ i, f i) :=
⟨fun _ _ => funext fun _ => op_smul_eq_smul _ _⟩
/-- If `f i` has a faithful scalar action for a given `i`, then so does `Π i, f i`. This is
not an instance as `i` cannot be inferred. -/
@[to_additive
"If `f i` has a faithful additive action for a given `i`, then
so does `Π i, f i`. This is not an instance as `i` cannot be inferred"]
theorem faithfulSMul_at {α : Type*} [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)] (i : I)
[FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
⟨fun h =>
eq_of_smul_eq_smul fun a : f i => by
classical
have :=
congr_fun (h <| Function.update (fun j => Classical.choice (‹∀ i, Nonempty (f i)› j)) i a)
i
simpa using this⟩
#align pi.has_faithful_smul_at Pi.faithfulSMul_at
#align pi.has_faithful_vadd_at Pi.faithfulVAdd_at
@[to_additive]
instance faithfulSMul {α : Type*} [Nonempty I] [∀ i, SMul α <| f i] [∀ i, Nonempty (f i)]
[∀ i, FaithfulSMul α (f i)] : FaithfulSMul α (∀ i, f i) :=
let ⟨i⟩ := ‹Nonempty I›
faithfulSMul_at i
#align pi.has_faithful_smul Pi.faithfulSMul
#align pi.has_faithful_vadd Pi.faithfulVAdd
@[to_additive]
instance mulAction (α) {m : Monoid α} [∀ i, MulAction α <| f i] :
@MulAction α (∀ i : I, f i) m where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul α _
#align pi.mul_action Pi.mulAction
#align pi.add_action Pi.addAction
@[to_additive]
instance mulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} [∀ i, MulAction (f i) (g i)] :
@MulAction (∀ i, f i) (∀ i : I, g i)
(@Pi.monoid I f m) where
smul := (· • ·)
mul_smul _ _ _ := funext fun _ => mul_smul _ _ _
one_smul _ := funext fun _ => one_smul _ _
#align pi.mul_action' Pi.mulAction'
#align pi.add_action' Pi.addAction'
instance smulZeroClass (α) {n : ∀ i, Zero <| f i} [∀ i, SMulZeroClass α <| f i] :
@SMulZeroClass α (∀ i : I, f i) (@Pi.instZero I f n) where
smul_zero _ := funext fun _ => smul_zero _
#align pi.smul_zero_class Pi.smulZeroClass
instance smulZeroClass' {g : I → Type*} {n : ∀ i, Zero <| g i} [∀ i, SMulZeroClass (f i) (g i)] :
@SMulZeroClass (∀ i, f i) (∀ i : I, g i) (@Pi.instZero I g n) where
smul_zero := by intros; ext x; exact smul_zero _
#align pi.smul_zero_class' Pi.smulZeroClass'
instance distribSMul (α) {n : ∀ i, AddZeroClass <| f i} [∀ i, DistribSMul α <| f i] :
@DistribSMul α (∀ i : I, f i) (@Pi.addZeroClass I f n) where
smul_zero _ := funext fun _ => smul_zero _
smul_add _ _ _ := funext fun _ => smul_add _ _ _
#align pi.distrib_smul Pi.distribSMul
instance distribSMul' {g : I → Type*} {n : ∀ i, AddZeroClass <| g i}
[∀ i, DistribSMul (f i) (g i)] :
@DistribSMul (∀ i, f i) (∀ i : I, g i) (@Pi.addZeroClass I g n) where
smul_zero := by intros; ext x; exact smul_zero _
smul_add := by intros; ext x; exact smul_add _ _ _
#align pi.distrib_smul' Pi.distribSMul'
instance distribMulAction (α) {m : Monoid α} {n : ∀ i, AddMonoid <| f i}
[∀ i, DistribMulAction α <| f i] : @DistribMulAction α (∀ i : I, f i) m (@Pi.addMonoid I f n) :=
{ Pi.mulAction _, Pi.distribSMul _ with }
#align pi.distrib_mul_action Pi.distribMulAction
instance distribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, AddMonoid <| g i}
[∀ i, DistribMulAction (f i) (g i)] :
@DistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.addMonoid I g n) :=
{ Pi.mulAction', Pi.distribSMul' with }
#align pi.distrib_mul_action' Pi.distribMulAction'
theorem single_smul {α} [Monoid α] [∀ i, AddMonoid <| f i] [∀ i, DistribMulAction α <| f i]
[DecidableEq I] (i : I) (r : α) (x : f i) : single i (r • x) = r • single i x :=
single_op (fun i : I => (r • · : f i → f i)) (fun _ => smul_zero _) _ _
#align pi.single_smul Pi.single_smul
-- Porting note: Lean4 cannot infer the non-dependent function `f := fun _ => β`
/-- A version of `Pi.single_smul` for non-dependent functions. It is useful in cases where Lean
fails to apply `Pi.single_smul`. -/
theorem single_smul' {α β} [Monoid α] [AddMonoid β] [DistribMulAction α β] [DecidableEq I] (i : I)
(r : α) (x : β) : single (f := fun _ => β) i (r • x) = r • single (f := fun _ => β) i x :=
single_smul (f := fun _ => β) i r x
#align pi.single_smul' Pi.single_smul'
theorem single_smul₀ {g : I → Type*} [∀ i, MonoidWithZero (f i)] [∀ i, AddMonoid (g i)]
[∀ i, DistribMulAction (f i) (g i)] [DecidableEq I] (i : I) (r : f i) (x : g i) :
single i (r • x) = single i r • single i x :=
single_op₂ (fun i : I => ((· • ·) : f i → g i → g i)) (fun _ => smul_zero _) _ _ _
#align pi.single_smul₀ Pi.single_smul₀
instance mulDistribMulAction (α) {m : Monoid α} {n : ∀ i, Monoid <| f i}
[∀ i, MulDistribMulAction α <| f i] :
@MulDistribMulAction α (∀ i : I, f i) m (@Pi.monoid I f n) :=
{ Pi.mulAction _ with
smul_one := fun _ => funext fun _ => smul_one _
smul_mul := fun _ _ _ => funext fun _ => smul_mul' _ _ _ }
#align pi.mul_distrib_mul_action Pi.mulDistribMulAction
instance mulDistribMulAction' {g : I → Type*} {m : ∀ i, Monoid (f i)} {n : ∀ i, Monoid <| g i}
[∀ i, MulDistribMulAction (f i) (g i)] :
@MulDistribMulAction (∀ i, f i) (∀ i : I, g i) (@Pi.monoid I f m) (@Pi.monoid I g n) where
smul_mul := by
intros
ext x
apply smul_mul'
smul_one := by
intros
ext x
apply smul_one
#align pi.mul_distrib_mul_action' Pi.mulDistribMulAction'
end Pi
namespace Function
/-- Non-dependent version of `Pi.smul`. Lean gets confused by the dependent instance if this
is not present. -/
@[to_additive
"Non-dependent version of `Pi.vadd`. Lean gets confused by the dependent instance
if this is not present."]
instance hasSMul {ι R M : Type*} [SMul R M] : SMul R (ι → M) :=
Pi.instSMul
#align function.has_smul Function.hasSMul
#align function.has_vadd Function.hasVAdd
/-- Non-dependent version of `Pi.smulCommClass`. Lean gets confused by the dependent instance if
this is not present. -/
@[to_additive
"Non-dependent version of `Pi.vaddCommClass`. Lean gets confused by the dependent
instance if this is not present."]
instance smulCommClass {ι α β M : Type*} [SMul α M] [SMul β M] [SMulCommClass α β M] :
SMulCommClass α β (ι → M) :=
Pi.smulCommClass
#align function.smul_comm_class Function.smulCommClass
#align function.vadd_comm_class Function.vaddCommClass
@[to_additive]
theorem update_smul {α : Type*} [∀ i, SMul α (f i)] [DecidableEq I] (c : α) (f₁ : ∀ i, f i)
(i : I) (x₁ : f i) : update (c • f₁) i (c • x₁) = c • update f₁ i x₁ :=
funext fun j => (apply_update (β := f) (fun _ => (c • ·)) f₁ i x₁ j).symm
#align function.update_smul Function.update_smul
#align function.update_vadd Function.update_vadd
end Function
namespace Set
@[to_additive]
theorem piecewise_smul {α : Type*} [∀ i, SMul α (f i)] (s : Set I) [∀ i, Decidable (i ∈ s)]
(c : α) (f₁ g₁ : ∀ i, f i) : s.piecewise (c • f₁) (c • g₁) = c • s.piecewise f₁ g₁ :=
s.piecewise_op (δ' := f) f₁ _ fun _ => (c • ·)
#align set.piecewise_smul Set.piecewise_smul
#align set.piecewise_vadd Set.piecewise_vadd
end Set
section Extend
@[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e :=
funext fun x => by
-- Porting note: Lean4 is unable to automatically call `Classical.propDecidable`
haveI : Decidable (∃ a : α, f a = x) := Classical.propDecidable _
rw [extend_def, Pi.smul_apply, Pi.smul_apply, extend_def]
split_ifs <;>
| rfl | @[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e :=
funext fun x => by
-- Porting note: Lean4 is unable to automatically call `Classical.propDecidable`
haveI : Decidable (∃ a : α, f a = x) := Classical.propDecidable _
rw [extend_def, Pi.smul_apply, Pi.smul_apply, extend_def]
split_ifs <;>
| Mathlib.GroupTheory.GroupAction.Pi.267_0.o1qTP9EuP25B013 | @[to_additive]
theorem Function.extend_smul {R α β γ : Type*} [SMul R γ] (r : R) (f : α → β) (g : α → γ)
(e : β → γ) : Function.extend f (r • g) (r • e) = r • Function.extend f g e | Mathlib_GroupTheory_GroupAction_Pi |
α : Type u_1
s : Set α
a : α
⊢ op a ∈ Set.op s ↔ a ∈ s | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by | rfl | @[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by | Mathlib.Data.Set.Opposite.38_0.2CXAU37XQBxMDqP | @[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s | Mathlib_Data_Set_Opposite |
α : Type u_1
s : Set αᵒᵖ
a : αᵒᵖ
⊢ a.unop ∈ Set.unop s ↔ a ∈ s | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by | rfl | @[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by | Mathlib.Data.Set.Opposite.47_0.2CXAU37XQBxMDqP | @[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s | Mathlib_Data_Set_Opposite |
α : Type u_1
x : α
⊢ Set.op {x} = {op x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
| ext | @[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
| Mathlib.Data.Set.Opposite.75_0.2CXAU37XQBxMDqP | @[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} | Mathlib_Data_Set_Opposite |
case h
α : Type u_1
x : α
x✝ : αᵒᵖ
⊢ x✝ ∈ Set.op {x} ↔ x✝ ∈ {op x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
| constructor | @[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
| Mathlib.Data.Set.Opposite.75_0.2CXAU37XQBxMDqP | @[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} | Mathlib_Data_Set_Opposite |
case h.mp
α : Type u_1
x : α
x✝ : αᵒᵖ
⊢ x✝ ∈ Set.op {x} → x✝ ∈ {op x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· | apply unop_injective | @[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· | Mathlib.Data.Set.Opposite.75_0.2CXAU37XQBxMDqP | @[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} | Mathlib_Data_Set_Opposite |
case h.mpr
α : Type u_1
x : α
x✝ : αᵒᵖ
⊢ x✝ ∈ {op x} → x✝ ∈ Set.op {x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· | apply op_injective | @[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· | Mathlib.Data.Set.Opposite.75_0.2CXAU37XQBxMDqP | @[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} | Mathlib_Data_Set_Opposite |
α : Type u_1
x : αᵒᵖ
⊢ Set.unop {x} = {x.unop} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
| ext | @[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
| Mathlib.Data.Set.Opposite.83_0.2CXAU37XQBxMDqP | @[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} | Mathlib_Data_Set_Opposite |
case h
α : Type u_1
x : αᵒᵖ
x✝ : α
⊢ x✝ ∈ Set.unop {x} ↔ x✝ ∈ {x.unop} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
| constructor | @[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
| Mathlib.Data.Set.Opposite.83_0.2CXAU37XQBxMDqP | @[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} | Mathlib_Data_Set_Opposite |
case h.mp
α : Type u_1
x : αᵒᵖ
x✝ : α
⊢ x✝ ∈ Set.unop {x} → x✝ ∈ {x.unop} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· | apply op_injective | @[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· | Mathlib.Data.Set.Opposite.83_0.2CXAU37XQBxMDqP | @[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} | Mathlib_Data_Set_Opposite |
case h.mpr
α : Type u_1
x : αᵒᵖ
x✝ : α
⊢ x✝ ∈ {x.unop} → x✝ ∈ Set.unop {x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· | apply unop_injective | @[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· | Mathlib.Data.Set.Opposite.83_0.2CXAU37XQBxMDqP | @[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} | Mathlib_Data_Set_Opposite |
α : Type u_1
x : α
⊢ Set.unop {op x} = {x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
| ext | @[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
| Mathlib.Data.Set.Opposite.91_0.2CXAU37XQBxMDqP | @[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} | Mathlib_Data_Set_Opposite |
case h
α : Type u_1
x x✝ : α
⊢ x✝ ∈ Set.unop {op x} ↔ x✝ ∈ {x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
| constructor | @[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
| Mathlib.Data.Set.Opposite.91_0.2CXAU37XQBxMDqP | @[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} | Mathlib_Data_Set_Opposite |
case h.mp
α : Type u_1
x x✝ : α
⊢ x✝ ∈ Set.unop {op x} → x✝ ∈ {x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
constructor
· | apply op_injective | @[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
constructor
· | Mathlib.Data.Set.Opposite.91_0.2CXAU37XQBxMDqP | @[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} | Mathlib_Data_Set_Opposite |
case h.mpr
α : Type u_1
x x✝ : α
⊢ x✝ ∈ {x} → x✝ ∈ Set.unop {op x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
constructor
· apply op_injective
· | apply unop_injective | @[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
constructor
· apply op_injective
· | Mathlib.Data.Set.Opposite.91_0.2CXAU37XQBxMDqP | @[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} | Mathlib_Data_Set_Opposite |
α : Type u_1
x : αᵒᵖ
⊢ Set.op {x.unop} = {x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_op_unop Set.singleton_op_unop
@[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} := by
| ext | @[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} := by
| Mathlib.Data.Set.Opposite.99_0.2CXAU37XQBxMDqP | @[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} | Mathlib_Data_Set_Opposite |
case h
α : Type u_1
x x✝ : αᵒᵖ
⊢ x✝ ∈ Set.op {x.unop} ↔ x✝ ∈ {x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_op_unop Set.singleton_op_unop
@[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} := by
ext
| constructor | @[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} := by
ext
| Mathlib.Data.Set.Opposite.99_0.2CXAU37XQBxMDqP | @[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} | Mathlib_Data_Set_Opposite |
case h.mp
α : Type u_1
x x✝ : αᵒᵖ
⊢ x✝ ∈ Set.op {x.unop} → x✝ ∈ {x} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_op_unop Set.singleton_op_unop
@[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} := by
ext
constructor
· | apply unop_injective | @[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} := by
ext
constructor
· | Mathlib.Data.Set.Opposite.99_0.2CXAU37XQBxMDqP | @[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} | Mathlib_Data_Set_Opposite |
case h.mpr
α : Type u_1
x x✝ : αᵒᵖ
⊢ x✝ ∈ {x} → x✝ ∈ Set.op {x.unop} | /-
Copyright (c) 2022 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Image
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
/-!
# The opposite of a set
The opposite of a set `s` is simply the set obtained by taking the opposite of each member of `s`.
-/
variable {α : Type*}
open Opposite
namespace Set
/-- The opposite of a set `s` is the set obtained by taking the opposite of each member of `s`. -/
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
/-- The unop of a set `s` is the set obtained by taking the unop of each member of `s`. -/
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
/-- The members of the opposite of a set are in bijection with the members of the set itself. -/
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
/-- Taking opposites as an equivalence of powersets. -/
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_op_unop Set.singleton_op_unop
@[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} := by
ext
constructor
· apply unop_injective
· | apply op_injective | @[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} := by
ext
constructor
· apply unop_injective
· | Mathlib.Data.Set.Opposite.99_0.2CXAU37XQBxMDqP | @[simp 1100]
theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} | Mathlib_Data_Set_Opposite |
n : ℕ
⊢ bodd (succ n) = !bodd n | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
| simp only [bodd, boddDiv2] | @[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
| Mathlib.Init.Data.Nat.Bitwise.67_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
⊢ (match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).fst =
!(boddDiv2 n).fst | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
| let ⟨b,m⟩ := boddDiv2 n | @[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
| Mathlib.Init.Data.Nat.Bitwise.67_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
b : Bool
m : ℕ
⊢ (match (b, m) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).fst =
!(b, m).fst | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
| cases b | @[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
| Mathlib.Init.Data.Nat.Bitwise.67_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case false
n m : ℕ
⊢ (match (false, m) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).fst =
!(false, m).fst | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> | rfl | @[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> | Mathlib.Init.Data.Nat.Bitwise.67_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case true
n m : ℕ
⊢ (match (true, m) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).fst =
!(true, m).fst | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> | rfl | @[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> | Mathlib.Init.Data.Nat.Bitwise.67_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) | Mathlib_Init_Data_Nat_Bitwise |
m n : ℕ
⊢ bodd (m + n) = bxor (bodd m) (bodd n) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
| induction n | @[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
| Mathlib.Init.Data.Nat.Bitwise.74_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case zero
m : ℕ
⊢ bodd (m + zero) = bxor (bodd m) (bodd zero) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> | simp_all [add_succ, Bool.xor_not] | @[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> | Mathlib.Init.Data.Nat.Bitwise.74_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case succ
m n✝ : ℕ
n_ih✝ : bodd (m + n✝) = bxor (bodd m) (bodd n✝)
⊢ bodd (m + succ n✝) = bxor (bodd m) (bodd (succ n✝)) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> | simp_all [add_succ, Bool.xor_not] | @[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> | Mathlib.Init.Data.Nat.Bitwise.74_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) | Mathlib_Init_Data_Nat_Bitwise |
m n : ℕ
⊢ bodd (m * n) = (bodd m && bodd n) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
| induction' n with n IH | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
| Mathlib.Init.Data.Nat.Bitwise.79_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case zero
m : ℕ
⊢ bodd (m * zero) = (bodd m && bodd zero) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· | simp | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· | Mathlib.Init.Data.Nat.Bitwise.79_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case succ
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bodd (m * succ n) = (bodd m && bodd (succ n)) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· | simp [mul_succ, IH] | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· | Mathlib.Init.Data.Nat.Bitwise.79_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case succ
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (bodd m && bodd n) (bodd m) = (bodd m && !bodd n) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
| cases bodd m | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
| Mathlib.Init.Data.Nat.Bitwise.79_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case succ.false
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (false && bodd n) false = (false && !bodd n) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> | cases bodd n | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> | Mathlib.Init.Data.Nat.Bitwise.79_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case succ.true
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (true && bodd n) true = (true && !bodd n) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> | cases bodd n | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> | Mathlib.Init.Data.Nat.Bitwise.79_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case succ.false.false
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (false && false) false = (false && !false) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> | rfl | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> | Mathlib.Init.Data.Nat.Bitwise.79_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case succ.false.true
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (false && true) false = (false && !true) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> | rfl | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> | Mathlib.Init.Data.Nat.Bitwise.79_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case succ.true.false
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (true && false) true = (true && !false) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> | rfl | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> | Mathlib.Init.Data.Nat.Bitwise.79_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) | Mathlib_Init_Data_Nat_Bitwise |
case succ.true.true
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (true && true) true = (true && !true) | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> | rfl | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> | Mathlib.Init.Data.Nat.Bitwise.79_0.OFUBkIQvV236FCW | @[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
⊢ n % 2 = bif bodd n then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
| have := congr_arg bodd (mod_add_div n 2) | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
| Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
this : bodd (n % 2 + 2 * (n / 2)) = bodd n
⊢ n % 2 = bif bodd n then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
| simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
| Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
this : bodd (n % 2 + 2 * (n / 2)) = bodd n
⊢ n % 2 = bif bodd n then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says | simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says | Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
this : bodd (n % 2) = bodd n
⊢ n % 2 = bif bodd n then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
| have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
| Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
this : bodd (n % 2) = bodd n
⊢ ∀ (b : Bool), (false && b) = false | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
| intro b | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
| Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
this : bodd (n % 2) = bodd n
b : Bool
⊢ (false && b) = false | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
| cases b | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
| Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
case false
n : ℕ
this : bodd (n % 2) = bodd n
⊢ (false && false) = false | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> | rfl | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> | Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
case true
n : ℕ
this : bodd (n % 2) = bodd n
⊢ (false && true) = false | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> | rfl | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> | Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
this : bodd (n % 2) = bodd n
x✝ : ∀ (b : Bool), (false && b) = false
⊢ n % 2 = bif bodd n then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
| have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
| Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
this : bodd (n % 2) = bodd n
x✝ : ∀ (b : Bool), (false && b) = false
⊢ ∀ (b : Bool), bxor b false = b | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
| intro b | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
| Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
this : bodd (n % 2) = bodd n
x✝ : ∀ (b : Bool), (false && b) = false
b : Bool
⊢ bxor b false = b | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
| cases b | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
| Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
case false
n : ℕ
this : bodd (n % 2) = bodd n
x✝ : ∀ (b : Bool), (false && b) = false
⊢ bxor false false = false | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> | rfl | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> | Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
case true
n : ℕ
this : bodd (n % 2) = bodd n
x✝ : ∀ (b : Bool), (false && b) = false
⊢ bxor true false = true | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> | rfl | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> | Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
⊢ n % 2 = bif bodd n then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
| rw [← this] | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
| Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
⊢ n % 2 = bif bodd (n % 2) then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
| cases' mod_two_eq_zero_or_one n with h h | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
| Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
case inl
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
h : n % 2 = 0
⊢ n % 2 = bif bodd (n % 2) then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> | rw [h] | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> | Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
case inr
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
h : n % 2 = 1
⊢ n % 2 = bif bodd (n % 2) then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> | rw [h] | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> | Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
case inl
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
h : n % 2 = 0
⊢ 0 = bif bodd 0 then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> | rfl | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> | Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
case inr
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
h : n % 2 = 1
⊢ 1 = bif bodd 1 then 1 else 0 | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> | rfl | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> | Mathlib.Init.Data.Nat.Bitwise.87_0.OFUBkIQvV236FCW | theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
⊢ div2 (succ n) = bif bodd n then succ (div2 n) else div2 n | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> rfl
#align nat.mod_two_of_bodd Nat.mod_two_of_bodd
@[simp]
theorem div2_zero : div2 0 = 0 :=
rfl
#align nat.div2_zero Nat.div2_zero
theorem div2_one : div2 1 = 0 :=
rfl
#align nat.div2_one Nat.div2_one
theorem div2_two : div2 2 = 1 :=
rfl
#align nat.div2_two Nat.div2_two
@[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
| simp only [bodd, boddDiv2, div2] | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
| Mathlib.Init.Data.Nat.Bitwise.115_0.OFUBkIQvV236FCW | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
⊢ (match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).snd =
bif (boddDiv2 n).fst then succ (boddDiv2 n).snd else (boddDiv2 n).snd | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> rfl
#align nat.mod_two_of_bodd Nat.mod_two_of_bodd
@[simp]
theorem div2_zero : div2 0 = 0 :=
rfl
#align nat.div2_zero Nat.div2_zero
theorem div2_one : div2 1 = 0 :=
rfl
#align nat.div2_one Nat.div2_one
theorem div2_two : div2 2 = 1 :=
rfl
#align nat.div2_two Nat.div2_two
@[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
| cases' boddDiv2 n with fst snd | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
| Mathlib.Init.Data.Nat.Bitwise.115_0.OFUBkIQvV236FCW | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) | Mathlib_Init_Data_Nat_Bitwise |
case mk
n : ℕ
fst : Bool
snd : ℕ
⊢ (match (fst, snd) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).snd =
bif (fst, snd).fst then succ (fst, snd).snd else (fst, snd).snd | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> rfl
#align nat.mod_two_of_bodd Nat.mod_two_of_bodd
@[simp]
theorem div2_zero : div2 0 = 0 :=
rfl
#align nat.div2_zero Nat.div2_zero
theorem div2_one : div2 1 = 0 :=
rfl
#align nat.div2_one Nat.div2_one
theorem div2_two : div2 2 = 1 :=
rfl
#align nat.div2_two Nat.div2_two
@[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
| cases fst | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
| Mathlib.Init.Data.Nat.Bitwise.115_0.OFUBkIQvV236FCW | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) | Mathlib_Init_Data_Nat_Bitwise |
case mk.false
n snd : ℕ
⊢ (match (false, snd) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).snd =
bif (false, snd).fst then succ (false, snd).snd else (false, snd).snd
case mk.true
n snd : ℕ
⊢ (match (true, snd) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).snd =
bif (true, snd).fst then succ (true, snd).snd else (true, snd).snd | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> rfl
#align nat.mod_two_of_bodd Nat.mod_two_of_bodd
@[simp]
theorem div2_zero : div2 0 = 0 :=
rfl
#align nat.div2_zero Nat.div2_zero
theorem div2_one : div2 1 = 0 :=
rfl
#align nat.div2_one Nat.div2_one
theorem div2_two : div2 2 = 1 :=
rfl
#align nat.div2_two Nat.div2_two
@[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
| case mk.false =>
simp | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
| Mathlib.Init.Data.Nat.Bitwise.115_0.OFUBkIQvV236FCW | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) | Mathlib_Init_Data_Nat_Bitwise |
n snd : ℕ
⊢ (match (false, snd) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).snd =
bif (false, snd).fst then succ (false, snd).snd else (false, snd).snd | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> rfl
#align nat.mod_two_of_bodd Nat.mod_two_of_bodd
@[simp]
theorem div2_zero : div2 0 = 0 :=
rfl
#align nat.div2_zero Nat.div2_zero
theorem div2_one : div2 1 = 0 :=
rfl
#align nat.div2_one Nat.div2_one
theorem div2_two : div2 2 = 1 :=
rfl
#align nat.div2_two Nat.div2_two
@[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
| case mk.false =>
simp | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
| Mathlib.Init.Data.Nat.Bitwise.115_0.OFUBkIQvV236FCW | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) | Mathlib_Init_Data_Nat_Bitwise |
n snd : ℕ
⊢ (match (false, snd) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).snd =
bif (false, snd).fst then succ (false, snd).snd else (false, snd).snd | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> rfl
#align nat.mod_two_of_bodd Nat.mod_two_of_bodd
@[simp]
theorem div2_zero : div2 0 = 0 :=
rfl
#align nat.div2_zero Nat.div2_zero
theorem div2_one : div2 1 = 0 :=
rfl
#align nat.div2_one Nat.div2_one
theorem div2_two : div2 2 = 1 :=
rfl
#align nat.div2_two Nat.div2_two
@[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
case mk.false =>
| simp | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
case mk.false =>
| Mathlib.Init.Data.Nat.Bitwise.115_0.OFUBkIQvV236FCW | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) | Mathlib_Init_Data_Nat_Bitwise |
case mk.true
n snd : ℕ
⊢ (match (true, snd) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).snd =
bif (true, snd).fst then succ (true, snd).snd else (true, snd).snd | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> rfl
#align nat.mod_two_of_bodd Nat.mod_two_of_bodd
@[simp]
theorem div2_zero : div2 0 = 0 :=
rfl
#align nat.div2_zero Nat.div2_zero
theorem div2_one : div2 1 = 0 :=
rfl
#align nat.div2_one Nat.div2_one
theorem div2_two : div2 2 = 1 :=
rfl
#align nat.div2_two Nat.div2_two
@[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
case mk.false =>
simp
| case mk.true =>
simp | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
case mk.false =>
simp
| Mathlib.Init.Data.Nat.Bitwise.115_0.OFUBkIQvV236FCW | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) | Mathlib_Init_Data_Nat_Bitwise |
n snd : ℕ
⊢ (match (true, snd) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).snd =
bif (true, snd).fst then succ (true, snd).snd else (true, snd).snd | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> rfl
#align nat.mod_two_of_bodd Nat.mod_two_of_bodd
@[simp]
theorem div2_zero : div2 0 = 0 :=
rfl
#align nat.div2_zero Nat.div2_zero
theorem div2_one : div2 1 = 0 :=
rfl
#align nat.div2_one Nat.div2_one
theorem div2_two : div2 2 = 1 :=
rfl
#align nat.div2_two Nat.div2_two
@[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
case mk.false =>
simp
| case mk.true =>
simp | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
case mk.false =>
simp
| Mathlib.Init.Data.Nat.Bitwise.115_0.OFUBkIQvV236FCW | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) | Mathlib_Init_Data_Nat_Bitwise |
n snd : ℕ
⊢ (match (true, snd) with
| (false, m) => (true, m)
| (true, m) => (false, succ m)).snd =
bif (true, snd).fst then succ (true, snd).snd else (true, snd).snd | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> rfl
#align nat.mod_two_of_bodd Nat.mod_two_of_bodd
@[simp]
theorem div2_zero : div2 0 = 0 :=
rfl
#align nat.div2_zero Nat.div2_zero
theorem div2_one : div2 1 = 0 :=
rfl
#align nat.div2_one Nat.div2_one
theorem div2_two : div2 2 = 1 :=
rfl
#align nat.div2_two Nat.div2_two
@[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
case mk.false =>
simp
case mk.true =>
| simp | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
case mk.false =>
simp
case mk.true =>
| Mathlib.Init.Data.Nat.Bitwise.115_0.OFUBkIQvV236FCW | @[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) | Mathlib_Init_Data_Nat_Bitwise |
n : ℕ
⊢ (bif bodd (succ n) then 1 else 0) + 2 * div2 (succ n) = succ n | /-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Init.Data.Nat.Lemmas
import Init.WFTactics
import Mathlib.Data.Bool.Basic
import Mathlib.Init.Data.Bool.Lemmas
import Mathlib.Init.ZeroOne
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Says
#align_import init.data.nat.bitwise from "leanprover-community/lean"@"53e8520d8964c7632989880372d91ba0cecbaf00"
/-!
# Lemmas about bitwise operations on natural numbers.
Possibly only of archaeological significance.
-/
set_option autoImplicit true
universe u
-- Once we're in the `Nat` namespace, `xor` will inconveniently resolve to `Nat.xor`.
/-- `bxor` denotes the `xor` function i.e. the exclusive-or function on type `Bool`. -/
local notation "bxor" => _root_.xor
namespace Nat
set_option linter.deprecated false
/-- `boddDiv2 n` returns a 2-tuple of type `(Bool,Nat)`
where the `Bool` value indicates whether `n` is odd or not
and the `Nat` value returns `⌊n/2⌋` -/
def boddDiv2 : ℕ → Bool × ℕ
| 0 => (false, 0)
| succ n =>
match boddDiv2 n with
| (false, m) => (true, m)
| (true, m) => (false, succ m)
#align nat.bodd_div2 Nat.boddDiv2
/-- `div2 n = ⌊n/2⌋` the greatest integer smaller than `n/2`-/
def div2 (n : ℕ) : ℕ :=
(boddDiv2 n).2
#align nat.div2 Nat.div2
/-- `bodd n` returns `true` if `n` is odd-/
def bodd (n : ℕ) : Bool :=
(boddDiv2 n).1
#align nat.bodd Nat.bodd
@[simp]
theorem bodd_zero : bodd 0 = false :=
rfl
#align nat.bodd_zero Nat.bodd_zero
theorem bodd_one : bodd 1 = true :=
rfl
#align nat.bodd_one Nat.bodd_one
theorem bodd_two : bodd 2 = false :=
rfl
#align nat.bodd_two Nat.bodd_two
@[simp]
theorem bodd_succ (n : ℕ) : bodd (succ n) = not (bodd n) := by
simp only [bodd, boddDiv2]
let ⟨b,m⟩ := boddDiv2 n
cases b <;> rfl
#align nat.bodd_succ Nat.bodd_succ
@[simp]
theorem bodd_add (m n : ℕ) : bodd (m + n) = bxor (bodd m) (bodd n) := by
induction n <;> simp_all [add_succ, Bool.xor_not]
#align nat.bodd_add Nat.bodd_add
@[simp]
theorem bodd_mul (m n : ℕ) : bodd (m * n) = (bodd m && bodd n) := by
induction' n with n IH
· simp
· simp [mul_succ, IH]
cases bodd m <;> cases bodd n <;> rfl
#align nat.bodd_mul Nat.bodd_mul
theorem mod_two_of_bodd (n : ℕ) : n % 2 = cond (bodd n) 1 0 := by
have := congr_arg bodd (mod_add_div n 2)
simp? [not] at this
says simp only [bodd_add, bodd_mul, bodd_succ, not, bodd_zero, Bool.false_and,
Bool.xor_false] at this
have _ : ∀ b, and false b = false := by
intro b
cases b <;> rfl
have _ : ∀ b, bxor b false = b := by
intro b
cases b <;> rfl
rw [← this]
cases' mod_two_eq_zero_or_one n with h h <;> rw [h] <;> rfl
#align nat.mod_two_of_bodd Nat.mod_two_of_bodd
@[simp]
theorem div2_zero : div2 0 = 0 :=
rfl
#align nat.div2_zero Nat.div2_zero
theorem div2_one : div2 1 = 0 :=
rfl
#align nat.div2_one Nat.div2_one
theorem div2_two : div2 2 = 1 :=
rfl
#align nat.div2_two Nat.div2_two
@[simp]
theorem div2_succ (n : ℕ) : div2 (succ n) = cond (bodd n) (succ (div2 n)) (div2 n) := by
simp only [bodd, boddDiv2, div2]
cases' boddDiv2 n with fst snd
cases fst
case mk.false =>
simp
case mk.true =>
simp
#align nat.div2_succ Nat.div2_succ
attribute [local simp] Nat.add_comm Nat.add_assoc Nat.add_left_comm Nat.mul_comm Nat.mul_assoc
theorem bodd_add_div2 : ∀ n, cond (bodd n) 1 0 + 2 * div2 n = n
| 0 => rfl
| succ n => by
| simp only [bodd_succ, Bool.cond_not, div2_succ, Nat.mul_comm] | theorem bodd_add_div2 : ∀ n, cond (bodd n) 1 0 + 2 * div2 n = n
| 0 => rfl
| succ n => by
| Mathlib.Init.Data.Nat.Bitwise.128_0.OFUBkIQvV236FCW | theorem bodd_add_div2 : ∀ n, cond (bodd n) 1 0 + 2 * div2 n = n
| 0 => rfl
| succ n => by
simp only [bodd_succ, Bool.cond_not, div2_succ, Nat.mul_comm]
refine' Eq.trans _ (congr_arg succ (bodd_add_div2 n))
cases bodd n <;> simp [cond, not]
· rw [Nat.add_comm, Nat.add_succ]
· rw [succ_mul, Nat.add_comm 1, Nat.add_succ] | Mathlib_Init_Data_Nat_Bitwise |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.