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
typevecCasesCons₃ (n : ℕ) {β : ∀ v v' : TypeVec (n + 1), v ⟹ v' → Sort*} (F : ∀ (t t') (f : t → t') (v v' : TypeVec n) (fs : v ⟹ v'), β (v ::: t) (v' ::: t') (fs ::: f)) : ∀ v v' fs, β v v' fs := by intro v v' rw [← append1_drop_last v, ← append1_drop_last v'] intro fs rw [← split_dropFun_lastFun fs] apply F
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
typevecCasesCons₃
cases distinction for an arrow in the category of (n+1)-length type vectors
typevecCasesNil₂ {β : Fin2.elim0 ⟹ Fin2.elim0 → Sort*} (f : β nilFun) : ∀ f, β f := by intro g suffices g = nilFun by rwa [this] ext ⟨⟩
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
typevecCasesNil₂
specialized cases distinction for an arrow in the category of 0-length type vectors
typevecCasesCons₂ (n : ℕ) (t t' : Type*) (v v' : TypeVec n) {β : (v ::: t) ⟹ (v' ::: t') → Sort*} (F : ∀ (f : t → t') (fs : v ⟹ v'), β (fs ::: f)) : ∀ fs, β fs := by intro fs rw [← split_dropFun_lastFun fs] apply F
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
typevecCasesCons₂
specialized cases distinction for an arrow in the category of (n+1)-length type vectors
typevecCasesNil₂_appendFun {β : Fin2.elim0 ⟹ Fin2.elim0 → Sort*} (f : β nilFun) : typevecCasesNil₂ f nilFun = f := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
typevecCasesNil₂_appendFun
null
typevecCasesCons₂_appendFun (n : ℕ) (t t' : Type*) (v v' : TypeVec n) {β : (v ::: t) ⟹ (v' ::: t') → Sort*} (F : ∀ (f : t → t') (fs : v ⟹ v'), β (fs ::: f)) (f fs) : typevecCasesCons₂ n t t' v v' F (fs ::: f) = F f fs := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
typevecCasesCons₂_appendFun
null
PredLast (α : TypeVec n) {β : Type*} (p : β → Prop) : ∀ ⦃i⦄, (α.append1 β) i → Prop | Fin2.fs _ => fun _ => True | Fin2.fz => p
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
PredLast
`PredLast α p x` predicates `p` of the last element of `x : α.append1 β`.
RelLast (α : TypeVec n) {β γ : Type u} (r : β → γ → Prop) : ∀ ⦃i⦄, (α.append1 β) i → (α.append1 γ) i → Prop | Fin2.fs _ => Eq | Fin2.fz => r
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
RelLast
`RelLast α r x y` says that `p` the last elements of `x y : α.append1 β` are related by `r` and all the other elements are equal.
prod : ∀ {n}, TypeVec.{u} n → TypeVec.{u} n → TypeVec n | 0, _, _ => Fin2.elim0 | n + 1, α, β => (@prod n (drop α) (drop β)) ::: (last α × last β) @[inherit_doc] scoped[MvFunctor] infixl:45 " ⊗ " => TypeVec.prod
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
prod
`repeat n t` is a `n-length` type vector that contains `n` occurrences of `t` -/ def «repeat» : ∀ (n : ℕ), Sort _ → TypeVec n | 0, _ => Fin2.elim0 | Nat.succ i, t => append1 («repeat» i t) t /-- `prod α β` is the pointwise product of the components of `α` and `β`
protected const {β} (x : β) : ∀ {n} (α : TypeVec n), α ⟹ «repeat» _ β | succ _, α, Fin2.fs _ => TypeVec.const x (drop α) _ | succ _, _, Fin2.fz => fun _ => x open Function (uncurry)
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
const
`const x α` is an arrow that ignores its source and constructs a `TypeVec` that contains nothing but `x`
repeatEq : ∀ {n} (α : TypeVec n), (α ⊗ α) ⟹ «repeat» _ Prop | 0, _ => nilFun | succ _, α => repeatEq (drop α) ::: uncurry Eq
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
repeatEq
vector of equality on a product of vectors
const_append1 {β γ} (x : γ) {n} (α : TypeVec n) : TypeVec.const x (α ::: β) = appendFun (TypeVec.const x α) fun _ => x := by ext i : 1; cases i <;> rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
const_append1
null
eq_nilFun {α β : TypeVec 0} (f : α ⟹ β) : f = nilFun := by ext x; cases x
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
eq_nilFun
null
id_eq_nilFun {α : TypeVec 0} : @id _ α = nilFun := by ext x; cases x
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
id_eq_nilFun
null
const_nil {β} (x : β) (α : TypeVec 0) : TypeVec.const x α = nilFun := by ext i : 1; cases i @[typevec]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
const_nil
null
repeat_eq_append1 {β} {n} (α : TypeVec n) : repeatEq (α ::: β) = splitFun (α := (α ⊗ α) ::: _) (α' := («repeat» n Prop) ::: _) (repeatEq α) (uncurry Eq) := by induction n <;> rfl @[typevec]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
repeat_eq_append1
null
repeat_eq_nil (α : TypeVec 0) : repeatEq α = nilFun := by ext i; cases i
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
repeat_eq_nil
null
PredLast' (α : TypeVec n) {β : Type*} (p : β → Prop) : (α ::: β) ⟹ «repeat» (n + 1) Prop := splitFun (TypeVec.const True α) p
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
PredLast'
predicate on a type vector to constrain only the last object
RelLast' (α : TypeVec n) {β : Type*} (p : β → β → Prop) : (α ::: β) ⊗ (α ::: β) ⟹ «repeat» (n + 1) Prop := splitFun (repeatEq α) (uncurry p)
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
RelLast'
predicate on the product of two type vectors to constrain only their last object
Curry (F : TypeVec.{u} (n + 1) → Type*) (α : Type u) (β : TypeVec.{u} n) : Type _ := F (β ::: α)
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
Curry
given `F : TypeVec.{u} (n+1) → Type u`, `curry F : Type u → TypeVec.{u} → Type u`, i.e. its first argument can be fed in separately from the rest of the vector of arguments
Curry.inhabited (F : TypeVec.{u} (n + 1) → Type*) (α : Type u) (β : TypeVec.{u} n) [I : Inhabited (F <| (β ::: α))] : Inhabited (Curry F α β) := I
instance
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
Curry.inhabited
null
dropRepeat (α : Type*) : ∀ {n}, drop («repeat» (succ n) α) ⟹ «repeat» n α | succ _, Fin2.fs i => dropRepeat α i | succ _, Fin2.fz => fun (a : α) => a
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropRepeat
arrow to remove one element of a `repeat` vector
ofRepeat {α : Sort _} : ∀ {n i}, «repeat» n α i → α | _, Fin2.fz => fun (a : α) => a | _, Fin2.fs i => @ofRepeat _ _ i
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
ofRepeat
projection for a repeat vector
const_iff_true {α : TypeVec n} {i x p} : ofRepeat (TypeVec.const p α i x) ↔ p := by induction i with | fz => rfl | fs _ ih => rw [TypeVec.const] exact ih
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
const_iff_true
null
prod.fst : ∀ {n} {α β : TypeVec.{u} n}, α ⊗ β ⟹ α | succ _, α, β, Fin2.fs i => @prod.fst _ (drop α) (drop β) i | succ _, _, _, Fin2.fz => Prod.fst
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
prod.fst
left projection of a `prod` vector
prod.snd : ∀ {n} {α β : TypeVec.{u} n}, α ⊗ β ⟹ β | succ _, α, β, Fin2.fs i => @prod.snd _ (drop α) (drop β) i | succ _, _, _, Fin2.fz => Prod.snd
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
prod.snd
right projection of a `prod` vector
prod.diag : ∀ {n} {α : TypeVec.{u} n}, α ⟹ α ⊗ α | succ _, α, Fin2.fs _, x => @prod.diag _ (drop α) _ x | succ _, _, Fin2.fz, x => (x, x)
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
prod.diag
introduce a product where both components are the same
prod.mk : ∀ {n} {α β : TypeVec.{u} n} (i : Fin2 n), α i → β i → (α ⊗ β) i | succ _, α, β, Fin2.fs i => mk (α := fun i => α i.fs) (β := fun i => β i.fs) i | succ _, _, _, Fin2.fz => Prod.mk
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
prod.mk
constructor for `prod`
@[simp] prod_fst_mk {α β : TypeVec n} (i : Fin2 n) (a : α i) (b : β i) : TypeVec.prod.fst i (prod.mk i a b) = a := by induction i with | fz => simp_all only [prod.fst, prod.mk] | fs _ i_ih => apply i_ih @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
prod_fst_mk
null
prod_snd_mk {α β : TypeVec n} (i : Fin2 n) (a : α i) (b : β i) : TypeVec.prod.snd i (prod.mk i a b) = b := by induction i with | fz => simp_all [prod.snd, prod.mk] | fs _ i_ih => apply i_ih
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
prod_snd_mk
null
protected prod.map : ∀ {n} {α α' β β' : TypeVec.{u} n}, α ⟹ β → α' ⟹ β' → α ⊗ α' ⟹ β ⊗ β' | succ _, α, α', β, β', x, y, Fin2.fs _, a => @prod.map _ (drop α) (drop α') (drop β) (drop β') (dropFun x) (dropFun y) _ a | succ _, _, _, _, _, x, y, Fin2.fz, a => (x _ a.1, y _ a.2) @[inherit_doc] scoped[MvFunctor] infixl:45 " ⊗' " => TypeVec.prod.map
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
prod.map
`prod` is functorial
fst_prod_mk {α α' β β' : TypeVec n} (f : α ⟹ β) (g : α' ⟹ β') : TypeVec.prod.fst ⊚ (f ⊗' g) = f ⊚ TypeVec.prod.fst := by funext i; induction i with | fz => rfl | fs _ i_ih => apply i_ih
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
fst_prod_mk
null
snd_prod_mk {α α' β β' : TypeVec n} (f : α ⟹ β) (g : α' ⟹ β') : TypeVec.prod.snd ⊚ (f ⊗' g) = g ⊚ TypeVec.prod.snd := by funext i; induction i with | fz => rfl | fs _ i_ih => apply i_ih
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
snd_prod_mk
null
fst_diag {α : TypeVec n} : TypeVec.prod.fst ⊚ (prod.diag : α ⟹ _) = id := by funext i; induction i with | fz => rfl | fs _ i_ih => apply i_ih
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
fst_diag
null
snd_diag {α : TypeVec n} : TypeVec.prod.snd ⊚ (prod.diag : α ⟹ _) = id := by funext i; induction i with | fz => rfl | fs _ i_ih => apply i_ih
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
snd_diag
null
repeatEq_iff_eq {α : TypeVec n} {i x y} : ofRepeat (repeatEq α i (prod.mk _ x y)) ↔ x = y := by induction i with | fz => rfl | fs _ i_ih => rw [repeatEq] exact i_ih
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
repeatEq_iff_eq
null
Subtype_ : ∀ {n} {α : TypeVec.{u} n}, (α ⟹ «repeat» n Prop) → TypeVec n | _, _, p, Fin2.fz => Subtype fun x => p Fin2.fz x | _, _, p, Fin2.fs i => Subtype_ (dropFun p) i
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
Subtype_
given a predicate vector `p` over vector `α`, `Subtype_ p` is the type of vectors that contain an `α` that satisfies `p`
subtypeVal : ∀ {n} {α : TypeVec.{u} n} (p : α ⟹ «repeat» n Prop), Subtype_ p ⟹ α | succ n, _, _, Fin2.fs i => @subtypeVal n _ _ i | succ _, _, _, Fin2.fz => Subtype.val
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
subtypeVal
projection on `Subtype_`
toSubtype : ∀ {n} {α : TypeVec.{u} n} (p : α ⟹ «repeat» n Prop), (fun i : Fin2 n => { x // ofRepeat <| p i x }) ⟹ Subtype_ p | succ _, _, p, Fin2.fs i, x => toSubtype (dropFun p) i x | succ _, _, _, Fin2.fz, x => x
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
toSubtype
arrow that rearranges the type of `Subtype_` to turn a subtype of vector into a vector of subtypes
ofSubtype {n} {α : TypeVec.{u} n} (p : α ⟹ «repeat» n Prop) : Subtype_ p ⟹ fun i : Fin2 n => { x // ofRepeat <| p i x } | Fin2.fs i, x => ofSubtype _ i x | Fin2.fz, x => x
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
ofSubtype
arrow that rearranges the type of `Subtype_` to turn a vector of subtypes into a subtype of vector
toSubtype' {n} {α : TypeVec.{u} n} (p : α ⊗ α ⟹ «repeat» n Prop) : (fun i : Fin2 n => { x : α i × α i // ofRepeat <| p i (prod.mk _ x.1 x.2) }) ⟹ Subtype_ p | Fin2.fs i, x => toSubtype' (dropFun p) i x | Fin2.fz, x => ⟨x.val, cast (by congr) x.property⟩
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
toSubtype'
similar to `toSubtype` adapted to relations (i.e. predicate on product)
ofSubtype' {n} {α : TypeVec.{u} n} (p : α ⊗ α ⟹ «repeat» n Prop) : Subtype_ p ⟹ fun i : Fin2 n => { x : α i × α i // ofRepeat <| p i (prod.mk _ x.1 x.2) } | Fin2.fs i, x => ofSubtype' _ i x | Fin2.fz, x => ⟨x.val, cast (by congr) x.property⟩
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
ofSubtype'
similar to `of_subtype` adapted to relations (i.e. predicate on product)
diagSub {n} {α : TypeVec.{u} n} : α ⟹ Subtype_ (repeatEq α) | Fin2.fs _, x => @diagSub _ (drop α) _ x | Fin2.fz, x => ⟨(x, x), rfl⟩
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
diagSub
similar to `diag` but the target vector is a `Subtype_` guaranteeing the equality of the components
subtypeVal_nil {α : TypeVec.{u} 0} (ps : α ⟹ «repeat» 0 Prop) : TypeVec.subtypeVal ps = nilFun := funext <| by rintro ⟨⟩ @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
subtypeVal_nil
null
diag_sub_val {n} {α : TypeVec.{u} n} : subtypeVal (repeatEq α) ⊚ diagSub = prod.diag := by ext i x induction i with | fz => simp only [comp, subtypeVal, repeatEq.eq_2, diagSub, prod.diag] | fs _ i_ih => apply @i_ih (drop α)
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
diag_sub_val
null
prod_id : ∀ {n} {α β : TypeVec.{u} n}, (id ⊗' id) = (id : α ⊗ β ⟹ _) := by intros ext i a induction i with | fz => cases a; rfl | fs _ i_ih => apply i_ih
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
prod_id
null
append_prod_appendFun {n} {α α' β β' : TypeVec.{u} n} {φ φ' ψ ψ' : Type u} {f₀ : α ⟹ α'} {g₀ : β ⟹ β'} {f₁ : φ → φ'} {g₁ : ψ → ψ'} : ((f₀ ⊗' g₀) ::: (_root_.Prod.map f₁ g₁)) = ((f₀ ::: f₁) ⊗' (g₀ ::: g₁)) := by ext i a cases i · cases a rfl · rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
append_prod_appendFun
null
@[simp] dropFun_diag {α} : dropFun (@prod.diag (n + 1) α) = prod.diag := by ext i : 2 induction i <;> simp [dropFun, *] <;> rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_diag
null
dropFun_subtypeVal {α} (p : α ⟹ «repeat» (n + 1) Prop) : dropFun (subtypeVal p) = subtypeVal _ := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_subtypeVal
null
lastFun_subtypeVal {α} (p : α ⟹ «repeat» (n + 1) Prop) : lastFun (subtypeVal p) = Subtype.val := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
lastFun_subtypeVal
null
dropFun_toSubtype {α} (p : α ⟹ «repeat» (n + 1) Prop) : dropFun (toSubtype p) = toSubtype _ := by ext i induction i <;> simp [dropFun, *] <;> rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_toSubtype
null
lastFun_toSubtype {α} (p : α ⟹ «repeat» (n + 1) Prop) : lastFun (toSubtype p) = _root_.id := by ext i : 2 induction i; simp [*]; rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
lastFun_toSubtype
null
dropFun_of_subtype {α} (p : α ⟹ «repeat» (n + 1) Prop) : dropFun (ofSubtype p) = ofSubtype _ := by ext i : 2 induction i <;> simp [dropFun, *] <;> rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_of_subtype
null
lastFun_of_subtype {α} (p : α ⟹ «repeat» (n + 1) Prop) : lastFun (ofSubtype p) = _root_.id := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
lastFun_of_subtype
null
dropFun_RelLast' {α : TypeVec n} {β} (R : β → β → Prop) : dropFun (RelLast' α R) = repeatEq α := rfl attribute [simp] drop_append1' @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_RelLast'
null
dropFun_prod {α α' β β' : TypeVec (n + 1)} (f : α ⟹ β) (f' : α' ⟹ β') : dropFun (f ⊗' f') = (dropFun f ⊗' dropFun f') := by ext i : 2 induction i <;> simp [dropFun, *] <;> rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_prod
null
lastFun_prod {α α' β β' : TypeVec (n + 1)} (f : α ⟹ β) (f' : α' ⟹ β') : lastFun (f ⊗' f') = Prod.map (lastFun f) (lastFun f') := by ext i : 1 induction i; simp [lastFun, *]; rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
lastFun_prod
null
dropFun_from_append1_drop_last {α : TypeVec (n + 1)} : dropFun (@fromAppend1DropLast _ α) = id := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_from_append1_drop_last
null
lastFun_from_append1_drop_last {α : TypeVec (n + 1)} : lastFun (@fromAppend1DropLast _ α) = _root_.id := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
lastFun_from_append1_drop_last
null
dropFun_id {α : TypeVec (n + 1)} : dropFun (@TypeVec.id _ α) = id := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_id
null
prod_map_id {α β : TypeVec n} : (@TypeVec.id _ α ⊗' @TypeVec.id _ β) = id := prod_id @[deprecated (since := "2025-08-14")] alias subtypeVal_diagSub := diag_sub_val @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
prod_map_id
null
toSubtype_of_subtype {α : TypeVec n} (p : α ⟹ «repeat» n Prop) : toSubtype p ⊚ ofSubtype p = id := by ext i x induction i <;> simp only [id, toSubtype, comp, ofSubtype] at * simp [*] @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
toSubtype_of_subtype
null
subtypeVal_toSubtype {α : TypeVec n} (p : α ⟹ «repeat» n Prop) : subtypeVal p ⊚ toSubtype p = fun _ => Subtype.val := by ext i x induction i <;> simp only [toSubtype, comp, subtypeVal] at * simp [*] @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
subtypeVal_toSubtype
null
toSubtype_of_subtype_assoc {α β : TypeVec n} (p : α ⟹ «repeat» n Prop) (f : β ⟹ Subtype_ p) : @toSubtype n _ p ⊚ ofSubtype _ ⊚ f = f := by rw [← comp_assoc, toSubtype_of_subtype]; simp @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
toSubtype_of_subtype_assoc
null
toSubtype'_of_subtype' {α : TypeVec n} (r : α ⊗ α ⟹ «repeat» n Prop) : toSubtype' r ⊚ ofSubtype' r = id := by ext i x induction i <;> dsimp only [id, toSubtype', comp, ofSubtype'] at * <;> simp [*]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
toSubtype'_of_subtype'
null
subtypeVal_toSubtype' {α : TypeVec n} (r : α ⊗ α ⟹ «repeat» n Prop) : subtypeVal r ⊚ toSubtype' r = fun i x => prod.mk i x.1.fst x.1.snd := by ext i x induction i <;> simp only [toSubtype', comp, subtypeVal, prod.mk] at * simp [*]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
subtypeVal_toSubtype'
null
isASCIIUpper (c : UInt8) : Bool := c ≥ 65 && c ≤ 90
def
Data
[ "Mathlib.Init", "Mathlib.Algebra.Ring.InjSurj", "Mathlib.Data.ZMod.Defs", "Mathlib.Data.BitVec" ]
Mathlib/Data/UInt.lean
isASCIIUpper
Is this an uppercase ASCII letter?
isASCIILower (c : UInt8) : Bool := c ≥ 97 && c ≤ 122
def
Data
[ "Mathlib.Init", "Mathlib.Algebra.Ring.InjSurj", "Mathlib.Data.ZMod.Defs", "Mathlib.Data.BitVec" ]
Mathlib/Data/UInt.lean
isASCIILower
Is this a lowercase ASCII letter?
isASCIIAlpha (c : UInt8) : Bool := c.isASCIIUpper || c.isASCIILower
def
Data
[ "Mathlib.Init", "Mathlib.Algebra.Ring.InjSurj", "Mathlib.Data.ZMod.Defs", "Mathlib.Data.BitVec" ]
Mathlib/Data/UInt.lean
isASCIIAlpha
Is this an alphabetic ASCII character?
isASCIIDigit (c : UInt8) : Bool := c ≥ 48 && c ≤ 57
def
Data
[ "Mathlib.Init", "Mathlib.Algebra.Ring.InjSurj", "Mathlib.Data.ZMod.Defs", "Mathlib.Data.BitVec" ]
Mathlib/Data/UInt.lean
isASCIIDigit
Is this an ASCII digit character?
isASCIIAlphanum (c : UInt8) : Bool := c.isASCIIAlpha || c.isASCIIDigit
def
Data
[ "Mathlib.Init", "Mathlib.Algebra.Ring.InjSurj", "Mathlib.Data.ZMod.Defs", "Mathlib.Data.BitVec" ]
Mathlib/Data/UInt.lean
isASCIIAlphanum
Is this an alphanumeric ASCII character?
toChar (n : UInt8) : Char := ⟨n.toUInt32, .inl (Nat.lt_trans n.toBitVec.isLt (by decide))⟩
def
Data
[ "Mathlib.Init", "Mathlib.Algebra.Ring.InjSurj", "Mathlib.Data.ZMod.Defs", "Mathlib.Data.BitVec" ]
Mathlib/Data/UInt.lean
toChar
The numbers from 0 to 256 are all valid UTF-8 characters, so we can embed one in the other.
up_injective : Injective (@up α) := Equiv.plift.symm.injective
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
up_injective
null
up_surjective : Surjective (@up α) := Equiv.plift.symm.surjective
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
up_surjective
null
up_bijective : Bijective (@up α) := Equiv.plift.symm.bijective
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
up_bijective
null
up_inj {x y : α} : up x = up y ↔ x = y := by simp
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
up_inj
null
down_surjective : Surjective (@down α) := Equiv.plift.surjective
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
down_surjective
null
down_bijective : Bijective (@down α) := Equiv.plift.bijective
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
down_bijective
null
@[simp] map_injective : Injective (PLift.map f) ↔ Injective f := (Injective.of_comp_iff' _ down_bijective).trans <| up_injective.of_comp_iff _ @[simp] lemma map_surjective : Surjective (PLift.map f) ↔ Surjective f := (down_surjective.of_comp_iff _).trans <| Surjective.of_comp_iff' up_bijective _ @[simp] lemma map_bijective : Bijective (PLift.map f) ↔ Bijective f := (down_bijective.of_comp_iff _).trans <| Bijective.of_comp_iff' up_bijective _
lemma
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
map_injective
null
up_injective : Injective (@up α) := Equiv.ulift.symm.injective
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
up_injective
null
up_surjective : Surjective (@up α) := Equiv.ulift.symm.surjective
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
up_surjective
null
up_bijective : Bijective (@up α) := Equiv.ulift.symm.bijective
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
up_bijective
null
up_inj {x y : α} : up x = up y ↔ x = y := by simp
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
up_inj
null
down_surjective : Surjective (@down α) := Equiv.ulift.surjective
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
down_surjective
null
down_bijective : Bijective (@down α) := Equiv.ulift.bijective @[simp]
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
down_bijective
null
@[simp] map_injective : Injective (ULift.map f : ULift.{u'} α → ULift.{v'} β) ↔ Injective f := (Injective.of_comp_iff' _ down_bijective).trans <| up_injective.of_comp_iff _ @[simp] lemma map_surjective : Surjective (ULift.map f : ULift.{u'} α → ULift.{v'} β) ↔ Surjective f := (down_surjective.of_comp_iff _).trans <| Surjective.of_comp_iff' up_bijective _ @[simp] lemma map_bijective : Bijective (ULift.map f : ULift.{u'} α → ULift.{v'} β) ↔ Bijective f := (down_bijective.of_comp_iff _).trans <| Bijective.of_comp_iff' up_bijective _ @[ext]
lemma
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
map_injective
null
ext (x y : ULift α) (h : x.down = y.down) : x = y := congrArg up h @[simp]
theorem
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
ext
null
rec_update {β : ULift α → Type*} [DecidableEq α] (f : ∀ a, β (.up a)) (a : α) (x : β (.up a)) : ULift.rec (update f a x) = update (ULift.rec f) (.up a) x := Function.rec_update up_injective (ULift.rec ·) (fun _ _ => rfl) (fun | _, _, .up _, h => (h _ rfl).elim) _ _ _
lemma
Data
[ "Mathlib.Control.ULift", "Mathlib.Logic.Equiv.Basic" ]
Mathlib/Data/ULift.lean
rec_update
null
Vector3 (α : Type u) (n : ℕ) : Type u := Fin2 n → α
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
Vector3
Alternate definition of `Vector` based on `Fin2`.
@[match_pattern] nil : Vector3 α 0 := nofun
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
nil
The empty vector
@[match_pattern] cons (a : α) (v : Vector3 α n) : Vector3 α (n + 1) := fun i => by refine i.cases' ?_ ?_ · exact a · exact v
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
cons
The vector cons operation
@[app_unexpander Vector3.nil] unexpandNil : Lean.PrettyPrinter.Unexpander | `($(_)) => `([])
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
unexpandNil
Unexpander for `Vector3.nil`
@[app_unexpander Vector3.cons] unexpandCons : Lean.PrettyPrinter.Unexpander | `($(_) $x []) => `([$x]) | `($(_) $x [$xs,*]) => `([$x, $xs,*]) | _ => throw ()
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
unexpandCons
Unexpander for `Vector3.cons`
@[simp] cons_fz (a : α) (v : Vector3 α n) : (a :: v) fz = a := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
cons_fz
null
cons_fs (a : α) (v : Vector3 α n) (i) : (a :: v) (fs i) = v i := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
cons_fs
null
nth (i : Fin2 n) (v : Vector3 α n) : α := v i
abbrev
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
nth
Get the `i`th element of a vector
ofFn (f : Fin2 n → α) : Vector3 α n := f
abbrev
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
ofFn
Construct a vector from a function on `Fin2`.
head (v : Vector3 α (n + 1)) : α := v fz
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
head
Get the head of a nonempty vector.
tail (v : Vector3 α (n + 1)) : Vector3 α n := fun i => v (fs i)
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
tail
Get the tail of a nonempty vector.
eq_nil (v : Vector3 α 0) : v = [] := funext fun i => nomatch i
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
eq_nil
null
cons_head_tail (v : Vector3 α (n + 1)) : (head v :: tail v) = v := funext fun i => Fin2.cases' rfl (fun _ => rfl) i
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Util.Notation3", "Mathlib.Tactic.TypeStar" ]
Mathlib/Data/Vector3.lean
cons_head_tail
null