Module docstring
{}
{}
Prod.instLawfulBEq
instance
[BEq α] [BEq β] [LawfulBEq α] [LawfulBEq β] : LawfulBEq (α × β)
Prod.forall
theorem
{p : α × β → Prop} : (∀ x, p x) ↔ ∀ a b, p (a, b)
@[simp]
protected theorem «forall» {p : α × β → Prop} : (∀ x, p x) ↔ ∀ a b, p (a, b) :=
⟨fun h a b ↦ h (a, b), fun h ⟨a, b⟩ ↦ h a b⟩
Prod.exists
theorem
{p : α × β → Prop} : (∃ x, p x) ↔ ∃ a b, p (a, b)
@[simp]
protected theorem «exists» {p : α × β → Prop} : (∃ x, p x) ↔ ∃ a b, p (a, b) :=
⟨fun ⟨⟨a, b⟩, h⟩ ↦ ⟨a, b, h⟩, fun ⟨a, b, h⟩ ↦ ⟨⟨a, b⟩, h⟩⟩
Prod.map_id
theorem
: Prod.map (@id α) (@id β) = id
Prod.map_id'
theorem
: Prod.map (fun a : α => a) (fun b : β => b) = fun x ↦ x
Prod.map_comp_map
theorem
(f : α → β) (f' : γ → δ) (g : β → ε) (g' : δ → ζ) : Prod.map g g' ∘ Prod.map f f' = Prod.map (g ∘ f) (g' ∘ f')
/--
Composing a `Prod.map` with another `Prod.map` is equal to
a single `Prod.map` of composed functions.
-/
theorem map_comp_map (f : α → β) (f' : γ → δ) (g : β → ε) (g' : δ → ζ) :
Prod.mapProd.map g g' ∘ Prod.map f f' = Prod.map (g ∘ f) (g' ∘ f') :=
rfl
Prod.map_map
theorem
(f : α → β) (f' : γ → δ) (g : β → ε) (g' : δ → ζ) (x : α × γ) :
Prod.map g g' (Prod.map f f' x) = Prod.map (g ∘ f) (g' ∘ f') x
Prod.swap
definition
: α × β → β × α
/--
Swaps the elements in a pair.
Examples:
* `(1, 2).swap = (2, 1)`
* `("orange", -87).swap = (-87, "orange")`
-/
def swap : α × β → β × α := fun p => (p.2, p.1)
Prod.swap_swap
theorem
: ∀ x : α × β, swap (swap x) = x
Prod.fst_swap
theorem
{p : α × β} : (swap p).1 = p.2
Prod.snd_swap
theorem
{p : α × β} : (swap p).2 = p.1
Prod.swap_prod_mk
theorem
{a : α} {b : β} : swap (a, b) = (b, a)
@[simp]
theorem swap_prod_mk {a : α} {b : β} : swap (a, b) = (b, a) :=
rfl
Prod.swap_swap_eq
theorem
: swap ∘ swap = @id (α × β)
@[simp]
theorem swap_swap_eq : swapswap ∘ swap = @id (α × β) :=
funext swap_swap
Prod.swap_inj
theorem
{p q : α × β} : swap p = swap q ↔ p = q
@[simp]
theorem swap_inj {p q : α × β} : swapswap p = swap q ↔ p = q := by
cases p; cases q; simp [and_comm]
Prod.map_comp_swap
theorem
(f : α → β) (g : γ → δ) : Prod.map f g ∘ Prod.swap = Prod.swap ∘ Prod.map g f
/--
For two functions `f` and `g`, the composition of `Prod.map f g` with `Prod.swap`
is equal to the composition of `Prod.swap` with `Prod.map g f`.
-/
theorem map_comp_swap (f : α → β) (g : γ → δ) :
Prod.mapProd.map f g ∘ Prod.swap = Prod.swapProd.swap ∘ Prod.map g f := rfl