fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
vandermonde (v : Fin n → R) : Matrix (Fin n) (Fin n) R := .of fun i j ↦ (v i) ^ j.1
def
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
vandermonde
`vandermonde v` is the square matrix with `i`th row equal to `1, v i, v i ^ 2, v i ^ 3, ...`.
vandermonde_eq_projVandermonde (v : Fin n → R) : vandermonde v = projVandermonde v 1 := by simp [projVandermonde, rectVandermonde, vandermonde]
lemma
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
vandermonde_eq_projVandermonde
null
projVandermonde_apply {v w : Fin n → R} {i j : Fin n} : projVandermonde v w i j = (v i) ^ j.1 * (w i) ^ j.rev.1 := rfl
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
projVandermonde_apply
We don't mark this as `@[simp]` because the RHS is not simp-nf, and simplifying the RHS gives a bothersome `Nat` subtraction.
rectVandermonde_apply {α : Type*} {v w : α → R} {i : α} {j : Fin n} : rectVandermonde v w n i j = (v i) ^ j.1 * (w i) ^ j.rev.1 := rfl @[simp]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
rectVandermonde_apply
null
vandermonde_apply (v : Fin n → R) (i j) : vandermonde v i j = v i ^ (j : ℕ) := rfl @[simp]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
vandermonde_apply
null
vandermonde_cons (v0 : R) (v : Fin n → R) : vandermonde (Fin.cons v0 v : Fin n.succ → R) = Fin.cons (fun (j : Fin n.succ) => v0 ^ (j : ℕ)) fun i => Fin.cons 1 fun j => v i * vandermonde v i j := by ext i j refine Fin.cases (by simp) (fun i => ?_) i refine Fin.cases (by simp) (fun j => ?_) j simp [pow_succ']
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
vandermonde_cons
null
vandermonde_succ (v : Fin n.succ → R) : vandermonde v = .of Fin.cons (fun (j : Fin n.succ) => v 0 ^ (j : ℕ)) fun i => Fin.cons 1 fun j => v i.succ * vandermonde (Fin.tail v) i j := by conv_lhs => rw [← Fin.cons_self_tail v, vandermonde_cons] rfl
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
vandermonde_succ
null
vandermonde_mul_vandermonde_transpose (v w : Fin n → R) (i j) : (vandermonde v * (vandermonde w)ᵀ) i j = ∑ k : Fin n, (v i * w j) ^ (k : ℕ) := by simp only [vandermonde_apply, Matrix.mul_apply, Matrix.transpose_apply, mul_pow]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
vandermonde_mul_vandermonde_transpose
null
vandermonde_transpose_mul_vandermonde (v : Fin n → R) (i j) : ((vandermonde v)ᵀ * vandermonde v) i j = ∑ k : Fin n, v k ^ (i + j : ℕ) := by simp only [vandermonde_apply, Matrix.mul_apply, Matrix.transpose_apply, pow_add]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
vandermonde_transpose_mul_vandermonde
null
rectVandermonde_apply_zero_right {α : Type*} {v w : α → R} {i : α} (hw : w i = 0) : rectVandermonde v w (n + 1) i = Pi.single (Fin.last n) ((v i) ^ n) := by ext j obtain rfl | hlt := j.le_last.eq_or_lt · simp [rectVandermonde_apply] rw [rectVandermonde_apply, Pi.single_eq_of_ne hlt.ne, hw, zero_pow, mul_zero] simpa [Nat.sub_eq_zero_iff_le] using hlt
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
rectVandermonde_apply_zero_right
null
projVandermonde_apply_of_ne_zero {v w : Fin (n + 1) → K} {i j : Fin (n + 1)} (hw : w i ≠ 0) : projVandermonde v w i j = (v i) ^ j.1 * (w i) ^ n / (w i) ^ j.1 := by rw [projVandermonde_apply, eq_div_iff (by simp [hw]), mul_assoc, ← pow_add, rev_add_cast]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
projVandermonde_apply_of_ne_zero
null
projVandermonde_apply_zero_right {v w : Fin (n + 1) → R} {i : Fin (n + 1)} (hw : w i = 0) : projVandermonde v w i = Pi.single (Fin.last n) ((v i) ^ n) := by ext j obtain rfl | hlt := j.le_last.eq_or_lt · simp [projVandermonde_apply] rw [projVandermonde_apply, Pi.single_eq_of_ne hlt.ne, hw, zero_pow, mul_zero] simpa [Nat.sub_eq_zero_iff_le] using hlt
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
projVandermonde_apply_zero_right
null
projVandermonde_comp {v w : Fin n → R} (f : Fin n → Fin n) : projVandermonde (v ∘ f) (w ∘ f) = (projVandermonde v w).submatrix f id := rfl
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
projVandermonde_comp
null
projVandermonde_map {R' : Type*} [CommRing R'] (φ : R →+* R') (v w : Fin n → R) : projVandermonde (fun i ↦ φ (v i)) (fun i ↦ φ (w i)) = φ.mapMatrix (projVandermonde v w) := by ext i j simp [projVandermonde_apply]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
projVandermonde_map
null
private det_projVandermonde_of_field (v w : Fin n → K) : (projVandermonde v w).det = ∏ i : Fin n, ∏ j ∈ Finset.Ioi i, (v j * w i - v i * w j) := by induction n with | zero => simp | succ n ih => /- We can assume not all `w i` are zero, and therefore that `w 0 ≠ 0`, since otherwise we can swap row `0` with another nonzero row. -/ wlog h0 : w 0 ≠ 0 generalizing v w with aux · obtain h0' | ⟨i₀, hi₀ : w i₀ ≠ 0⟩ := forall_or_exists_not (w · = 0) · obtain rfl | hne := eq_or_ne n 0 · simp [projVandermonde_apply] rw [det_eq_zero_of_column_eq_zero 0 (fun i ↦ by simpa [projVandermonde_apply, h0']), Finset.prod_sigma', Finset.prod_eq_zero (i := ⟨0, Fin.last n⟩) (by simpa) (by simp [h0'])] rw [← mul_right_inj' (a := ((Equiv.swap 0 i₀).sign : K)) (by simp [show 0 ≠ i₀ by rintro rfl; contradiction]), ← det_permute, ← projVandermonde_comp, aux _ _ (by simpa), ← (Equiv.swap 0 i₀).prod_Ioi_comp_eq_sign_mul_prod (by simp)] rfl /- Let `W` be obtained from the matrix by subtracting `r = (v 0) / (w 0)` times each column from the next column, starting from the penultimate column. This doesn't change the determinant.-/ set r := v 0 / w 0 with hr set W : Matrix (Fin (n + 1)) (Fin (n + 1)) K := .of fun i ↦ (cons (projVandermonde v w i 0) (fun j ↦ projVandermonde v w i j.succ - r * projVandermonde v w i j.castSucc)) have hW_eq : (W.submatrix succ succ) = .of fun i j ↦ (v (succ i) - r * w (succ i)) * projVandermonde (v ∘ succ) (w ∘ succ) i j := by ext i j simp only [projVandermonde_apply, val_zero, rev_zero, val_last, val_succ, coe_castSucc, submatrix_apply, Function.comp_apply, rev_succ, W, r, rev_castSucc] simp ring /- The first row of `W` is `[(w 0)^n, 0, ..., 0]` - take a cofactor expansion along this row, and apply induction. -/ rw [det_eq_of_forall_col_eq_smul_add_pred (B := W) (c := fun _ ↦ r) (by simp [W]) (fun i j ↦ by simp [W, r, projVandermonde_apply]), det_succ_row_zero, Finset.sum_eq_single 0 _ (by simp)] · rw [succAbove_zero, hW_eq, det_mul_column, ih] simp only [Nat.succ_eq_add_one, coe_ofNat_eq_mod, Nat.zero_mod, pow_zero, show W 0 0 = w 0 ^ n by simp [W, projVandermonde_apply], one_mul, hr] field_simp simp only [Finset.prod_div_distrib, Finset.prod_const, Finset.card_fin, Function.comp_apply] field_simp simp only [prod_univ_succ, Ioi_zero_eq_map, Finset.prod_map, coe_succEmb, prod_Ioi_succ] intro j _ hj0 obtain ⟨j, rfl⟩ := j.eq_succ_of_ne_zero hj0 rw [mul_eq_zero, mul_eq_zero] refine .inl (.inr ?_) simp only [of_apply, projVandermonde_apply_of_ne_zero h0, val_succ, coe_castSucc, cons_succ, W, r] ring
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
det_projVandermonde_of_field
null
det_projVandermonde (v w : Fin n → R) : (projVandermonde v w).det = ∏ i : Fin n, ∏ j ∈ Finset.Ioi i, (v j * w i - v i * w j) := by let u (b : Bool) (i : Fin n) := (algebraMap (MvPolynomial (Fin n × Bool) ℤ) (FractionRing (MvPolynomial (Fin n × Bool) ℤ))) (MvPolynomial.X ⟨i, b⟩) have hdet := det_projVandermonde_of_field (u true) (u false) simp only [u] at hdet norm_cast at hdet rw [projVandermonde_map, ← RingHom.map_det, IsFractionRing.coe_inj] at hdet apply_fun MvPolynomial.eval₂Hom (Int.castRingHom R) (fun x ↦ (if x.2 then v else w) x.1) at hdet rw [RingHom.map_det] at hdet convert hdet <;> simp [← Matrix.ext_iff, projVandermonde_apply]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
det_projVandermonde
The formula for the determinant of a projective Vandermonde matrix.
det_vandermonde (v : Fin n → R) : det (vandermonde v) = ∏ i : Fin n, ∏ j ∈ Ioi i, (v j - v i) := by simp [vandermonde_eq_projVandermonde, det_projVandermonde]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
det_vandermonde
The formula for the determinant of a Vandermonde matrix.
det_vandermonde_eq_zero_iff [IsDomain R] {v : Fin n → R} : det (vandermonde v) = 0 ↔ ∃ i j : Fin n, v i = v j ∧ i ≠ j := by constructor · simp only [det_vandermonde v, Finset.prod_eq_zero_iff, sub_eq_zero, forall_exists_index] rintro i ⟨_, j, h₁, h₂⟩ exact ⟨j, i, h₂, (mem_Ioi.mp h₁).ne'⟩ · simp only [Ne, forall_exists_index, and_imp] refine fun i j h₁ h₂ => Matrix.det_zero_of_row_eq h₂ (funext fun k => ?_) rw [vandermonde_apply, vandermonde_apply, h₁]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
det_vandermonde_eq_zero_iff
null
det_vandermonde_ne_zero_iff [IsDomain R] {v : Fin n → R} : det (vandermonde v) ≠ 0 ↔ Function.Injective v := by unfold Function.Injective simp only [det_vandermonde_eq_zero_iff, Ne, not_exists, not_and, Classical.not_not] @[simp]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
det_vandermonde_ne_zero_iff
null
det_vandermonde_add (v : Fin n → R) (a : R) : (Matrix.vandermonde fun i ↦ v i + a).det = (Matrix.vandermonde v).det := by simp [Matrix.det_vandermonde] @[simp]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
det_vandermonde_add
null
det_vandermonde_sub (v : Fin n → R) (a : R) : (Matrix.vandermonde fun i ↦ v i - a).det = (Matrix.vandermonde v).det := by rw [← det_vandermonde_add v (- a)] simp only [← sub_eq_add_neg]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
det_vandermonde_sub
null
eq_zero_of_forall_index_sum_pow_mul_eq_zero [IsDomain R] {f v : Fin n → R} (hf : Function.Injective f) (hfv : ∀ j, (∑ i : Fin n, f j ^ (i : ℕ) * v i) = 0) : v = 0 := eq_zero_of_mulVec_eq_zero (det_vandermonde_ne_zero_iff.mpr hf) (funext hfv)
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
eq_zero_of_forall_index_sum_pow_mul_eq_zero
null
eq_zero_of_forall_index_sum_mul_pow_eq_zero [IsDomain R] {f v : Fin n → R} (hf : Function.Injective f) (hfv : ∀ j, (∑ i, v i * f j ^ (i : ℕ)) = 0) : v = 0 := by apply eq_zero_of_forall_index_sum_pow_mul_eq_zero hf simp_rw [mul_comm] exact hfv
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
eq_zero_of_forall_index_sum_mul_pow_eq_zero
null
eq_zero_of_forall_pow_sum_mul_pow_eq_zero [IsDomain R] {f v : Fin n → R} (hf : Function.Injective f) (hfv : ∀ i : Fin n, (∑ j : Fin n, v j * f j ^ (i : ℕ)) = 0) : v = 0 := eq_zero_of_vecMul_eq_zero (det_vandermonde_ne_zero_iff.mpr hf) (funext hfv) open Polynomial
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
eq_zero_of_forall_pow_sum_mul_pow_eq_zero
null
eval_matrixOfPolynomials_eq_vandermonde_mul_matrixOfPolynomials (v : Fin n → R) (p : Fin n → R[X]) (h_deg : ∀ i, (p i).natDegree ≤ i) : Matrix.of (fun i j => ((p j).eval (v i))) = (Matrix.vandermonde v) * (Matrix.of (fun (i j : Fin n) => (p j).coeff i)) := by ext i j simp_rw [Matrix.mul_apply, eval, Matrix.of_apply, eval₂] simp only [Matrix.vandermonde] have : (p j).support ⊆ range n := supp_subset_range <| Nat.lt_of_le_of_lt (h_deg j) <| Fin.prop j rw [sum_eq_of_subset _ (fun j => zero_mul ((v i) ^ j)) this, ← Fin.sum_univ_eq_sum_range] congr ext k rw [mul_comm, Matrix.of_apply, RingHom.id_apply]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
eval_matrixOfPolynomials_eq_vandermonde_mul_matrixOfPolynomials
null
det_eval_matrixOfPolynomials_eq_det_vandermonde (v : Fin n → R) (p : Fin n → R[X]) (h_deg : ∀ i, (p i).natDegree = i) (h_monic : ∀ i, Monic <| p i) : (Matrix.vandermonde v).det = (Matrix.of (fun i j => ((p j).eval (v i)))).det := by rw [Matrix.eval_matrixOfPolynomials_eq_vandermonde_mul_matrixOfPolynomials v p (fun i ↦ Nat.le_of_eq (h_deg i)), Matrix.det_mul, Matrix.det_matrixOfPolynomials p h_deg h_monic, mul_one]
theorem
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
det_eval_matrixOfPolynomials_eq_det_vandermonde
null
det_vandermonde_id_eq_superFactorial (n : ℕ) : (vandermonde fun i : Fin (n + 1) ↦ (i : R)).det = n.superFactorial := by induction n with | zero => simp | succ n hn => rw [Nat.superFactorial, det_vandermonde, Fin.prod_univ_succAbove _ 0] push_cast congr · simp only [Fin.val_zero, Nat.cast_zero, sub_zero] norm_cast simp [Fin.prod_univ_eq_prod_range (fun i ↦ (↑i + 1)) (n + 1)] · rw [det_vandermonde] at hn simp [hn]
lemma
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
det_vandermonde_id_eq_superFactorial
null
private of_eval_descPochhammer_eq_mul_of_choose {n : ℕ} (v : Fin n → ℕ) : (of fun i j : Fin n => (descPochhammer ℤ j).eval (v i : ℤ)).det = (∏ i : Fin n, Nat.factorial i) * (of fun i j : Fin n => (Nat.choose (v i) j : ℤ)).det := by convert det_mul_row (fun (i : Fin n) => ((Nat.factorial (i : ℕ)) : ℤ)) _ · rw [of_apply, descPochhammer_eval_eq_descFactorial ℤ _ _] congr exact Nat.descFactorial_eq_factorial_mul_choose _ _ · rw [Nat.cast_prod]
lemma
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
of_eval_descPochhammer_eq_mul_of_choose
null
superFactorial_dvd_vandermonde_det {n : ℕ} (v : Fin (n + 1) → ℤ) : ↑n.superFactorial ∣ (vandermonde v).det := by let m := inf' univ ⟨0, mem_univ _⟩ v let w' := fun i ↦ (v i - m).toNat have hw' : ∀ i, (w' i : ℤ) = v i - m := fun i ↦ Int.toNat_sub_of_le (inf'_le _ (mem_univ _)) have h := det_eval_matrixOfPolynomials_eq_det_vandermonde (fun i ↦ ↑(w' i)) (fun i => descPochhammer ℤ i) (fun i => descPochhammer_natDegree ℤ i) (fun i => monic_descPochhammer ℤ i) conv_lhs at h => simp only [hw', det_vandermonde_sub] use (of (fun (i j : Fin (n + 1)) => (Nat.choose (w' i) (j : ℕ) : ℤ))).det simp [h, of_eval_descPochhammer_eq_mul_of_choose w', Fin.prod_univ_eq_prod_range]
lemma
LinearAlgebra
[ "Mathlib.Data.Nat.Factorial.SuperFactorial", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.LinearAlgebra.Matrix.Nondegenerate", "Mathlib.RingTheory.Localization.FractionRing", "Mathlib.RingTheory.Polynomial.Pochhammer" ]
Mathlib/LinearAlgebra/Vandermonde.lean
superFactorial_dvd_vandermonde_det
null
hidden {α : Sort*} {a : α} := a variable {α : Sort*}
abbrev
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
hidden
An identity function with its main argument implicit. This will be printed as `hidden` even if it is applied to a large term, so it can be used for elision, as done in the `elide` and `unelide` tactics.
congr_heq {α β γ : Sort _} {f : α → γ} {g : β → γ} {x : α} {y : β} (h₁ : f ≍ g) (h₂ : x ≍ y) : f x = g y := by cases h₂; cases h₁; rfl
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
congr_heq
null
congr_arg_heq {β : α → Sort*} (f : ∀ a, β a) : ∀ {a₁ a₂ : α}, a₁ = a₂ → f a₁ ≍ f a₂ | _, _, rfl => HEq.rfl
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
congr_arg_heq
null
dcongr_heq.{u, v} {α₁ α₂ : Sort u} {β₁ : α₁ → Sort v} {β₂ : α₂ → Sort v} {f₁ : ∀ a, β₁ a} {f₂ : ∀ a, β₂ a} {a₁ : α₁} {a₂ : α₂} (hargs : a₁ ≍ a₂) (ht : ∀ t₁ t₂, t₁ ≍ t₂ → β₁ t₁ = β₂ t₂) (hf : α₁ = α₂ → β₁ ≍ β₂ → f₁ ≍ f₂) : f₁ a₁ ≍ f₂ a₂ := by cases hargs cases funext fun v => ht v v .rfl cases hf rfl .rfl rfl @[simp] theorem eq_iff_eq_cancel_left {b c : α} : (∀ {a}, a = b ↔ a = c) ↔ b = c := ⟨fun h ↦ by rw [← h], fun h a ↦ by rw [h]⟩ @[simp] theorem eq_iff_eq_cancel_right {a b : α} : (∀ {c}, a = c ↔ b = c) ↔ a = b := ⟨fun h ↦ by rw [h], fun h a ↦ by rw [h]⟩
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
dcongr_heq.
null
ne_and_eq_iff_right {a b c : α} (h : b ≠ c) : a ≠ b ∧ a = c ↔ a = c := and_iff_right_of_imp (fun h2 => h2.symm ▸ h.symm)
lemma
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
ne_and_eq_iff_right
null
Fact (p : Prop) : Prop where /-- `Fact.out` contains the unwrapped witness for the fact represented by the instance of `Fact p`. -/ out : p library_note "fact non-instances"/-- In most cases, we should not have global instances of `Fact`; typeclass search is not an advanced proof search engine, and adding any such instance has the potential to cause slowdowns everywhere. We instead declare them as lemmata and make them local instances as required. -/
class
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Fact
Wrapper for adding elementary propositions to the type class systems. Warning: this can easily be abused. See the rest of this docstring for details. Certain propositions should not be treated as a class globally, but sometimes it is very convenient to be able to use the type class system in specific circumstances. For example, `ZMod p` is a field if and only if `p` is a prime number. In order to be able to find this field instance automatically by type class search, we have to turn `p.prime` into an instance implicit assumption. On the other hand, making `Nat.prime` a class would require a major refactoring of the library, and it is questionable whether making `Nat.prime` a class is desirable at all. The compromise is to add the assumption `[Fact p.prime]` to `ZMod.field`. In particular, this class is not intended for turning the type class system into an automated theorem prover for first-order logic.
Fact.elim {p : Prop} (h : Fact p) : p := h.1
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Fact.elim
null
fact_iff {p : Prop} : Fact p ↔ p := ⟨fun h ↦ h.1, fun h ↦ ⟨h⟩⟩
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
fact_iff
null
Function.swap₂ {ι₁ ι₂ : Sort*} {κ₁ : ι₁ → Sort*} {κ₂ : ι₂ → Sort*} {φ : ∀ i₁, κ₁ i₁ → ∀ i₂, κ₂ i₂ → Sort*} (f : ∀ i₁ j₁ i₂ j₂, φ i₁ j₁ i₂ j₂) (i₂ j₂ i₁ j₁) : φ i₁ j₁ i₂ j₂ := f i₁ j₁ i₂ j₂
abbrev
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Function.swap₂
Swaps two pairs of arguments to a function.
imp_iff_right_iff {a b : Prop} : (a → b ↔ b) ↔ a ∨ b := open scoped Classical in Decidable.imp_iff_right_iff
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
imp_iff_right_iff
null
and_or_imp {a b c : Prop} : a ∧ b ∨ (a → c) ↔ a → b ∨ c := open scoped Classical in Decidable.and_or_imp
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
and_or_imp
null
protected Function.mt {a b : Prop} : (a → b) → ¬b → ¬a := mt /-! ### Declarations about `not` -/ alias dec_em := Decidable.em
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Function.mt
Provide modus tollens (`mt`) as dot notation for implications.
dec_em' (p : Prop) [Decidable p] : ¬p ∨ p := (dec_em p).symm alias em := Classical.em
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
dec_em'
null
em' (p : Prop) : ¬p ∨ p := (em p).symm
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
em'
null
or_not {p : Prop} : p ∨ ¬p := em _
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
or_not
null
Decidable.eq_or_ne {α : Sort*} (x y : α) [Decidable (x = y)] : x = y ∨ x ≠ y := dec_em <| x = y
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Decidable.eq_or_ne
null
Decidable.ne_or_eq {α : Sort*} (x y : α) [Decidable (x = y)] : x ≠ y ∨ x = y := dec_em' <| x = y
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Decidable.ne_or_eq
null
eq_or_ne {α : Sort*} (x y : α) : x = y ∨ x ≠ y := em <| x = y
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
eq_or_ne
null
ne_or_eq {α : Sort*} (x y : α) : x ≠ y ∨ x = y := em' <| x = y
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
ne_or_eq
null
by_contradiction {p : Prop} : (¬p → False) → p := open scoped Classical in Decidable.byContradiction
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
by_contradiction
null
by_cases {p q : Prop} (hpq : p → q) (hnpq : ¬p → q) : q := open scoped Classical in if hp : p then hpq hp else hnpq hp alias by_contra := by_contradiction library_note "decidable namespace"/-- In most of mathlib, we use the law of excluded middle (LEM) and the axiom of choice (AC) freely. The `Decidable` namespace contains versions of lemmas from the root namespace that explicitly attempt to avoid the axiom of choice, usually by adding decidability assumptions on the inputs. You can check if a lemma uses the axiom of choice by using `#print axioms foo` and seeing if `Classical.choice` appears in the list. -/ library_note "decidable arguments"/-- As mathlib is primarily classical, if the type signature of a `def` or `lemma` does not require any `Decidable` instances to state, it is preferable not to introduce any `Decidable` instances that are needed in the proof as arguments, but rather to use the `classical` tactic as needed. In the other direction, when `Decidable` instances do appear in the type signature, it is better to use explicitly introduced ones rather than allowing Lean to automatically infer classical ones, as these may cause instance mismatch errors later. -/ export Classical (not_not) attribute [simp] not_not variable {a b : Prop}
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
by_cases
null
of_not_not {a : Prop} : ¬¬a → a := by_contra
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
of_not_not
null
not_ne_iff {α : Sort*} {a b : α} : ¬a ≠ b ↔ a = b := not_not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
not_ne_iff
null
of_not_imp : ¬(a → b) → a := open scoped Classical in Decidable.of_not_imp alias Not.decidable_imp_symm := Decidable.not_imp_symm
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
of_not_imp
null
Not.imp_symm : (¬a → b) → ¬b → a := open scoped Classical in Not.decidable_imp_symm
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Not.imp_symm
null
not_imp_comm : ¬a → b ↔ ¬b → a := open scoped Classical in Decidable.not_imp_comm @[simp] theorem not_imp_self : ¬a → a ↔ a := open scoped Classical in Decidable.not_imp_self
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
not_imp_comm
null
Imp.swap {a b : Sort*} {c : Prop} : a → b → c ↔ b → a → c := ⟨fun h x y ↦ h y x, fun h x y ↦ h y x⟩ alias Iff.not := not_congr
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Imp.swap
null
Iff.not_left (h : a ↔ ¬b) : ¬a ↔ b := h.not.trans not_not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Iff.not_left
null
Iff.not_right (h : ¬a ↔ b) : a ↔ ¬b := not_not.symm.trans h.not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Iff.not_right
null
protected Iff.ne {α β : Sort*} {a b : α} {c d : β} : (a = b ↔ c = d) → (a ≠ b ↔ c ≠ d) := Iff.not
lemma
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Iff.ne
null
Iff.ne_left {α β : Sort*} {a b : α} {c d : β} : (a = b ↔ c ≠ d) → (a ≠ b ↔ c = d) := Iff.not_left
lemma
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Iff.ne_left
null
Iff.ne_right {α β : Sort*} {a b : α} {c d : β} : (a ≠ b ↔ c = d) → (a = b ↔ c ≠ d) := Iff.not_right /-! ### Declarations about `Xor'` -/
lemma
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Iff.ne_right
null
Xor' (a b : Prop) := (a ∧ ¬b) ∨ (b ∧ ¬a) @[grind =] theorem xor_def {a b : Prop} : Xor' a b ↔ (a ∧ ¬b) ∨ (b ∧ ¬a) := Iff.rfl
def
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Xor'
2025-07-31. Upstream `Xor` has been renamed to `XorOp`. 2025-09-16. The deprecation for `Xor` has been removed. Anytime after v4.25.0-rc1 lands we rename this back to `Xor`. -/ /-- `Xor' a b` is the exclusive-or of propositions.
@[simp] xor_true : Xor' True = Not := by grind @[simp] theorem xor_false : Xor' False = id := by grind
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
xor_true
null
xor_comm (a b : Prop) : Xor' a b = Xor' b a := by grind
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
xor_comm
null
@[simp] xor_self (a : Prop) : Xor' a a = False := by grind @[simp] theorem xor_not_left : Xor' (¬a) b ↔ (a ↔ b) := by grind @[simp] theorem xor_not_right : Xor' a (¬b) ↔ (a ↔ b) := by grind
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
xor_self
null
xor_not_not : Xor' (¬a) (¬b) ↔ Xor' a b := by grind
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
xor_not_not
null
protected Xor'.or (h : Xor' a b) : a ∨ b := by grind /-! ### Declarations about `and` -/ alias Iff.and := and_congr alias ⟨And.rotate, _⟩ := and_rotate
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Xor'.or
null
and_symm_right {α : Sort*} (a b : α) (p : Prop) : p ∧ a = b ↔ p ∧ b = a := by simp [eq_comm]
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
and_symm_right
null
and_symm_left {α : Sort*} (a b : α) (p : Prop) : a = b ∧ p ↔ b = a ∧ p := by simp [eq_comm] /-! ### Declarations about `or` -/ alias Iff.or := or_congr alias ⟨Or.rotate, _⟩ := or_rotate
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
and_symm_left
null
Or.elim3 {c d : Prop} (h : a ∨ b ∨ c) (ha : a → d) (hb : b → d) (hc : c → d) : d := Or.elim h ha fun h₂ ↦ Or.elim h₂ hb hc
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Or.elim3
null
Or.imp3 {d e c f : Prop} (had : a → d) (hbe : b → e) (hcf : c → f) : a ∨ b ∨ c → d ∨ e ∨ f := Or.imp had <| Or.imp hbe hcf export Classical (or_iff_not_imp_left or_iff_not_imp_right)
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Or.imp3
null
not_or_of_imp : (a → b) → ¬a ∨ b := open scoped Classical in Decidable.not_or_of_imp
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
not_or_of_imp
null
protected Decidable.or_not_of_imp [Decidable a] (h : a → b) : b ∨ ¬a := dite _ (Or.inl ∘ h) Or.inr
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Decidable.or_not_of_imp
null
or_not_of_imp : (a → b) → b ∨ ¬a := open scoped Classical in Decidable.or_not_of_imp
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
or_not_of_imp
null
imp_iff_not_or : a → b ↔ ¬a ∨ b := open scoped Classical in Decidable.imp_iff_not_or
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
imp_iff_not_or
null
imp_iff_or_not {b a : Prop} : b → a ↔ a ∨ ¬b := open scoped Classical in Decidable.imp_iff_or_not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
imp_iff_or_not
null
not_imp_not : ¬a → ¬b ↔ b → a := open scoped Classical in Decidable.not_imp_not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
not_imp_not
null
imp_and_neg_imp_iff (p q : Prop) : (p → q) ∧ (¬p → q) ↔ q := by simp
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
imp_and_neg_imp_iff
null
protected Function.mtr : (¬a → ¬b) → b → a := not_imp_not.mp
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
Function.mtr
Provide the reverse of modus tollens (`mt`) as dot notation for implications.
or_congr_left' {c a b : Prop} (h : ¬c → (a ↔ b)) : a ∨ c ↔ b ∨ c := open scoped Classical in Decidable.or_congr_left' h
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
or_congr_left'
null
or_congr_right' {c : Prop} (h : ¬a → (b ↔ c)) : a ∨ b ↔ a ∨ c := open scoped Classical in Decidable.or_congr_right' h /-! ### Declarations about distributivity -/ /-! Declarations about `iff` -/ alias Iff.iff := iff_congr
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
or_congr_right'
null
iff_mpr_iff_true_intro {P : Prop} (h : P) : Iff.mpr (iff_true_intro h) True.intro = h := rfl
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
iff_mpr_iff_true_intro
null
imp_or {a b c : Prop} : a → b ∨ c ↔ (a → b) ∨ (a → c) := open scoped Classical in Decidable.imp_or
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
imp_or
null
imp_or' {a : Sort*} {b c : Prop} : a → b ∨ c ↔ (a → b) ∨ (a → c) := open scoped Classical in Decidable.imp_or'
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
imp_or'
null
not_imp : ¬(a → b) ↔ a ∧ ¬b := open scoped Classical in Decidable.not_imp_iff_and_not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
not_imp
null
peirce (a b : Prop) : ((a → b) → a) → a := open scoped Classical in Decidable.peirce _ _
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
peirce
null
not_iff_not : (¬a ↔ ¬b) ↔ (a ↔ b) := open scoped Classical in Decidable.not_iff_not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
not_iff_not
null
not_iff_comm : (¬a ↔ b) ↔ (¬b ↔ a) := open scoped Classical in Decidable.not_iff_comm
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
not_iff_comm
null
not_iff : ¬(a ↔ b) ↔ (¬a ↔ b) := open scoped Classical in Decidable.not_iff
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
not_iff
null
iff_not_comm : (a ↔ ¬b) ↔ (b ↔ ¬a) := open scoped Classical in Decidable.iff_not_comm
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
iff_not_comm
null
iff_iff_and_or_not_and_not : (a ↔ b) ↔ a ∧ b ∨ ¬a ∧ ¬b := open scoped Classical in Decidable.iff_iff_and_or_not_and_not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
iff_iff_and_or_not_and_not
null
iff_iff_not_or_and_or_not : (a ↔ b) ↔ (¬a ∨ b) ∧ (a ∨ ¬b) := open scoped Classical in Decidable.iff_iff_not_or_and_or_not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
iff_iff_not_or_and_or_not
null
not_and_not_right : ¬(a ∧ ¬b) ↔ a → b := open scoped Classical in Decidable.not_and_not_right /-! ### De Morgan's laws -/
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
not_and_not_right
null
not_and_or : ¬(a ∧ b) ↔ ¬a ∨ ¬b := open scoped Classical in Decidable.not_and_iff_not_or_not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
not_and_or
One of **de Morgan's laws**: the negation of a conjunction is logically equivalent to the disjunction of the negations.
or_iff_not_and_not : a ∨ b ↔ ¬(¬a ∧ ¬b) := open scoped Classical in Decidable.or_iff_not_not_and_not
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
or_iff_not_and_not
null
and_iff_not_or_not : a ∧ b ↔ ¬(¬a ∨ ¬b) := open scoped Classical in Decidable.and_iff_not_not_or_not @[simp] theorem not_xor (P Q : Prop) : ¬Xor' P Q ↔ (P ↔ Q) := by simp only [not_and, Xor', not_or, not_not, ← iff_iff_implies_and_implies]
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
and_iff_not_or_not
null
xor_iff_not_iff (P Q : Prop) : Xor' P Q ↔ ¬(P ↔ Q) := (not_xor P Q).not_right
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
xor_iff_not_iff
null
xor_iff_iff_not : Xor' a b ↔ (a ↔ ¬b) := by simp only [← @xor_not_right a, not_not]
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
xor_iff_iff_not
null
xor_iff_not_iff' : Xor' a b ↔ (¬a ↔ b) := by simp only [← @xor_not_left _ b, not_not]
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
xor_iff_not_iff'
null
xor_iff_or_and_not_and (a b : Prop) : Xor' a b ↔ (a ∨ b) ∧ (¬(a ∧ b)) := by rw [Xor', or_and_right, not_and_or, and_or_left, and_not_self_iff, false_or, and_or_left, and_not_self_iff, or_false]
theorem
Logic
[ "Mathlib.Tactic.Attr.Register", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Basic", "Batteries.Logic", "Batteries.Tactic.Trans", "Batteries.Util.LibraryNote", "Mathlib.Data.Nat.Notation", "Mathlib.Data.Int.Notation" ]
Mathlib/Logic/Basic.lean
xor_iff_or_and_not_and
null