Built with doc-gen4, running Lean4. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓to navigate, Ctrl+🖱️to focus. On Mac, use Cmdinstead of Ctrl.
/-
Copyright (c) 2014 Parikshit Khanna. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Mario Carneiro

! This file was ported from Lean 3 source module data.list.basic
! leanprover-community/mathlib commit 9da1b3534b65d9661eb8f42443598a92bbb49211
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Init.Data.List.Basic
import Mathlib.Data.Nat.Order.Basic
import Mathlib.Data.List.Defs
import Mathlib.Init.Core
import Std.Data.List.Lemmas

/-!
# Basic properties of lists
-/

open Function

open Nat hiding one_pos

assert_not_exists Set.range

namespace List

universe u v w x

variable {
ι: Type ?u.206762
ι
:
Type _: Type (?u.72291+1)
Type _
} {
α: Type u
α
:
Type u: Type (u+1)
Type u
} {
β: Type v
β
:
Type v: Type (v+1)
Type v
} {
γ: Type w
γ
:
Type w: Type (w+1)
Type w
} {
δ: Type x
δ
:
Type x: Type (x+1)
Type x
} {
l₁: List α
l₁
l₂: List α
l₂
:
List: Type ?u.206773 → Type ?u.206773
List
α: Type u
α
} -- Porting note: Delete this attribute -- attribute [inline] List.head! /-- There is only one list of an empty type -/ instance
uniqueOfIsEmpty: {α : Type u} → [inst : IsEmpty α] → Unique (List α)
uniqueOfIsEmpty
[
IsEmpty: Sort ?u.36 → Prop
IsEmpty
α: Type u
α
] :
Unique: Sort ?u.39 → Sort (max1?u.39)
Unique
(
List: Type ?u.40 → Type ?u.40
List
α: Type u
α
) := {
instInhabitedList: {α : Type ?u.45} → Inhabited (List α)
instInhabitedList
with uniq := fun
l: ?m.59
l
=> match
l: ?m.59
l
with | [] =>
rfl: ∀ {α : Sort ?u.71} {a : α}, a = a
rfl
|
a: α
a
:: _ =>
isEmptyElim: ∀ {α : Sort ?u.100} [inst : IsEmpty α] {p : αSort ?u.99} (a : α), p a
isEmptyElim
a: α
a
} #align list.unique_of_is_empty
List.uniqueOfIsEmpty: {α : Type u} → [inst : IsEmpty α] → Unique (List α)
List.uniqueOfIsEmpty
instance: ∀ {α : Type u}, IsLeftId (List α) Append.append []
instance
:
IsLeftId: (α : Type ?u.267) → (ααα) → outParam αProp
IsLeftId
(
List: Type ?u.268 → Type ?u.268
List
α: Type u
α
)
Append.append: {α : Type ?u.269} → [self : Append α] → ααα
Append.append
[]: List ?m.296
[]
:= ⟨
nil_append: ∀ {α : Type ?u.313} (as : List α), [] ++ as = as
nil_append
instance: ∀ {α : Type u}, IsRightId (List α) Append.append []
instance
:
IsRightId: (α : Type ?u.356) → (ααα) → outParam αProp
IsRightId
(
List: Type ?u.357 → Type ?u.357
List
α: Type u
α
)
Append.append: {α : Type ?u.358} → [self : Append α] → ααα
Append.append
[]: List ?m.385
[]
:= ⟨
append_nil: ∀ {α : Type ?u.402} (as : List α), as ++ [] = as
append_nil
instance: ∀ {α : Type u}, IsAssociative (List α) Append.append
instance
:
IsAssociative: (α : Type ?u.445) → (ααα) → Prop
IsAssociative
(
List: Type ?u.446 → Type ?u.446
List
α: Type u
α
)
Append.append: {α : Type ?u.447} → [self : Append α] → ααα
Append.append
:= ⟨
append_assoc: ∀ {α : Type ?u.486} (as bs cs : List α), as ++ bs ++ cs = as ++ (bs ++ cs)
append_assoc
#align list.cons_ne_nil
List.cons_ne_nil: ∀ {α : Type u_1} (a : α) (l : List α), a :: l []
List.cons_ne_nil
#align list.cons_ne_self
List.cons_ne_self: ∀ {α : Type u_1} (a : α) (l : List α), a :: l l
List.cons_ne_self
#align list.head_eq_of_cons_eq
List.head_eq_of_cons_eqₓ: ∀ {α : Type u_1} {h₁ : α} {t₁ : List α} {h₂ : α} {t₂ : List α}, h₁ :: t₁ = h₂ :: t₂h₁ = h₂
List.head_eq_of_cons_eqₓ
-- implicits order #align list.tail_eq_of_cons_eq
List.tail_eq_of_cons_eqₓ: ∀ {α : Type u_1} {h₁ : α} {t₁ : List α} {h₂ : α} {t₂ : List α}, h₁ :: t₁ = h₂ :: t₂t₁ = t₂
List.tail_eq_of_cons_eqₓ
-- implicits order @[simp] theorem
cons_injective: ∀ {α : Type u} {a : α}, Injective (cons a)
cons_injective
{
a: α
a
:
α: Type u
α
} :
Injective: {α : Sort ?u.538} → {β : Sort ?u.537} → (αβ) → Prop
Injective
(
cons: {α : Type ?u.541} → αList αList α
cons
a: α
a
) := fun
_: ?m.553
_
_: ?m.556
_
=>
tail_eq_of_cons_eq: ∀ {α : Type ?u.558} {h₁ : α} {t₁ : List α} {h₂ : α} {t₂ : List α}, h₁ :: t₁ = h₂ :: t₂t₁ = t₂
tail_eq_of_cons_eq
#align list.cons_injective
List.cons_injective: ∀ {α : Type u} {a : α}, Injective (cons a)
List.cons_injective
#align list.cons_inj
List.cons_inj: ∀ {α : Type u_1} (a : α) {l l' : List α}, a :: l = a :: l' l = l'
List.cons_inj
theorem
cons_eq_cons: ∀ {α : Type u} {a b : α} {l l' : List α}, a :: l = b :: l' a = b l = l'
cons_eq_cons
{
a: α
a
b: α
b
:
α: Type u
α
} {
l: List α
l
l': List α
l'
:
List: Type ?u.618 → Type ?u.618
List
α: Type u
α
} :
a: α
a
::
l: List α
l
=
b: α
b
::
l': List α
l'
a: α
a
=
b: α
b
l: List α
l
=
l': List α
l'
:= ⟨
List.cons.inj: ∀ {α : Type ?u.645} {head : α} {tail : List α} {head_1 : α} {tail_1 : List α}, head :: tail = head_1 :: tail_1head = head_1 tail = tail_1
List.cons.inj
, fun
h: ?m.663
h
=>
h: ?m.663
h
.
1: ∀ {a b : Prop}, a ba
1
h: ?m.663
h
.
2: ∀ {a b : Prop}, a bb
2
rfl: ∀ {α : Sort ?u.669} {a : α}, a = a
rfl
#align list.cons_eq_cons
List.cons_eq_cons: ∀ {α : Type u} {a b : α} {l l' : List α}, a :: l = b :: l' a = b l = l'
List.cons_eq_cons
theorem
singleton_injective: ∀ {α : Type u}, Injective fun a => [a]
singleton_injective
:
Injective: {α : Sort ?u.715} → {β : Sort ?u.714} → (αβ) → Prop
Injective
fun
a: α
a
:
α: Type u
α
=> [
a: α
a
] := fun
_: ?m.730
_
_: ?m.733
_
h: ?m.736
h
=> (
cons_eq_cons: ∀ {α : Type ?u.738} {a b : α} {l l' : List α}, a :: l = b :: l' a = b l = l'
cons_eq_cons
.
1: ∀ {a b : Prop}, (a b) → ab
1
h: ?m.736
h
).
1: ∀ {a b : Prop}, a ba
1
#align list.singleton_injective
List.singleton_injective: ∀ {α : Type u}, Injective fun a => [a]
List.singleton_injective
theorem
singleton_inj: ∀ {α : Type u} {a b : α}, [a] = [b] a = b
singleton_inj
{
a: α
a
b: α
b
:
α: Type u
α
} : [
a: α
a
] = [
b: α
b
] ↔
a: α
a
=
b: α
b
:=
singleton_injective: ∀ {α : Type ?u.810}, Injective fun a => [a]
singleton_injective
.
eq_iff: ∀ {α : Sort ?u.812} {β : Sort ?u.813} {f : αβ}, Injective f∀ {a b : α}, f a = f b a = b
eq_iff
#align list.singleton_inj
List.singleton_inj: ∀ {α : Type u} {a b : α}, [a] = [b] a = b
List.singleton_inj
#align list.exists_cons_of_ne_nil
List.exists_cons_of_ne_nil: ∀ {α : Type u_1} {l : List α}, l []b L, l = b :: L
List.exists_cons_of_ne_nil
theorem
set_of_mem_cons: ∀ {α : Type u} (l : List α) (a : α), { x | x a :: l } = insert a { x | x l }
set_of_mem_cons
(
l: List α
l
:
List: Type ?u.862 → Type ?u.862
List
α: Type u
α
) (
a: α
a
:
α: Type u
α
) : {
x: ?m.871
x
|
x: ?m.871
x
a: α
a
::
l: List α
l
} =
insert: {α : outParam (Type ?u.896)} → {γ : Type ?u.895} → [self : Insert α γ] → αγγ
insert
a: α
a
{
x: ?m.905
x
|
x: ?m.905
x
l: List α
l
} :=
Set.ext: ∀ {α : Type ?u.938} {a b : Set α}, (∀ (x : α), x a x b) → a = b
Set.ext
fun
_: ?m.947
_
=>
mem_cons: ∀ {α : Type ?u.949} {a b : α} {l : List α}, a b :: l a = b a l
mem_cons
#align list.set_of_mem_cons
List.set_of_mem_cons: ∀ {α : Type u} (l : List α) (a : α), { x | x a :: l } = insert a { x | x l }
List.set_of_mem_cons
/-! ### mem -/ #align list.mem_singleton_self
List.mem_singleton_self: ∀ {α : Type u_1} (a : α), a [a]
List.mem_singleton_self
#align list.eq_of_mem_singleton
List.eq_of_mem_singleton: ∀ {α : Type u_1} {a b : α}, a [b]a = b
List.eq_of_mem_singleton
#align list.mem_singleton
List.mem_singleton: ∀ {α : Type u_1} {a b : α}, a [b] a = b
List.mem_singleton
#align list.mem_of_mem_cons_of_mem
List.mem_of_mem_cons_of_mem: ∀ {α : Type u_1} {a b : α} {l : List α}, a b :: lb la l
List.mem_of_mem_cons_of_mem
theorem
_root_.Decidable.List.eq_or_ne_mem_of_mem: ∀ [inst : DecidableEq α] {a b : α} {l : List α}, a b :: la = b a b a l
_root_.Decidable.List.eq_or_ne_mem_of_mem
[
DecidableEq: Sort ?u.996 → Sort (max1?u.996)
DecidableEq
α: Type u
α
] {
a: α
a
b: α
b
:
α: Type u
α
} {
l: List α
l
:
List: Type ?u.1009 → Type ?u.1009
List
α: Type u
α
} (
h: a b :: l
h
:
a: α
a
b: α
b
::
l: List α
l
) :
a: α
a
=
b: α
b
a: α
a
b: α
b
a: α
a
l: List α
l
:=

Goals accomplished! 🐙
ι: Type ?u.979

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

a, b: α

l: List α

h: a b :: l


a = b a b a l
ι: Type ?u.979

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

a, b: α

l: List α

h: a b :: l

hab: a = b


pos
a = b a b a l
ι: Type ?u.979

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

a, b: α

l: List α

h: a b :: l

hab: ¬a = b


neg
a = b a b a l
ι: Type ?u.979

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

a, b: α

l: List α

h: a b :: l


a = b a b a l
ι: Type ?u.979

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

a, b: α

l: List α

h: a b :: l

hab: a = b


pos
a = b a b a l
ι: Type ?u.979

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

a, b: α

l: List α

h: a b :: l

hab: a = b


pos
a = b a b a l
ι: Type ?u.979

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

a, b: α

l: List α

h: a b :: l

hab: ¬a = b


neg
a = b a b a l

Goals accomplished! 🐙
ι: Type ?u.979

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

a, b: α

l: List α

h: a b :: l


a = b a b a l
ι: Type ?u.979

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

a, b: α

l: List α

h: a b :: l

hab: ¬a = b


neg
a = b a b a l
ι: Type ?u.979

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

a, b: α

l: List α

h: a b :: l

hab: ¬a = b


neg
a = b a b a l

Goals accomplished! 🐙
#align decidable.list.eq_or_ne_mem_of_mem
Decidable.List.eq_or_ne_mem_of_mem: ∀ {α : Type u} [inst : DecidableEq α] {a b : α} {l : List α}, a b :: la = b a b a l
Decidable.List.eq_or_ne_mem_of_mem
#align list.eq_or_ne_mem_of_mem
List.eq_or_ne_mem_of_mem: ∀ {α : Type u_1} {a b : α} {l : List α}, a b :: la = b a b a l
List.eq_or_ne_mem_of_mem
-- porting note: from init.data.list.lemmas alias
mem_cons: ∀ {α : Type u_1} {a b : α} {l : List α}, a b :: l a = b a l
mem_cons
eq_or_mem_of_mem_cons: ∀ {α : Type u_1} {a b : α} {l : List α}, a b :: la = b a l
eq_or_mem_of_mem_cons
_ #align list.eq_or_mem_of_mem_cons
List.eq_or_mem_of_mem_cons: ∀ {α : Type u_1} {a b : α} {l : List α}, a b :: la = b a l
List.eq_or_mem_of_mem_cons
#align list.not_mem_append
List.not_mem_append: ∀ {α : Type u_1} {a : α} {s t : List α}, ¬a s¬a t¬a s ++ t
List.not_mem_append
#align list.ne_nil_of_mem
List.ne_nil_of_mem: ∀ {α : Type u_1} {a : α} {l : List α}, a ll []
List.ne_nil_of_mem
theorem
mem_split: ∀ {a : α} {l : List α}, a ls t, l = s ++ a :: t
mem_split
{
a: α
a
:
α: Type u
α
} {
l: List α
l
:
List: Type ?u.1185 → Type ?u.1185
List
α: Type u
α
} (
h: a l
h
:
a: α
a
l: List α
l
) : ∃
s: List α
s
t: List α
t
:
List: Type ?u.1218 → Type ?u.1218
List
α: Type u
α
,
l: List α
l
=
s: List α
s
++
a: α
a
::
t: List α
t
:=

Goals accomplished! 🐙
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l: List α

h: a l


s t, l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l: List α

h✝: a l

h: a []


nil
s t, [] = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h✝: a l✝

b: α

l: List α

ih: a ls t, l = s ++ a :: t

h: a b :: l


cons
s t, b :: l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l: List α

h✝: a l

h: a []


nil
s t, [] = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h✝: a l✝

b: α

l: List α

ih: a ls t, l = s ++ a :: t

h: a b :: l


cons
s t, b :: l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l: List α

h: a l


s t, l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l: List α

h✝: a l

h: a []


nil
s t, [] = s ++ a :: t

Goals accomplished! 🐙
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h✝: a l✝

b: α

l: List α

ih: a ls t, l = s ++ a :: t

h: a b :: l


cons
s t, b :: l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h✝: a l✝

b: α

l: List α

ih: a ls t, l = s ++ a :: t

h: a b :: l


cons
s t, b :: l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l: List α

h: a l


s t, l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h: a l✝

l: List α

ih: a ls t, l = s ++ a :: t


cons.head
s t, a :: l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h✝: a l✝

b: α

l: List α

ih: a ls t, l = s ++ a :: t

h: Mem a l


cons.tail
s t, b :: l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l: List α

h: a l


s t, l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h: a l✝

l: List α

ih: a ls t, l = s ++ a :: t


cons.head
s t, a :: l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h: a l✝

l: List α

ih: a ls t, l = s ++ a :: t


cons.head
s t, a :: l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h✝: a l✝

b: α

l: List α

ih: a ls t, l = s ++ a :: t

h: Mem a l


cons.tail
s t, b :: l = s ++ a :: t

Goals accomplished! 🐙
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l: List α

h: a l


s t, l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h✝: a l✝

b: α

l: List α

ih: a ls t, l = s ++ a :: t

h: Mem a l


cons.tail
s t, b :: l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h✝: a l✝

b: α

l: List α

ih: a ls t, l = s ++ a :: t

h: Mem a l


cons.tail
s t, b :: l = s ++ a :: t
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l: List α

h✝: a l

b: α

s, t: List α

ih: a s ++ a :: ts_1 t_1, s ++ a :: t = s_1 ++ a :: t_1

h: Mem a (s ++ a :: t)


cons.tail.intro.intro
s_1 t_1, b :: (s ++ a :: t) = s_1 ++ a :: t_1
ι: Type ?u.1166

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

a: α

l✝: List α

h✝: a l✝

b: α

l: List α

ih: a ls t, l = s ++ a :: t

h: Mem a l


cons.tail
s t, b :: l = s ++ a :: t

Goals accomplished! 🐙
#align list.mem_split
List.mem_split: ∀ {α : Type u} {a : α} {l : List α}, a ls t, l = s ++ a :: t
List.mem_split
#align list.mem_of_ne_of_mem
List.mem_of_ne_of_mem: ∀ {α : Type u_1} {a y : α} {l : List α}, a ya y :: la l
List.mem_of_ne_of_mem
#align list.ne_of_not_mem_cons
List.ne_of_not_mem_cons: ∀ {α : Type u_1} {a b : α} {l : List α}, ¬a b :: la b
List.ne_of_not_mem_cons
#align list.not_mem_of_not_mem_cons
List.not_mem_of_not_mem_cons: ∀ {α : Type u_1} {a b : α} {l : List α}, ¬a b :: l¬a l
List.not_mem_of_not_mem_cons
#align list.not_mem_cons_of_ne_of_not_mem
List.not_mem_cons_of_ne_of_not_mem: ∀ {α : Type u_1} {a y : α} {l : List α}, a y¬a l¬a y :: l
List.not_mem_cons_of_ne_of_not_mem
#align list.ne_and_not_mem_of_not_mem_cons
List.ne_and_not_mem_of_not_mem_cons: ∀ {α : Type u_1} {a y : α} {l : List α}, ¬a y :: la y ¬a l
List.ne_and_not_mem_of_not_mem_cons
#align list.mem_map
List.mem_map: ∀ {α : Type u_1} {β : Type u_2} {b : β} {f : αβ} {l : List α}, b map f l a, a l f a = b
List.mem_map
#align list.exists_of_mem_map
List.exists_of_mem_map: ∀ {α : Type u_1} {b : α} {α_1 : Type u_2} {f : α_1α} {l : List α_1}, b map f la, a l f a = b
List.exists_of_mem_map
#align list.mem_map_of_mem
List.mem_map_of_memₓ: ∀ {α : Type u_1} {β : Type u_2} {a : α} {l : List α} (f : αβ), a lf a map f l
List.mem_map_of_memₓ
-- implicits order theorem
mem_map_of_injective: ∀ {α : Type u} {β : Type v} {f : αβ}, Injective f∀ {a : α} {l : List α}, f a map f l a l
mem_map_of_injective
{
f: αβ
f
:
α: Type u
α
β: Type v
β
} (H :
Injective: {α : Sort ?u.1809} → {β : Sort ?u.1808} → (αβ) → Prop
Injective
f: αβ
f
) {
a: α
a
:
α: Type u
α
} {
l: List α
l
:
List: Type ?u.1819 → Type ?u.1819
List
α: Type u
α
} :
f: αβ
f
a: α
a
map: {α : Type ?u.1828} → {β : Type ?u.1827} → (αβ) → List αList β
map
f: αβ
f
l: List α
l
a: α
a
l: List α
l
:= ⟨fun
m: ?m.1873
m
=> let
_: α
_
,
m': w✝ l
m'
,
e: f w✝ = f a
e
⟩ :=
exists_of_mem_map: ∀ {α : Type ?u.1875} {b : α} {α_1 : Type ?u.1876} {f : α_1α} {l : List α_1}, b map f la, a l f a = b
exists_of_mem_map
m: ?m.1873
m
; H
e: f w✝ = f a
e
m': w✝ l
m'
,
mem_map_of_mem: ∀ {α : Type ?u.2063} {β : Type ?u.2064} {a : α} {l : List α} (f : αβ), a lf a map f l
mem_map_of_mem
_: ?m.2065?m.2066
_
#align list.mem_map_of_injective
List.mem_map_of_injective: ∀ {α : Type u} {β : Type v} {f : αβ}, Injective f∀ {a : α} {l : List α}, f a map f l a l
List.mem_map_of_injective
@[simp] theorem
_root_.Function.Involutive.exists_mem_and_apply_eq_iff: ∀ {α : Type u} {f : αα}, Involutive f∀ (x : α) (l : List α), (y, y l f y = x) f x l
_root_.Function.Involutive.exists_mem_and_apply_eq_iff
{
f: αα
f
:
α: Type u
α
α: Type u
α
} (hf :
Function.Involutive: {α : Sort ?u.2132} → (αα) → Prop
Function.Involutive
f: αα
f
) (
x: α
x
:
α: Type u
α
) (
l: List α
l
:
List: Type ?u.2141 → Type ?u.2141
List
α: Type u
α
) : (∃
y: α
y
:
α: Type u
α
,
y: α
y
l: List α
l
f: αα
f
y: α
y
=
x: α
x
) ↔
f: αα
f
x: α
x
l: List α
l
:= ⟨

Goals accomplished! 🐙
ι: Type ?u.2111

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

x: α

l: List α


(y, y l f y = x) → f x l
ι: Type ?u.2111

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

l: List α

y: α

h: y l


intro.intro
f (f y) l
ι: Type ?u.2111

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

l: List α

y: α

h: y l


intro.intro
f (f y) l
ι: Type ?u.2111

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

x: α

l: List α


(y, y l f y = x) → f x l
ι: Type ?u.2111

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

l: List α

y: α

h: y l


intro.intro
f (f y) l
ι: Type ?u.2111

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

l: List α

y: α

h: y l


intro.intro
y l
ι: Type ?u.2111

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

l: List α

y: α

h: y l


intro.intro
y l
, fun
h: ?m.2187
h
=> ⟨
f: αα
f
x: α
x
,
h: ?m.2187
h
, hf
_: α
_
⟩⟩ #align function.involutive.exists_mem_and_apply_eq_iff
Function.Involutive.exists_mem_and_apply_eq_iff: ∀ {α : Type u} {f : αα}, Involutive f∀ (x : α) (l : List α), (y, y l f y = x) f x l
Function.Involutive.exists_mem_and_apply_eq_iff
theorem
mem_map_of_involutive: ∀ {α : Type u} {f : αα}, Involutive f∀ {a : α} {l : List α}, a map f l f a l
mem_map_of_involutive
{
f: αα
f
:
α: Type u
α
α: Type u
α
} (hf :
Involutive: {α : Sort ?u.2342} → (αα) → Prop
Involutive
f: αα
f
) {
a: α
a
:
α: Type u
α
} {
l: List α
l
:
List: Type ?u.2351 → Type ?u.2351
List
α: Type u
α
} :
a: α
a
map: {α : Type ?u.2360} → {β : Type ?u.2359} → (αβ) → List αList β
map
f: αα
f
l: List α
l
f: αα
f
a: α
a
l: List α
l
:=

Goals accomplished! 🐙
ι: Type ?u.2321

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

a: α

l: List α


a map f l f a l
ι: Type ?u.2321

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

a: α

l: List α


a map f l f a l
ι: Type ?u.2321

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

a: α

l: List α


(a_1, a_1 l f a_1 = a) f a l
ι: Type ?u.2321

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

a: α

l: List α


a map f l f a l
ι: Type ?u.2321

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

f: αα

hf: Involutive f

a: α

l: List α


f a l f a l

Goals accomplished! 🐙
#align list.mem_map_of_involutive
List.mem_map_of_involutive: ∀ {α : Type u} {f : αα}, Involutive f∀ {a : α} {l : List α}, a map f l f a l
List.mem_map_of_involutive
#align list.forall_mem_map_iff
List.forall_mem_map_iffₓ: ∀ {α : Type u_1} {β : Type u_2} {f : αβ} {l : List α} {P : βProp}, (∀ (i : β), i map f lP i) ∀ (j : α), j lP (f j)
List.forall_mem_map_iffₓ
-- universe order #align list.map_eq_nil
List.map_eq_nilₓ: ∀ {α : Type u_1} {β : Type u_2} {f : αβ} {l : List α}, map f l = [] l = []
List.map_eq_nilₓ
-- universe order attribute [simp]
List.mem_join: ∀ {α : Type u_1} {a : α} {L : List (List α)}, a join L l, l L a l
List.mem_join
#align list.mem_join
List.mem_join: ∀ {α : Type u_1} {a : α} {L : List (List α)}, a join L l, l L a l
List.mem_join
#align list.exists_of_mem_join
List.exists_of_mem_join: ∀ {α : Type u_1} {a : α} {L : List (List α)}, a join Ll, l L a l
List.exists_of_mem_join
#align list.mem_join_of_mem
List.mem_join_of_memₓ: ∀ {α : Type u_1} {l : List α} {L : List (List α)} {a : α}, l La la join L
List.mem_join_of_memₓ
-- implicits order attribute [simp]
List.mem_bind: ∀ {α : Type u_1} {β : Type u_2} {f : αList β} {b : β} {l : List α}, b List.bind l f a, a l b f a
List.mem_bind
#align list.mem_bind
List.mem_bindₓ: ∀ {α : Type u_1} {β : Type u_2} {f : αList β} {b : β} {l : List α}, b List.bind l f a, a l b f a
List.mem_bindₓ
-- implicits order -- Porting note: bExists in Lean3, And in Lean4 #align list.exists_of_mem_bind
List.exists_of_mem_bindₓ: ∀ {β : Type u_1} {α : Type u_2} {b : β} {l : List α} {f : αList β}, b List.bind l fa, a l b f a
List.exists_of_mem_bindₓ
-- implicits order #align list.mem_bind_of_mem
List.mem_bind_of_memₓ: ∀ {β : Type u_1} {α : Type u_2} {b : β} {l : List α} {f : αList β} {a : α}, a lb f ab List.bind l f
List.mem_bind_of_memₓ
-- implicits order #align list.bind_map
List.bind_mapₓ: ∀ {β : Type u_1} {γ : Type u_2} {α : Type u_3} (f : βγ) (g : αList β) (l : List α), map f (List.bind l g) = List.bind l fun a => map f (g a)
List.bind_mapₓ
-- implicits order theorem
map_bind: ∀ (g : βList γ) (f : αβ) (l : List α), List.bind (map f l) g = List.bind l fun a => g (f a)
map_bind
(
g: βList γ
g
:
β: Type v
β
List: Type ?u.2527 → Type ?u.2527
List
γ: Type w
γ
) (
f: αβ
f
:
α: Type u
α
β: Type v
β
) : ∀
l: List α
l
:
List: Type ?u.2535 → Type ?u.2535
List
α: Type u
α
, (
List.map: {α : Type ?u.2540} → {β : Type ?u.2539} → (αβ) → List αList β
List.map
f: αβ
f
l: List α
l
).
bind: {α : Type ?u.2548} → {β : Type ?u.2547} → List α(αList β) → List β
bind
g: βList γ
g
=
l: List α
l
.
bind: {α : Type ?u.2562} → {β : Type ?u.2561} → List α(αList β) → List β
bind
fun
a: ?m.2570
a
=>
g: βList γ
g
(
f: αβ
f
a: ?m.2570
a
) | [] =>
rfl: ∀ {α : Sort ?u.2594} {a : α}, a = a
rfl
|
a: α
a
::
l: List α
l
=>

Goals accomplished! 🐙
ι: Type ?u.2508

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

g: βList γ

f: αβ

a: α

l: List α


List.bind (map f (a :: l)) g = List.bind (a :: l) fun a => g (f a)

Goals accomplished! 🐙
#align list.map_bind
List.map_bind: ∀ {α : Type u} {β : Type v} {γ : Type w} (g : βList γ) (f : αβ) (l : List α), List.bind (map f l) g = List.bind l fun a => g (f a)
List.map_bind
/-! ### length -/ #align list.length_eq_zero
List.length_eq_zero: ∀ {α : Type u_1} {l : List α}, length l = 0 l = []
List.length_eq_zero
#align list.length_singleton
List.length_singleton: ∀ {α : Type u_1} (a : α), length [a] = 1
List.length_singleton
#align list.length_pos_of_mem
List.length_pos_of_mem: ∀ {α : Type u_1} {a : α} {l : List α}, a l0 < length l
List.length_pos_of_mem
#align list.exists_mem_of_length_pos
List.exists_mem_of_length_pos: ∀ {α : Type u_1} {l : List α}, 0 < length la, a l
List.exists_mem_of_length_pos
#align list.length_pos_iff_exists_mem
List.length_pos_iff_exists_mem: ∀ {α : Type u_1} {l : List α}, 0 < length l a, a l
List.length_pos_iff_exists_mem
alias
length_pos: ∀ {α : Type u_1} {l : List α}, 0 < length l l []
length_pos
ne_nil_of_length_pos: ∀ {α : Type u_1} {l : List α}, 0 < length ll []
ne_nil_of_length_pos
length_pos_of_ne_nil: ∀ {α : Type u_1} {l : List α}, l []0 < length l
length_pos_of_ne_nil
#align list.ne_nil_of_length_pos
List.ne_nil_of_length_pos: ∀ {α : Type u_1} {l : List α}, 0 < length ll []
List.ne_nil_of_length_pos
#align list.length_pos_of_ne_nil
List.length_pos_of_ne_nil: ∀ {α : Type u_1} {l : List α}, l []0 < length l
List.length_pos_of_ne_nil
theorem
length_pos_iff_ne_nil: ∀ {l : List α}, 0 < length l l []
length_pos_iff_ne_nil
{
l: List α
l
:
List: Type ?u.3061 → Type ?u.3061
List
α: Type u
α
} :
0: ?m.3066
0
<
length: {α : Type ?u.3081} → List α
length
l: List α
l
l: List α
l
[]: List ?m.3106
[]
:= ⟨
ne_nil_of_length_pos: ∀ {α : Type ?u.3117} {l : List α}, 0 < length ll []
ne_nil_of_length_pos
,
length_pos_of_ne_nil: ∀ {α : Type ?u.3133} {l : List α}, l []0 < length l
length_pos_of_ne_nil
#align list.length_pos_iff_ne_nil
List.length_pos_iff_ne_nil: ∀ {α : Type u} {l : List α}, 0 < length l l []
List.length_pos_iff_ne_nil
#align list.exists_mem_of_ne_nil
List.exists_mem_of_ne_nil: ∀ {α : Type u_1} (l : List α), l []x, x l
List.exists_mem_of_ne_nil
#align list.length_eq_one
List.length_eq_one: ∀ {α : Type u_1} {l : List α}, length l = 1 a, l = [a]
List.length_eq_one
theorem
exists_of_length_succ: ∀ {n : } (l : List α), length l = n + 1h t, l = h :: t
exists_of_length_succ
{
n:
n
} : ∀
l: List α
l
:
List: Type ?u.3165 → Type ?u.3165
List
α: Type u
α
,
l: List α
l
.
length: {α : Type ?u.3170} → List α
length
=
n: ?m.3161
n
+
1: ?m.3179
1
→ ∃
h: ?m.3244
h
t: ?m.3249
t
,
l: List α
l
=
h: ?m.3244
h
::
t: ?m.3249
t
| [],
H: length [] = n + 1
H
=>
absurd: ∀ {a : Prop} {b : Sort ?u.3320}, a¬ab
absurd
H: length [] = n + 1
H
.
symm: ∀ {α : Sort ?u.3323} {a b : α}, a = bb = a
symm
<|
succ_ne_zero: ∀ (n : ), succ n 0
succ_ne_zero
n:
n
|
h: α
h
::
t: List α
t
, _ => ⟨
h: α
h
,
t: List α
t
,
rfl: ∀ {α : Sort ?u.3397} {a : α}, a = a
rfl
#align list.exists_of_length_succ
List.exists_of_length_succ: ∀ {α : Type u} {n : } (l : List α), length l = n + 1h t, l = h :: t
List.exists_of_length_succ
@[simp] lemma
length_injective_iff: ∀ {α : Type u}, Injective length Subsingleton α
length_injective_iff
:
Injective: {α : Sort ?u.3537} → {β : Sort ?u.3536} → (αβ) → Prop
Injective
(
List.length: {α : Type ?u.3544} → List α
List.length
:
List: Type ?u.3542 → Type ?u.3542
List
α: Type u
α
: Type
) ↔
Subsingleton: Sort ?u.3551 → Prop
Subsingleton
α: Type u
α
:=

Goals accomplished! 🐙
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mp
Injective lengthSubsingleton α
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mpr
Subsingleton αInjective length
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mp
Injective lengthSubsingleton α
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mp
Injective lengthSubsingleton α
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mpr
Subsingleton αInjective length
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

h: Injective length


mp
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

h: Injective length


mp
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mp
Injective lengthSubsingleton α
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

h: Injective length

x, y: α


mp
x = y
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

h: Injective length

x, y: α


mp
x = y
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mp
Injective lengthSubsingleton α
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

h: Injective length

x, y: α


mp
x = y
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

h: Injective length

x, y: α


mp
x = y

Goals accomplished! 🐙
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

h: Injective length

x, y: α


mp
[x] = [y]
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

h: Injective length

x, y: α


mp
[x] = [y]
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mp
Injective lengthSubsingleton α
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

h: Injective length

x, y: α


mp.a
length [x] = length [y]
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

h: Injective length

x, y: α


mp.a
length [x] = length [y]
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mp
Injective lengthSubsingleton α

Goals accomplished! 🐙
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mpr
Subsingleton αInjective length
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mpr
Subsingleton αInjective length
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

l1, l2: List α

hl: length l1 = length l2


mpr
l1 = l2
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mpr
Subsingleton αInjective length
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

l2: List α

hl: length [] = length l2


mpr.nil
[] = l2
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝: α

tail✝: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝ = length l2tail✝ = l2

l2: List α

hl: length (head✝ :: tail✝) = length l2


mpr.cons
head✝ :: tail✝ = l2
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

l1, l2: List α

hl: length l1 = length l2


mpr
l1 = l2
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

l2: List α

hl: length [] = length l2


mpr.nil
[] = l2
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝: α

tail✝: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝ = length l2tail✝ = l2

l2: List α

hl: length (head✝ :: tail✝) = length l2


mpr.cons
head✝ :: tail✝ = l2
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

l1, l2: List α

hl: length l1 = length l2


mpr
l1 = l2
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

hl: length [] = length []


mpr.nil.nil
[] = []
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝: α

tail✝: List α

hl: length [] = length (head✝ :: tail✝)


mpr.nil.cons
[] = head✝ :: tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mpr
Subsingleton αInjective length
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

hl: length [] = length []


mpr.nil.nil
[] = []
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

hl: length [] = length []


mpr.nil.nil
[] = []
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝: α

tail✝: List α

hl: length [] = length (head✝ :: tail✝)


mpr.nil.cons
[] = head✝ :: tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝: α

tail✝: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝ = length l2tail✝ = l2

hl: length (head✝ :: tail✝) = length []


mpr.cons.nil
head✝ :: tail✝ = []
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


mpr.cons.cons
head✝¹ :: tail✝¹ = head✝ :: tail✝

Goals accomplished! 🐙
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mpr
Subsingleton αInjective length
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝: α

tail✝: List α

hl: length [] = length (head✝ :: tail✝)


mpr.nil.cons
[] = head✝ :: tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝: α

tail✝: List α

hl: length [] = length (head✝ :: tail✝)


mpr.nil.cons
[] = head✝ :: tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝: α

tail✝: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝ = length l2tail✝ = l2

hl: length (head✝ :: tail✝) = length []


mpr.cons.nil
head✝ :: tail✝ = []
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


mpr.cons.cons
head✝¹ :: tail✝¹ = head✝ :: tail✝

Goals accomplished! 🐙
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mpr
Subsingleton αInjective length
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝: α

tail✝: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝ = length l2tail✝ = l2

hl: length (head✝ :: tail✝) = length []


mpr.cons.nil
head✝ :: tail✝ = []
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝: α

tail✝: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝ = length l2tail✝ = l2

hl: length (head✝ :: tail✝) = length []


mpr.cons.nil
head✝ :: tail✝ = []
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


mpr.cons.cons
head✝¹ :: tail✝¹ = head✝ :: tail✝

Goals accomplished! 🐙
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α


mpr
Subsingleton αInjective length
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


mpr.cons.cons
head✝¹ :: tail✝¹ = head✝ :: tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


mpr.cons.cons
head✝¹ :: tail✝¹ = head✝ :: tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

tail_ih✝: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


mpr.cons.cons
head✝¹ :: tail✝¹ = head✝ :: tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


e_head
head✝¹ = head✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


e_tail
tail✝¹ = tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


head✝¹ :: tail✝¹ = head✝ :: tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


e_head
head✝¹ = head✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


e_head
head✝¹ = head✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


e_tail
tail✝¹ = tail✝

Goals accomplished! 🐙
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


head✝¹ :: tail✝¹ = head✝ :: tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


e_tail
tail✝¹ = tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


e_tail
tail✝¹ = tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


e_tail.hl
length tail✝¹ = length tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


e_tail.hl
length tail✝¹ = length tail✝
ι: Type ?u.3519

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

: Subsingleton α

head✝¹: α

tail✝¹: List α

ih: ∀ ⦃l2 : List α⦄, length tail✝¹ = length l2tail✝¹ = l2

head✝: α

tail✝: List α

hl: length (head✝¹ :: tail✝¹) = length (head✝ :: tail✝)


e_tail
tail✝¹ = tail✝

Goals accomplished! 🐙
#align list.length_injective_iff
List.length_injective_iff: ∀ {α : Type u}, Injective length Subsingleton α
List.length_injective_iff
@[simp default+1] -- Porting note: this used to be just @[simp] lemma
length_injective: ∀ [inst : Subsingleton α], Injective length
length_injective
[
Subsingleton: Sort ?u.4553 → Prop
Subsingleton
α: Type u
α
] :
Injective: {α : Sort ?u.4557} → {β : Sort ?u.4556} → (αβ) → Prop
Injective
(
length: {α : Type ?u.4564} → List α
length
:
List: Type ?u.4562 → Type ?u.4562
List
α: Type u
α
: Type
) :=
length_injective_iff: ∀ {α : Type ?u.4574}, Injective length Subsingleton α
length_injective_iff
.
mpr: ∀ {a b : Prop}, (a b) → ba
mpr
inferInstance: ∀ {α : Sort ?u.4588} [i : α], α
inferInstance
#align list.length_injective
List.length_injective: ∀ {α : Type u} [inst : Subsingleton α], Injective length
List.length_injective
theorem
length_eq_two: ∀ {l : List α}, length l = 2 a b, l = [a, b]
length_eq_two
{
l: List α
l
:
List: Type ?u.4627 → Type ?u.4627
List
α: Type u
α
} :
l: List α
l
.
length: {α : Type ?u.4631} → List α
length
=
2: ?m.4637
2
↔ ∃
a: ?m.4661
a
b: ?m.4666
b
,
l: List α
l
= [
a: ?m.4661
a
,
b: ?m.4666
b
] := ⟨fun
_: ?m.4723
_
=> let [
a: α
a
,
b: α
b
] :=
l: List α
l
; ⟨
a: α
a
,
b: α
b
,
rfl: ∀ {α : Sort ?u.4812} {a : α}, a = a
rfl
⟩, fun
_: α
_
, _,
e: l = [w✝¹, w✝]
e
⟩ =>
e: l = [w✝¹, w✝]
e
rfl: ∀ {α : Sort ?u.5372} {a : α}, a = a
rfl
#align list.length_eq_two
List.length_eq_two: ∀ {α : Type u} {l : List α}, length l = 2 a b, l = [a, b]
List.length_eq_two
theorem
length_eq_three: ∀ {l : List α}, length l = 3 a b c, l = [a, b, c]
length_eq_three
{
l: List α
l
:
List: Type ?u.5549 → Type ?u.5549
List
α: Type u
α
} :
l: List α
l
.
length: {α : Type ?u.5553} → List α
length
=
3: ?m.5559
3
↔ ∃
a: ?m.5583
a
b: ?m.5588
b
c: ?m.5593
c
,
l: List α
l
= [
a: ?m.5583
a
,
b: ?m.5588
b
,
c: ?m.5593
c
] := ⟨fun
_: ?m.5657
_
=> let [
a: α
a
,
b: α
b
,
c: α
c
] :=
l: List α
l
; ⟨
a: α
a
,
b: α
b
,
c: α
c
,
rfl: ∀ {α : Sort ?u.5774} {a : α}, a = a
rfl
⟩, fun
_: α
_
,
_: α
_
, _,
e: l = [w✝², w✝¹, w✝]
e
⟩ =>
e: l = [w✝², w✝¹, w✝]
e
rfl: ∀ {α : Sort ?u.6561} {a : α}, a = a
rfl
#align list.length_eq_three
List.length_eq_three: ∀ {α : Type u} {l : List α}, length l = 3 a b c, l = [a, b, c]
List.length_eq_three
-- Porting note: Lean 3 core library had the name length_le_of_sublist -- and data.list.basic the command `alias length_le_of_sublist ← sublist.length_le`, -- but Std has the name Sublist.length_le instead. alias
Sublist.length_le: ∀ {α : Type u_1} {l₁ l₂ : List α}, l₁ <+ l₂length l₁ length l₂
Sublist.length_le
length_le_of_sublist: ∀ {α : Type u_1} {l₁ l₂ : List α}, l₁ <+ l₂length l₁ length l₂
length_le_of_sublist
#align list.length_le_of_sublist
List.length_le_of_sublist: ∀ {α : Type u_1} {l₁ l₂ : List α}, l₁ <+ l₂length l₁ length l₂
List.length_le_of_sublist
#align list.sublist.length_le
List.Sublist.length_le: ∀ {α : Type u_1} {l₁ l₂ : List α}, l₁ <+ l₂length l₁ length l₂
List.Sublist.length_le
/-! ### set-theoretic notation of lists -/ -- ADHOC Porting note: instance from Lean3 core
instance: {α : Type u} → Singleton α (List α)
instance
:
Singleton: outParam (Type ?u.6799)Type ?u.6798 → Type (max?u.6799?u.6798)
Singleton
α: Type u
α
(
List: Type ?u.6800 → Type ?u.6800
List
α: Type u
α
) := ⟨fun
x: ?m.6812
x
=> [
x: ?m.6812
x
]⟩ #align list.has_singleton
List.instSingletonList: {α : Type u} → Singleton α (List α)
List.instSingletonList
-- ADHOC Porting note: instance from Lean3 core
instance: {α : Type u} → [inst : DecidableEq α] → Insert α (List α)
instance
[
DecidableEq: Sort ?u.6890 → Sort (max1?u.6890)
DecidableEq
α: Type u
α
] :
Insert: outParam (Type ?u.6900)Type ?u.6899 → Type (max?u.6900?u.6899)
Insert
α: Type u
α
(
List: Type ?u.6901 → Type ?u.6901
List
α: Type u
α
) := ⟨
List.insert: {α : Type ?u.6915} → [inst : DecidableEq α] → αList αList α
List.insert
⟩ -- ADHOC Porting note: instance from Lean3 core
instance: ∀ {α : Type u} [inst : DecidableEq α], IsLawfulSingleton α (List α)
instance
[
DecidableEq: Sort ?u.7087 → Sort (max1?u.7087)
DecidableEq
α: Type u
α
]:
IsLawfulSingleton: (α : Type ?u.7097) → (β : Type ?u.7096) → [inst : EmptyCollection β] → [inst : Insert α β] → [inst : Singleton α β] → Prop
IsLawfulSingleton
α: Type u
α
(
List: Type ?u.7098 → Type ?u.7098
List
α: Type u
α
) := { insert_emptyc_eq := fun
x: ?m.7196
x
=> show (if
x: ?m.7196
x
∈ (
[]: List ?m.7208
[]
:
List: Type ?u.7206 → Type ?u.7206
List
α: Type u
α
) then
[]: List ?m.7223
[]
else [
x: ?m.7196
x
]) = [
x: ?m.7196
x
] from
if_neg: ∀ {c : Prop} {h : Decidable c}, ¬c∀ {α : Sort ?u.7295} {t e : α}, (if c then t else e) = e
if_neg
(
not_mem_nil: ∀ {α : Type ?u.7298} (a : α), ¬a []
not_mem_nil
_: ?m.7299
_
) } #align list.empty_eq
List.empty_eq: ∀ {α : Type u_1}, = []
List.empty_eq
theorem
singleton_eq: ∀ (x : α), {x} = [x]
singleton_eq
(
x: α
x
:
α: Type u
α
) : ({
x: α
x
} :
List: Type ?u.7426 → Type ?u.7426
List
α: Type u
α
) = [
x: α
x
] :=
rfl: ∀ {α : Sort ?u.7457} {a : α}, a = a
rfl
#align list.singleton_eq
List.singleton_eq: ∀ {α : Type u} (x : α), {x} = [x]
List.singleton_eq
theorem
insert_neg: ∀ {α : Type u} [inst : DecidableEq α] {x : α} {l : List α}, ¬x linsert x l = x :: l
insert_neg
[
DecidableEq: Sort ?u.7483 → Sort (max1?u.7483)
DecidableEq
α: Type u
α
] {
x: α
x
:
α: Type u
α
} {
l: List α
l
:
List: Type ?u.7494 → Type ?u.7494
List
α: Type u
α
} (
h: ¬x l
h
:
x: α
x
l: List α
l
) :
Insert.insert: {α : outParam (Type ?u.7516)} → {γ : Type ?u.7515} → [self : Insert α γ] → αγγ
Insert.insert
x: α
x
l: List α
l
=
x: α
x
::
l: List α
l
:=
if_neg: ∀ {c : Prop} {h : Decidable c}, ¬c∀ {α : Sort ?u.7568} {t e : α}, (if c then t else e) = e
if_neg
h: ¬x l
h
#align list.insert_neg
List.insert_neg: ∀ {α : Type u} [inst : DecidableEq α] {x : α} {l : List α}, ¬x linsert x l = x :: l
List.insert_neg
theorem
insert_pos: ∀ [inst : DecidableEq α] {x : α} {l : List α}, x linsert x l = l
insert_pos
[
DecidableEq: Sort ?u.7687 → Sort (max1?u.7687)
DecidableEq
α: Type u
α
] {
x: α
x
:
α: Type u
α
} {
l: List α
l
:
List: Type ?u.7698 → Type ?u.7698
List
α: Type u
α
} (
h: x l
h
:
x: α
x
l: List α
l
) :
Insert.insert: {α : outParam (Type ?u.7730)} → {γ : Type ?u.7729} → [self : Insert α γ] → αγγ
Insert.insert
x: α
x
l: List α
l
=
l: List α
l
:=
if_pos: ∀ {c : Prop} {h : Decidable c}, c∀ {α : Sort ?u.7780} {t e : α}, (if c then t else e) = t
if_pos
h: x l
h
#align list.insert_pos
List.insert_pos: ∀ {α : Type u} [inst : DecidableEq α] {x : α} {l : List α}, x linsert x l = l
List.insert_pos
theorem
doubleton_eq: ∀ [inst : DecidableEq α] {x y : α}, x y{x, y} = [x, y]
doubleton_eq
[
DecidableEq: Sort ?u.7897 → Sort (max1?u.7897)
DecidableEq
α: Type u
α
] {
x: α
x
y: α
y
:
α: Type u
α
} (
h: x y
h
:
x: α
x
y: α
y
) : ({
x: α
x
,
y: α
y
} :
List: Type ?u.7916 → Type ?u.7916
List
α: Type u
α
) = [
x: α
x
,
y: α
y
] :=

Goals accomplished! 🐙
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


{x, y} = [x, y]
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


{x, y} = [x, y]
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


x :: {y} = [x, y]
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


¬x {y}
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


{x, y} = [x, y]
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


[x, y] = [x, y]
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


¬x {y}
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


¬x {y}
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


{x, y} = [x, y]
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


¬x {y}
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


¬x [y]
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


¬x {y}
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


¬x = y
ι: Type ?u.7880

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

inst✝: DecidableEq α

x, y: α

h: x y


¬x = y
#align list.doubleton_eq
List.doubleton_eq: ∀ {α : Type u} [inst : DecidableEq α] {x y : α}, x y{x, y} = [x, y]
List.doubleton_eq
/-! ### bounded quantifiers over lists -/ #align list.forall_mem_nil
List.forall_mem_nil: ∀ {α : Type u_1} (p : αProp) (x : α), x []p x
List.forall_mem_nil
#align list.forall_mem_cons
List.forall_mem_cons: ∀ {α : Type u_1} {p : αProp} {a : α} {l : List α}, (∀ (x : α), x a :: lp x) p a ∀ (x : α), x lp x
List.forall_mem_cons
theorem
forall_mem_of_forall_mem_cons: ∀ {p : αProp} {a : α} {l : List α}, (∀ (x : α), x a :: lp x) → ∀ (x : α), x lp x
forall_mem_of_forall_mem_cons
{
p: αProp
p
:
α: Type u
α
Prop: Type
Prop
} {
a: α
a
:
α: Type u
α
} {
l: List α
l
:
List: Type ?u.8230 → Type ?u.8230
List
α: Type u
α
} (
h: ∀ (x : α), x a :: lp x
h
: ∀
x: ?m.8234
x
a: α
a
::
l: List α
l
,
p: αProp
p
x: ?m.8234
x
) : ∀
x: ?m.8271
x
l: List α
l
,
p: αProp
p
x: ?m.8271
x
:= (
forall_mem_cons: ∀ {α : Type ?u.8304} {p : αProp} {a : α} {l : List α}, (∀ (x : α), x a :: lp x) p a ∀ (x : α), x lp x
forall_mem_cons
.
1: ∀ {a b : Prop}, (a b) → ab
1
h: ∀ (x : α), x a :: lp x
h
).
2: ∀ {a b : Prop}, a bb
2
#align list.forall_mem_of_forall_mem_cons
List.forall_mem_of_forall_mem_cons: ∀ {α : Type u} {p : αProp} {a : α} {l : List α}, (∀ (x : α), x a :: lp x) → ∀ (x : α), x lp x
List.forall_mem_of_forall_mem_cons
#align list.forall_mem_singleton
List.forall_mem_singleton: ∀ {α : Type u_1} {p : αProp} {a : α}, (∀ (x : α), x [a]p x) p a
List.forall_mem_singleton
#align list.forall_mem_append
List.forall_mem_append: ∀ {α : Type u_1} {p : αProp} {l₁ l₂ : List α}, (∀ (x : α), x l₁ ++ l₂p x) (∀ (x : α), x l₁p x) ∀ (x : α), x l₂p x
List.forall_mem_append
theorem
not_exists_mem_nil: ∀ (p : αProp), ¬x, x [] p x
not_exists_mem_nil
(
p: αProp
p
:
α: Type u
α
Prop: Type
Prop
) : ¬∃
x: ?m.8375
x
∈ @
nil: {α : Type ?u.8382} → List α
nil
α: Type u
α
,
p: αProp
p
x: ?m.8375
x
:=
fun.: (x, x [] p x) → False
fun
fun.: (x, x [] p x) → False
.
#align list.not_exists_mem_nil
List.not_exists_mem_nilₓ: ∀ {α : Type u} (p : αProp), ¬x, x [] p x
List.not_exists_mem_nilₓ
-- bExists change -- Porting note: bExists in Lean3 and And in Lean4 theorem
exists_mem_cons_of: ∀ {α : Type u} {p : αProp} {a : α} (l : List α), p ax, x a :: l p x
exists_mem_cons_of
{
p: αProp
p
:
α: Type u
α
Prop: Type
Prop
} {
a: α
a
:
α: Type u
α
} (
l: List α
l
:
List: Type ?u.8600 → Type ?u.8600
List
α: Type u
α
) (
h: p a
h
:
p: αProp
p
a: α
a
) : ∃
x: ?m.8608
x
a: α
a
::
l: List α
l
,
p: αProp
p
x: ?m.8608
x
:= ⟨
a: α
a
,
mem_cons_self: ∀ {α : Type ?u.8656} (a : α) (l : List α), a a :: l
mem_cons_self
_: ?m.8657
_
_: List ?m.8657
_
,
h: p a
h
#align list.exists_mem_cons_of
List.exists_mem_cons_ofₓ: ∀ {α : Type u} {p : αProp} {a : α} (l : List α), p ax, x a :: l p x
List.exists_mem_cons_ofₓ
-- bExists change -- Porting note: bExists in Lean3 and And in Lean4 theorem
exists_mem_cons_of_exists: ∀ {p : αProp} {a : α} {l : List α}, (x, x l p x) → x, x a :: l p x
exists_mem_cons_of_exists
{
p: αProp
p
:
α: Type u
α
Prop: Type
Prop
} {
a: α
a
:
α: Type u
α
} {
l: List α
l
:
List: Type ?u.8700 → Type ?u.8700
List
α: Type u
α
} : (∃
x: ?m.8707
x
l: List α
l
,
p: αProp
p
x: ?m.8707
x
) → ∃
x: ?m.8732
x
a: α
a
::
l: List α
l
,
p: αProp
p
x: ?m.8732
x
:= fun
x: α
x
,
xl: x l
xl
,
px: p x
px
⟩ => ⟨
x: α
x
,
mem_cons_of_mem: ∀ {α : Type ?u.8817} (y : α) {a : α} {l : List α}, a la y :: l
mem_cons_of_mem
_: ?m.8818
_
xl: x l
xl
,
px: p x
px
#align list.exists_mem_cons_of_exists
List.exists_mem_cons_of_existsₓ: ∀ {α : Type u} {p : αProp} {a : α} {l : List α}, (x, x l p x) → x, x a :: l p x
List.exists_mem_cons_of_existsₓ
-- bExists change -- Porting note: bExists in Lean3 and And in Lean4 theorem
or_exists_of_exists_mem_cons: ∀ {p : αProp} {a : α} {l : List α}, (x, x a :: l p x) → p a x, x l p x
or_exists_of_exists_mem_cons
{
p: αProp
p
:
α: Type u
α
Prop: Type
Prop
} {
a: α
a
:
α: Type u
α
} {
l: List α
l
:
List: Type ?u.8960 → Type ?u.8960
List
α: Type u
α
} : (∃
x: ?m.8967
x
a: α
a
::
l: List α
l
,
p: αProp
p
x: ?m.8967
x
) →
p: αProp
p
a: α
a
∨ ∃
x: ?m.8994
x
l: List α
l
,
p: αProp
p
x: ?m.8994
x
:= fun
x: α
x
,
xal: x a :: l
xal
,
px: p x
px
⟩ =>
Or.elim: ∀ {a b c : Prop}, a b(ac) → (bc) → c
Or.elim
(
eq_or_mem_of_mem_cons: ∀ {α : Type ?u.9066} {a b : α} {l : List α}, a b :: la = b a l
eq_or_mem_of_mem_cons
xal: x a :: l
xal
) (fun
h: x = a
h
:
x: α
x
=
a: α
a
=>

Goals accomplished! 🐙
ι: Type ?u.8937

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

p: αProp

a: α

l: List α

x✝: x, x a :: l p x

x: α

xal: x a :: l

px: p x

h: x = a


p a x, x l p x
ι: Type ?u.8937

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

p: αProp

a: α

l: List α

x✝: x, x a :: l p x

x: α

xal: x a :: l

px: p x

h: x = a


p a x, x l p x
ι: Type ?u.8937

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

p: αProp

a: α

l: List α

x✝: x, x a :: l p x

x: α

xal: x a :: l

px: p x

h: x = a


p x x, x l p x
ι: Type ?u.8937

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

p: αProp

a: α

l: List α

x✝: x, x a :: l p x

x: α

xal: x a :: l

px: p x

h: x = a


p x x, x l p x
ι: Type ?u.8937

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

p: αProp

a: α

l: List α

x✝: x, x a :: l p x

x: α

xal: x a :: l

px: p x

h: x = a


p x x, x l p x
ι: Type ?u.8937

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

p: αProp

a: α

l: List α

x✝: x, x a :: l p x

x: α

xal: x a :: l

px: p x

h: x = a


p a x, x l p x
ι: Type ?u.8937

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

p: αProp

a: α

l: List α

x✝: x, x a :: l p x

x: α

xal: x a :: l

px: p x

h: x = a


h
p x
ι: Type ?u.8937

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

p: αProp

a: α

l: List α

x✝: x, x a :: l p x

x: α

xal: x a :: l

px: p x

h: x = a


h
p x
ι: Type ?u.8937

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁, l₂: List α

p: αProp

a: α

l: List α

x✝: x, x a :: l p x

x: α

xal: x a :: l

px: p x

h: x = a


p a x, x l p x

Goals accomplished! 🐙
) fun
h: x l
h
:
x: α
x
l: List α
l
=>
Or.inr: ∀ {a b : Prop}, ba b
Or.inr
x: α
x
,
h: x l
h
,
px: p x
px
#align list.or_exists_of_exists_mem_cons
List.or_exists_of_exists_mem_consₓ: ∀ {α : Type u} {p : αProp} {a : α} {l : List α}, (x, x a :: l p x) → p a x, x l p x
List.or_exists_of_exists_mem_consₓ
-- bExists change theorem
exists_mem_cons_iff: ∀ {α : Type u} (p : αProp) (a : α) (l : List α), (x, x a :: l p x) p a x, x l p x
exists_mem_cons_iff
(
p: αProp
p
:
α: Type u
α
Prop: Type
Prop
) (
a: α
a
:
α: Type u
α
) (
l: List α
l
:
List: Type ?u.9288 → Type ?u.9288
List
α: Type u
α
) : (∃
x: ?m.9294
x
a: α
a
::
l: List α
l
,
p: αProp
p
x: ?m.9294
x
) ↔
p: αProp
p
a: α
a
∨ ∃
x: ?m.9320
x
l: List α
l
,
p: αProp
p
x: ?m.9320
x
:=
Iff.intro: ∀ {a b : Prop}, (ab) → (ba) → (a b)
Iff.intro
or_exists_of_exists_mem_cons: ∀ {α : Type ?u.9345} {p : αProp} {a : α} {l : List α}, (x, x a :: l p x) → p a x, x l p x
or_exists_of_exists_mem_cons
fun
h: ?m.9372
h
=>
Or.elim: ∀ {a b c : Prop}, a b(ac) → (bc) → c
Or.elim
h: ?m.9372
h
(
exists_mem_cons_of: ∀ {α : Type ?u.9377} {p : αProp} {a : α} (l : List α), p ax, x a :: l p x
exists_mem_cons_of
l: List α
l
)
exists_mem_cons_of_exists: ∀ {α : Type ?u.9386} {p : αProp} {a : α} {l : List α}, (x, x l p x) → x, x a :: l p x
exists_mem_cons_of_exists
#align list.exists_mem_cons_iff
List.exists_mem_cons_iff: ∀ {α : Type u} (p : αProp) (a : α) (l : List α), (x, x a :: l p x) p a x, x l p x
List.exists_mem_cons_iff
/-! ### list subset -/
instance: ∀ {α : Type u}, IsTrans (List α) Subset
instance
:
IsTrans: (α : Type ?u.9426) → (ααProp) → Prop
IsTrans
(
List: Type ?u.9427 → Type ?u.9427
List
α: Type u
α
)
Subset: {α : Type ?u.9428} → [self : HasSubset α] → ααProp
Subset
where trans := fun
_: ?m.9460
_
_: ?m.9463
_
_: ?m.9466
_
=>
List.Subset.trans: ∀ {α : Type ?u.9468} {l₁ l₂ l₃ : List α}, l₁ l₂l₂ l₃l₁ l₃
List.Subset.trans
#align list.subset_def
List.subset_def: ∀ {α : Type u_1} {l₁ l₂ : List α}, l₁ l₂ ∀ {a : α}, a l₁a l₂
List.subset_def
#align list.subset_append_of_subset_left
List.subset_append_of_subset_left: ∀ {α : Type u_1} {l l₁ : List α} (l₂ : List α), l l₁l l₁ ++ l₂
List.subset_append_of_subset_left
@[deprecated
subset_append_of_subset_right: ∀ {α : Type u_1} {l l₂ : List α} (l₁ : List α), l l₂l l₁ ++ l₂
subset_append_of_subset_right
] theorem
subset_append_of_subset_right': ∀ {α : Type u} (l l₁ l₂ : List α), l l₂l l₁ ++ l₂
subset_append_of_subset_right'
(
l: List α
l
l₁: List α
l₁
l₂: List α
l₂
:
List: Type ?u.9536 → Type ?u.9536
List
α: Type u
α
) :
l: List α
l
l₂: List α
l₂
l: List α
l
l₁: List α
l₁
++
l₂: List α
l₂
:=
subset_append_of_subset_right: ∀ {α : Type ?u.9610} {l l₂ : List α} (l₁ : List α), l l₂l l₁ ++ l₂
subset_append_of_subset_right
_: List ?m.9611
_
#align list.subset_append_of_subset_right
List.subset_append_of_subset_right': ∀ {α : Type u} (l l₁ l₂ : List α), l l₂l l₁ ++ l₂
List.subset_append_of_subset_right'
#align list.cons_subset
List.cons_subset: ∀ {α : Type u_1} {a : α} {l m : List α}, a :: l m a m l m
List.cons_subset
theorem
cons_subset_of_subset_of_mem: ∀ {a : α} {l m : List α}, a ml ma :: l m
cons_subset_of_subset_of_mem
{
a: α
a
:
α: Type u
α
} {
l: List α
l
m: List α
m
:
List: Type ?u.9656 → Type ?u.9656
List
α: Type u
α
} (
ainm: a m
ainm
:
a: α
a
m: List α
m
) (
lsubm: l m
lsubm
:
l: List α
l
m: List α
m
) :
a: α
a
::
l: List α
l
m: List α
m
:=
cons_subset: ∀ {α : Type ?u.9725} {a : α} {l m : List α}, a :: l m a m l m
cons_subset
.
2: ∀ {a b : Prop}, (a b) → ba
2
ainm: a m
ainm
,
lsubm: l m
lsubm
#align list.cons_subset_of_subset_of_mem
List.cons_subset_of_subset_of_mem: ∀ {α : Type u} {a : α} {l m : List α}, a ml ma :: l m
List.cons_subset_of_subset_of_mem
theorem
append_subset_of_subset_of_subset: ∀ {l₁ l₂ l : List α}, l₁ ll₂ ll₁ ++ l₂ l
append_subset_of_subset_of_subset
{
l₁: List α
l₁
l₂: List α
l₂
l: List α
l
:
List: Type ?u.9779 → Type ?u.9779
List
α: Type u
α
} (
l₁subl: l₁ l
l₁subl
:
l₁: List α
l₁
l: List α
l
) (
l₂subl: l₂ l
l₂subl
:
l₂: List α
l₂
l: List α
l
) :
l₁: List α
l₁
++
l₂: List α
l₂
l: List α
l
:= fun
_: ?m.9870
_
h: ?m.9873
h
↦ (
mem_append: ∀ {α : Type ?u.9875} {a : α} {s t : List α}, a s ++ t a s a t
mem_append
.
1: ∀ {a b : Prop}, (a b) → ab
1
h: ?m.9873
h
).
elim: ∀ {a b c : Prop}, a b(ac) → (bc) → c
elim
(@
l₁subl: l₁ l
l₁subl
_: α
_
) (@
l₂subl: l₂ l
l₂subl
_: α
_
) #align list.append_subset_of_subset_of_subset
List.append_subset_of_subset_of_subset: ∀ {α : Type u} {l₁ l₂ l : List α}, l₁ ll₂ ll₁ ++ l₂ l
List.append_subset_of_subset_of_subset
-- Porting note: in Std #align list.append_subset_iff
List.append_subset: ∀ {α : Type u_1} {l₁ l₂ l : List α}, l₁ ++ l₂ l l₁ l l₂ l
List.append_subset
alias
subset_nil: ∀ {α : Type u_1} {l : List α}, l [] l = []
subset_nil
eq_nil_of_subset_nil: ∀ {α : Type u_1} {l : List α}, l []l = []
eq_nil_of_subset_nil
_ #align list.eq_nil_of_subset_nil
List.eq_nil_of_subset_nil: ∀ {α : Type u_1} {l : List α}, l []l = []
List.eq_nil_of_subset_nil
#align list.eq_nil_iff_forall_not_mem
List.eq_nil_iff_forall_not_mem: ∀ {α : Type u_1} {l : List α}, l = [] ∀ (a : α), ¬a l
List.eq_nil_iff_forall_not_mem
#align list.map_subset
List.map_subset: ∀ {α : Type u_1} {β : Type u_2} {l₁ l₂ : List α} (f : αβ), l₁ l₂map f l₁ map f l₂
List.map_subset
theorem
map_subset_iff: ∀ {l₁ l₂ : List α} (f : αβ), Injective f → (map f l₁ map f l₂ l₁ l₂)
map_subset_iff
{
l₁: List α
l₁
l₂: List α
l₂
:
List: Type ?u.9950 → Type ?u.9950
List
α: Type u
α
} (
f: αβ
f
:
α: Type u
α
β: Type v
β
) (h :
Injective: {α : Sort ?u.9961} → {β : Sort ?u.9960} → (αβ) → Prop
Injective
f: αβ
f
) :
map: {α : Type ?u.9973} → {β : Type ?u.9972} → (αβ) → List αList β
map
f: αβ
f
l₁: List α
l₁
map: {α : Type ?u.9982} → {β : Type ?u.9981} → (αβ) → List αList β
map
f: αβ
f
l₂: List α
l₂
l₁: List α
l₁
l₂: List α
l₂
:=

Goals accomplished! 🐙
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f


map f l₁ map f l₂ l₁ l₂
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f


map f l₁ map f l₂l₁ l₂
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f


map f l₁ map f l₂l₁ l₂
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f


map f l₁ map f l₂ l₁ l₂
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f

h2: map f l₁ map f l₂

x: α

hx: x l₁


x l₂
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f


map f l₁ map f l₂ l₁ l₂
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f

h2: map f l₁ map f l₂

x: α

hx: x l₁

x': α

hx': x' l₂

hxx': f x' = f x


intro.intro
x l₂
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f


map f l₁ map f l₂ l₁ l₂
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f

h2: map f l₁ map f l₂

x: α

hx: x l₁

hx': x l₂

hxx': f x = f x


intro.intro.refl
x l₂
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f

h2: map f l₁ map f l₂

x: α

hx: x l₁

hx': x l₂

hxx': f x = f x


intro.intro.refl
x l₂
ι: Type ?u.9933

α: Type u

β: Type v

γ: Type w

δ: Type x

l₁✝, l₂✝, l₁, l₂: List α

f: αβ

h: Injective f


map f l₁ map f l₂ l₁ l₂

Goals accomplished! 🐙
#align list.map_subset_iff
List.map_subset_iff: ∀ {α : Type u} {β : Type v} {l₁ l₂ : List α} (f : αβ), Injective f → (map f l₁ map f l₂ l₁ l₂)
List.map_subset_iff
/-! ### append -/ theorem
append_eq_has_append: ∀ {α : Type u} {L₁ L₂ : List α}, List.append L₁ L₂ = L₁ ++ L₂
append_eq_has_append
{
L₁: List α
L₁
L₂: List α
L₂
:
List: Type ?u.10285 → Type ?u.10285
List
α: Type u
α
} :
List.append: {α : Type ?u.10292} → List αList αList α
List.append
L₁: List α
L₁
L₂: List α
L₂
=
L₁: List α
L₁
++
L₂: List α
L₂
:=
rfl: ∀ {α : Sort ?u.10339} {a : α}, a = a
rfl
#align list.append_eq_has_append
List.append_eq_has_append: ∀ {α : Type u} {L₁ L₂ : List α}, List.append L₁ L₂ = L₁ ++ L₂
List.append_eq_has_append
#align list.singleton_append
List.singleton_append: ∀ {α : Type u_1} {x : α} {l : List α}, [x] ++ l = x :: l
List.singleton_append
#align list.append_ne_nil_of_ne_nil_left
List.append_ne_nil_of_ne_nil_left: ∀ {α : Type u_1} (s t : List α), s []s ++ t []
List.append_ne_nil_of_ne_nil_left
#align list.append_ne_nil_of_ne_nil_right
List.append_ne_nil_of_ne_nil_right: ∀ {α : Type u_1} (s t : List α), t []s ++ t []
List.append_ne_nil_of_ne_nil_right
#align list.append_eq_nil
List.append_eq_nil: ∀ {α : Type u_1} {p q : List α}, p ++ q = [] p = [] q = []
List.append_eq_nil
-- Porting note: in Std #align list.nil_eq_append_iff
List.nil_eq_append: ∀ {α : Type u_1} {a b : List α}, [] = a ++ b a = [] b = []
List.nil_eq_append
theorem
append_eq_cons_iff: ∀ {a b c : List α} {x : α}, a ++ b = x :: c a = [] b = x :: c a', a = x :: a' c = a' ++ b
append_eq_cons_iff
{
a: List α
a
b: List α
b
c: List α
c
:
List: Type ?u.10372 → Type ?u.10372
List
α: Type u
α
} {
x: α
x
:
α: Type u
α
} :
a: List α
a
++
b: List α
b
=
x: α
x
::
c: List α
c
a: List α
a
=
[]: List ?m.10423
[]
b: List α
b
=
x: α
x
::
c: List α
c
∨ ∃
a': ?m.10458
a'
,
a: List α
a
=
x: α
x
::
a': ?m.10458
a'
c: List α
c
=
a': ?m.10458
a'
++
b: List α
b
:=

Goals accomplished! 🐙