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
_root_.Function.extend_val_apply' {p : β → Prop} {g : {x // p x} → γ} {j : β → γ} {b : β} (hb : ¬p b) : val.extend g j b = j b := by grind [Function.extend]
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
_root_.Function.extend_val_apply'
null
restrict {α} {β : α → Type*} (p : α → Prop) (f : ∀ x, β x) (x : Subtype p) : β x.1 := f x @[simp, grind =]
def
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
restrict
Restrict a (dependent) function to a subtype
restrict_apply {α} {β : α → Type*} (f : ∀ x, β x) (p : α → Prop) (x : Subtype p) : restrict p f x = f x.1 := by rfl
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
restrict_apply
null
restrict_def {α β} (f : α → β) (p : α → Prop) : restrict p f = f ∘ (fun (a : Subtype p) ↦ a) := rfl
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
restrict_def
null
restrict_injective {α β} {f : α → β} (p : α → Prop) (h : Injective f) : Injective (restrict p f) := h.comp coe_injective
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
restrict_injective
null
surjective_restrict {α} {β : α → Type*} [ne : ∀ a, Nonempty (β a)] (p : α → Prop) : Surjective fun f : ∀ x, β x ↦ restrict p f := by classical exact fun f ↦ ⟨fun x ↦ if h : p x then f ⟨x, h⟩ else Nonempty.some (ne x), by grind⟩
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
surjective_restrict
null
@[simps] coind {α β} (f : α → β) {p : β → Prop} (h : ∀ a, p (f a)) : α → Subtype p := fun a ↦ ⟨f a, h a⟩
def
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
coind
Defining a map into a subtype, this can be seen as a "coinduction principle" of `Subtype`
coind_injective {α β} {f : α → β} {p : β → Prop} (h : ∀ a, p (f a)) (hf : Injective f) : Injective (coind f h) := fun x y hxy ↦ hf <| by apply congr_arg Subtype.val hxy
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
coind_injective
null
coind_surjective {α β} {f : α → β} {p : β → Prop} (h : ∀ a, p (f a)) (hf : Surjective f) : Surjective (coind f h) := fun x ↦ let ⟨a, ha⟩ := hf x ⟨a, coe_injective ha⟩
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
coind_surjective
null
coind_bijective {α β} {f : α → β} {p : β → Prop} (h : ∀ a, p (f a)) (hf : Bijective f) : Bijective (coind f h) := ⟨coind_injective h hf.1, coind_surjective h hf.2⟩
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
coind_bijective
null
@[simps] map {p : α → Prop} {q : β → Prop} (f : α → β) (h : ∀ a, p a → q (f a)) : Subtype p → Subtype q := fun x ↦ ⟨f x, h x x.prop⟩
def
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
map
Restriction of a function to a function on subtypes.
map_def {p : α → Prop} {q : β → Prop} (f : α → β) (h : ∀ a, p a → q (f a)) : map f h = fun x ↦ ⟨f x, h x x.prop⟩ := rfl
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
map_def
null
map_comp {p : α → Prop} {q : β → Prop} {r : γ → Prop} {x : Subtype p} (f : α → β) (h : ∀ a, p a → q (f a)) (g : β → γ) (l : ∀ a, q a → r (g a)) : map g l (map f h x) = map (g ∘ f) (fun a ha ↦ l (f a) <| h a ha) x := rfl
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
map_comp
null
map_id {p : α → Prop} {h : ∀ a, p a → p (id a)} : map (@id α) h = id := funext fun _ ↦ rfl
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
map_id
null
map_injective {p : α → Prop} {q : β → Prop} {f : α → β} (h : ∀ a, p a → q (f a)) (hf : Injective f) : Injective (map f h) := coind_injective _ <| hf.comp coe_injective
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
map_injective
null
map_involutive {p : α → Prop} {f : α → α} (h : ∀ a, p a → p (f a)) (hf : Involutive f) : Involutive (map f h) := fun x ↦ Subtype.ext (hf x)
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
map_involutive
null
map_eq {p : α → Prop} {q : β → Prop} {f g : α → β} (h₁ : ∀ a : α, p a → q (f a)) (h₂ : ∀ a : α, p a → q (g a)) {x y : Subtype p} : map f h₁ x = map g h₂ y ↔ f x = g y := Subtype.ext_iff
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
map_eq
null
map_ne {p : α → Prop} {q : β → Prop} {f g : α → β} (h₁ : ∀ a : α, p a → q (f a)) (h₂ : ∀ a : α, p a → q (g a)) {x y : Subtype p} : map f h₁ x ≠ map g h₂ y ↔ f x ≠ g y := map_eq h₁ h₂ |>.not
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
map_ne
null
equiv_iff [HasEquiv α] {p : α → Prop} {s t : Subtype p} : s ≈ t ↔ (s : α) ≈ (t : α) := Iff.rfl variable [Setoid α]
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
equiv_iff
null
protected refl (s : Subtype p) : s ≈ s := Setoid.refl _
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
refl
null
protected symm {s t : Subtype p} (h : s ≈ t) : t ≈ s := Setoid.symm h
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
symm
null
protected trans {s t u : Subtype p} (h₁ : s ≈ t) (h₂ : t ≈ u) : s ≈ u := Setoid.trans h₁ h₂
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
trans
null
equivalence (p : α → Prop) : Equivalence (@HasEquiv.Equiv (Subtype p) _) := .mk (Subtype.refl) (@Subtype.symm _ p _) (@Subtype.trans _ p _)
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
equivalence
null
@[simp] coe_prop {S : Set α} (a : { a // a ∈ S }) : ↑a ∈ S := a.prop
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
coe_prop
null
val_prop {S : Set α} (a : { a // a ∈ S }) : a.val ∈ S := a.prop
theorem
Data
[ "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.AdaptationNote", "Mathlib.Tactic.Simps.Basic" ]
Mathlib/Data/Subtype.lean
val_prop
null
@[ext] TwoPointing (α : Type*) extends α × α where /-- `fst` and `snd` are distinct terms -/ fst_ne_snd : fst ≠ snd deriving DecidableEq initialize_simps_projections TwoPointing (+toProd, -fst, -snd)
structure
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
TwoPointing
Two-pointing of a type. This is a Type-valued termed `Nontrivial`.
snd_ne_fst : p.snd ≠ p.fst := p.fst_ne_snd.symm
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
snd_ne_fst
null
@[simps] swap : TwoPointing α := ⟨(p.snd, p.fst), p.snd_ne_fst⟩
def
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
swap
Swaps the two pointed elements.
swap_fst : p.swap.fst = p.snd := rfl
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
swap_fst
null
swap_snd : p.swap.snd = p.fst := rfl @[simp]
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
swap_snd
null
swap_swap : p.swap.swap = p := rfl include p in
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
swap_swap
null
to_nontrivial : Nontrivial α := ⟨⟨p.fst, p.snd, p.fst_ne_snd⟩⟩
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
to_nontrivial
null
@[simp] nonempty_two_pointing_iff : Nonempty (TwoPointing α) ↔ Nontrivial α := ⟨fun ⟨p⟩ ↦ p.to_nontrivial, fun _ => inferInstance⟩
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
nonempty_two_pointing_iff
null
pi : TwoPointing (α → β) where fst _ := q.fst snd _ := q.snd fst_ne_snd h := q.fst_ne_snd (congr_fun h (Classical.arbitrary α)) @[simp]
def
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
pi
The two-pointing of constant functions.
pi_fst : (q.pi α).fst = const α q.fst := rfl @[simp]
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
pi_fst
null
pi_snd : (q.pi α).snd = const α q.snd := rfl
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
pi_snd
null
prod : TwoPointing (α × β) where fst := (p.fst, q.fst) snd := (p.snd, q.snd) fst_ne_snd h := p.fst_ne_snd (congr_arg Prod.fst h) @[simp]
def
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
prod
The product of two two-pointings.
prod_fst : (p.prod q).fst = (p.fst, q.fst) := rfl @[simp]
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
prod_fst
null
prod_snd : (p.prod q).snd = (p.snd, q.snd) := rfl
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
prod_snd
null
protected sum : TwoPointing (α ⊕ β) := ⟨(Sum.inl p.fst, Sum.inr q.snd), Sum.inl_ne_inr⟩ @[simp]
def
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
sum
The sum of two pointings. Keeps the first point from the left and the second point from the right.
sum_fst : (p.sum q).fst = Sum.inl p.fst := rfl @[simp]
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
sum_fst
null
sum_snd : (p.sum q).snd = Sum.inr q.snd := rfl
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
sum_snd
null
protected bool : TwoPointing Bool := ⟨(false, true), Bool.false_ne_true⟩ @[simp]
def
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
bool
The `false`, `true` two-pointing of `Bool`.
bool_fst : TwoPointing.bool.fst = false := rfl @[simp]
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
bool_fst
null
bool_snd : TwoPointing.bool.snd = true := rfl
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
bool_snd
null
protected prop : TwoPointing Prop := ⟨(False, True), false_ne_true⟩ @[simp]
def
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
prop
The `False`, `True` two-pointing of `Prop`.
prop_fst : TwoPointing.prop.fst = False := rfl @[simp]
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
prop_fst
null
prop_snd : TwoPointing.prop.snd = True := rfl
theorem
Data
[ "Mathlib.Logic.Nontrivial.Defs", "Mathlib.Logic.Nonempty", "Mathlib.Tactic.Simps.Basic", "Batteries.Logic" ]
Mathlib/Data/TwoPointing.lean
prop_snd
null
@[pp_with_univ] TypeVec (n : ℕ) := Fin2 n → Type*
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
TypeVec
n-tuples of types, as a category
Arrow (α β : TypeVec n) := ∀ i : Fin2 n, α i → β i @[inherit_doc] scoped[MvFunctor] infixl:40 " ⟹ " => TypeVec.Arrow open MvFunctor
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
Arrow
arrow in the category of `TypeVec`
@[ext] Arrow.ext {α β : TypeVec n} (f g : α ⟹ β) : (∀ i, f i = g i) → f = g := by intro h; funext i; apply h
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
Arrow.ext
Extensionality for arrows
Arrow.inhabited (α β : TypeVec n) [∀ i, Inhabited (β i)] : Inhabited (α ⟹ β) := ⟨fun _ _ => default⟩
instance
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
Arrow.inhabited
null
id {α : TypeVec n} : α ⟹ α := fun _ x => x
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
id
identity of arrow composition
comp {α β γ : TypeVec n} (g : β ⟹ γ) (f : α ⟹ β) : α ⟹ γ := fun i x => g i (f i x) @[inherit_doc] scoped[MvFunctor] infixr:80 " ⊚ " => TypeVec.comp -- type as \oo @[simp]
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
comp
arrow composition in the category of `TypeVec`
id_comp {α β : TypeVec n} (f : α ⟹ β) : id ⊚ f = f := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
id_comp
null
comp_id {α β : TypeVec n} (f : α ⟹ β) : f ⊚ id = f := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
comp_id
null
comp_assoc {α β γ δ : TypeVec n} (h : γ ⟹ δ) (g : β ⟹ γ) (f : α ⟹ β) : (h ⊚ g) ⊚ f = h ⊚ g ⊚ f := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
comp_assoc
null
append1 (α : TypeVec n) (β : Type*) : TypeVec (n + 1) | Fin2.fs i => α i | Fin2.fz => β @[inherit_doc] infixl:67 " ::: " => append1
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
append1
Support for extending a `TypeVec` by one element.
drop (α : TypeVec.{u} (n + 1)) : TypeVec n := fun i => α i.fs
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
drop
retain only a `n-length` prefix of the argument
last (α : TypeVec.{u} (n + 1)) : Type _ := α Fin2.fz
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
last
take the last value of a `(n+1)-length` vector
last.inhabited (α : TypeVec (n + 1)) [Inhabited (α Fin2.fz)] : Inhabited (last α) := ⟨show α Fin2.fz from default⟩
instance
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
last.inhabited
null
drop_append1 {α : TypeVec n} {β : Type*} {i : Fin2 n} : drop (append1 α β) i = α i := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
drop_append1
null
drop_append1' {α : TypeVec n} {β : Type*} : drop (append1 α β) = α := funext fun _ => drop_append1
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
drop_append1'
null
last_append1 {α : TypeVec n} {β : Type*} : last (append1 α β) = β := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
last_append1
null
append1_drop_last (α : TypeVec (n + 1)) : append1 (drop α) (last α) = α := funext fun i => by cases i <;> rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
append1_drop_last
null
@[elab_as_elim] append1Cases {C : TypeVec (n + 1) → Sort u} (H : ∀ α β, C (append1 α β)) (γ) : C γ := by rw [← @append1_drop_last _ γ]; apply H @[simp]
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
append1Cases
cases on `(n+1)-length` vectors
append1_cases_append1 {C : TypeVec (n + 1) → Sort u} (H : ∀ α β, C (append1 α β)) (α β) : @append1Cases _ C H (append1 α β) = H α β := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
append1_cases_append1
null
splitFun {α α' : TypeVec (n + 1)} (f : drop α ⟹ drop α') (g : last α → last α') : α ⟹ α' | Fin2.fs i => f i | Fin2.fz => g
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
splitFun
append an arrow and a function for arbitrary source and target type vectors
appendFun {α α' : TypeVec n} {β β' : Type*} (f : α ⟹ α') (g : β → β') : append1 α β ⟹ append1 α' β' := splitFun f g @[inherit_doc] infixl:0 " ::: " => appendFun
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
appendFun
append an arrow and a function as well as their respective source and target types / typevecs
dropFun {α β : TypeVec (n + 1)} (f : α ⟹ β) : drop α ⟹ drop β := fun i => f i.fs
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun
split off the prefix of an arrow
lastFun {α β : TypeVec (n + 1)} (f : α ⟹ β) : last α → last β := f Fin2.fz
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
lastFun
split off the last function of an arrow
nilFun {α : TypeVec 0} {β : TypeVec 0} : α ⟹ β := fun i => by apply Fin2.elim0 i
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
nilFun
arrow in the category of `0-length` vectors
eq_of_drop_last_eq {α β : TypeVec (n + 1)} {f g : α ⟹ β} (h₀ : dropFun f = dropFun g) (h₁ : lastFun f = lastFun g) : f = g := by refine funext (fun x => ?_) cases x · apply h₁ · apply congr_fun h₀ @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
eq_of_drop_last_eq
null
dropFun_splitFun {α α' : TypeVec (n + 1)} (f : drop α ⟹ drop α') (g : last α → last α') : dropFun (splitFun f g) = f := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_splitFun
null
Arrow.mp {α β : TypeVec n} (h : α = β) : α ⟹ β | _ => Eq.mp (congr_fun h _)
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
Arrow.mp
turn an equality into an arrow
Arrow.mpr {α β : TypeVec n} (h : α = β) : β ⟹ α | _ => Eq.mpr (congr_fun h _)
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
Arrow.mpr
turn an equality into an arrow, with reverse direction
toAppend1DropLast {α : TypeVec (n + 1)} : α ⟹ (drop α ::: last α) := Arrow.mpr (append1_drop_last _)
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
toAppend1DropLast
decompose a vector into its prefix appended with its last element
fromAppend1DropLast {α : TypeVec (n + 1)} : (drop α ::: last α) ⟹ α := Arrow.mp (append1_drop_last _) @[simp]
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
fromAppend1DropLast
stitch two bits of a vector back together
lastFun_splitFun {α α' : TypeVec (n + 1)} (f : drop α ⟹ drop α') (g : last α → last α') : lastFun (splitFun f g) = g := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
lastFun_splitFun
null
dropFun_appendFun {α α' : TypeVec n} {β β' : Type*} (f : α ⟹ α') (g : β → β') : dropFun (f ::: g) = f := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_appendFun
null
lastFun_appendFun {α α' : TypeVec n} {β β' : Type*} (f : α ⟹ α') (g : β → β') : lastFun (f ::: g) = g := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
lastFun_appendFun
null
split_dropFun_lastFun {α α' : TypeVec (n + 1)} (f : α ⟹ α') : splitFun (dropFun f) (lastFun f) = f := eq_of_drop_last_eq rfl rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
split_dropFun_lastFun
null
splitFun_inj {α α' : TypeVec (n + 1)} {f f' : drop α ⟹ drop α'} {g g' : last α → last α'} (H : splitFun f g = splitFun f' g') : f = f' ∧ g = g' := by rw [← dropFun_splitFun f g, H, ← lastFun_splitFun f g, H]; simp
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
splitFun_inj
null
appendFun_inj {α α' : TypeVec n} {β β' : Type*} {f f' : α ⟹ α'} {g g' : β → β'} : (f ::: g : (α ::: β) ⟹ _) = (f' ::: g' : (α ::: β) ⟹ _) → f = f' ∧ g = g' := splitFun_inj
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
appendFun_inj
null
splitFun_comp {α₀ α₁ α₂ : TypeVec (n + 1)} (f₀ : drop α₀ ⟹ drop α₁) (f₁ : drop α₁ ⟹ drop α₂) (g₀ : last α₀ → last α₁) (g₁ : last α₁ → last α₂) : splitFun (f₁ ⊚ f₀) (g₁ ∘ g₀) = splitFun f₁ g₁ ⊚ splitFun f₀ g₀ := eq_of_drop_last_eq rfl rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
splitFun_comp
null
appendFun_comp_splitFun {α γ : TypeVec n} {β δ : Type*} {ε : TypeVec (n + 1)} (f₀ : drop ε ⟹ α) (f₁ : α ⟹ γ) (g₀ : last ε → β) (g₁ : β → δ) : appendFun f₁ g₁ ⊚ splitFun f₀ g₀ = splitFun (α' := γ.append1 δ) (f₁ ⊚ f₀) (g₁ ∘ g₀) := (splitFun_comp _ _ _ _).symm
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
appendFun_comp_splitFun
null
appendFun_comp {α₀ α₁ α₂ : TypeVec n} {β₀ β₁ β₂ : Type*} (f₀ : α₀ ⟹ α₁) (f₁ : α₁ ⟹ α₂) (g₀ : β₀ → β₁) (g₁ : β₁ → β₂) : (f₁ ⊚ f₀ ::: g₁ ∘ g₀) = (f₁ ::: g₁) ⊚ (f₀ ::: g₀) := eq_of_drop_last_eq rfl rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
appendFun_comp
null
appendFun_comp' {α₀ α₁ α₂ : TypeVec n} {β₀ β₁ β₂ : Type*} (f₀ : α₀ ⟹ α₁) (f₁ : α₁ ⟹ α₂) (g₀ : β₀ → β₁) (g₁ : β₁ → β₂) : (f₁ ::: g₁) ⊚ (f₀ ::: g₀) = (f₁ ⊚ f₀ ::: g₁ ∘ g₀) := eq_of_drop_last_eq rfl rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
appendFun_comp'
null
nilFun_comp {α₀ : TypeVec 0} (f₀ : α₀ ⟹ Fin2.elim0) : nilFun ⊚ f₀ = f₀ := funext Fin2.elim0
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
nilFun_comp
null
appendFun_comp_id {α : TypeVec n} {β₀ β₁ β₂ : Type u} (g₀ : β₀ → β₁) (g₁ : β₁ → β₂) : (@id _ α ::: g₁ ∘ g₀) = (id ::: g₁) ⊚ (id ::: g₀) := eq_of_drop_last_eq rfl rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
appendFun_comp_id
null
dropFun_comp {α₀ α₁ α₂ : TypeVec (n + 1)} (f₀ : α₀ ⟹ α₁) (f₁ : α₁ ⟹ α₂) : dropFun (f₁ ⊚ f₀) = dropFun f₁ ⊚ dropFun f₀ := rfl @[simp]
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
dropFun_comp
null
lastFun_comp {α₀ α₁ α₂ : TypeVec (n + 1)} (f₀ : α₀ ⟹ α₁) (f₁ : α₁ ⟹ α₂) : lastFun (f₁ ⊚ f₀) = lastFun f₁ ∘ lastFun f₀ := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
lastFun_comp
null
appendFun_aux {α α' : TypeVec n} {β β' : Type*} (f : (α ::: β) ⟹ (α' ::: β')) : (dropFun f ::: lastFun f) = f := eq_of_drop_last_eq rfl rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
appendFun_aux
null
appendFun_id_id {α : TypeVec n} {β : Type*} : (@TypeVec.id n α ::: @_root_.id β) = TypeVec.id := eq_of_drop_last_eq rfl rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
appendFun_id_id
null
subsingleton0 : Subsingleton (TypeVec 0) := ⟨fun _ _ => funext Fin2.elim0⟩
instance
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
subsingleton0
null
protected casesNil {β : TypeVec 0 → Sort*} (f : β Fin2.elim0) : ∀ v, β v := fun v => cast (by congr; funext i; cases i) f
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
casesNil
cases distinction for 0-length type vector
protected casesCons (n : ℕ) {β : TypeVec (n + 1) → Sort*} (f : ∀ (t) (v : TypeVec n), β (v ::: t)) : ∀ v, β v := fun v : TypeVec (n + 1) => cast (by simp) (f v.last v.drop)
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
casesCons
cases distinction for (n+1)-length type vector
protected casesNil_append1 {β : TypeVec 0 → Sort*} (f : β Fin2.elim0) : TypeVec.casesNil f Fin2.elim0 = f := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
casesNil_append1
null
protected casesCons_append1 (n : ℕ) {β : TypeVec (n + 1) → Sort*} (f : ∀ (t) (v : TypeVec n), β (v ::: t)) (v : TypeVec n) (α) : TypeVec.casesCons n f (v ::: α) = f α v := rfl
theorem
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
casesCons_append1
null
typevecCasesNil₃ {β : ∀ v v' : TypeVec 0, v ⟹ v' → Sort*} (f : β Fin2.elim0 Fin2.elim0 nilFun) : ∀ v v' fs, β v v' fs := fun v v' fs => by refine cast ?_ f have eq₁ : v = Fin2.elim0 := by funext i; contradiction have eq₂ : v' = Fin2.elim0 := by funext i; contradiction have eq₃ : fs = nilFun := by funext i; contradiction cases eq₁; cases eq₂; cases eq₃; rfl
def
Data
[ "Mathlib.Data.Fin.Fin2", "Mathlib.Logic.Function.Basic", "Mathlib.Tactic.Common" ]
Mathlib/Data/TypeVec.lean
typevecCasesNil₃
cases distinction for an arrow in the category of 0-length type vectors