[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β✝ : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α₀ α₁ α₂ β : Type u
f : α₀ → F α₁
f' : α₁ → G α₂
x : t α₀ β
⊢ Comp.mk (tfst f' <$> tfst f x) = tfst (Comp.mk ∘ map f' ∘ f) x
[PROOFSTEP]
rw [← comp_bitraverse]
[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β✝ : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α₀ α₁ α₂ β : Type u
f : α₀ → F α₁
f' : α₁ → G α₂
x : t α₀ β
⊢ bitraverse (Comp.mk ∘ map f' ∘ f) (Comp.mk ∘ map pure ∘ pure) x = tfst (Comp.mk ∘ map f' ∘ f) x
[PROOFSTEP]
simp only [Function.comp, tfst, map_pure, Pure.pure]
[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α₀ α₁ β₀ β₁ : Type u
f : α₀ → F α₁
f' : β₀ → G β₁
x : t α₀ β₀
⊢ Comp.mk (tfst f <$> tsnd f' x) = bitraverse (Comp.mk ∘ pure ∘ f) (Comp.mk ∘ map pure ∘ f') x
[PROOFSTEP]
rw [← comp_bitraverse]
[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α₀ α₁ β₀ β₁ : Type u
f : α₀ → F α₁
f' : β₀ → G β₁
x : t α₀ β₀
⊢ bitraverse (Comp.mk ∘ map f ∘ pure) (Comp.mk ∘ map pure ∘ f') x =
    bitraverse (Comp.mk ∘ pure ∘ f) (Comp.mk ∘ map pure ∘ f') x
[PROOFSTEP]
simp only [Function.comp, map_pure]
[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α₀ α₁ β₀ β₁ : Type u
f : α₀ → F α₁
f' : β₀ → G β₁
x : t α₀ β₀
⊢ Comp.mk (tsnd f' <$> tfst f x) = bitraverse (Comp.mk ∘ map pure ∘ f) (Comp.mk ∘ pure ∘ f') x
[PROOFSTEP]
rw [← comp_bitraverse]
[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α₀ α₁ β₀ β₁ : Type u
f : α₀ → F α₁
f' : β₀ → G β₁
x : t α₀ β₀
⊢ bitraverse (Comp.mk ∘ map pure ∘ f) (Comp.mk ∘ map f' ∘ pure) x =
    bitraverse (Comp.mk ∘ map pure ∘ f) (Comp.mk ∘ pure ∘ f') x
[PROOFSTEP]
simp only [Function.comp, map_pure]
[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α β₀ β₁ β₂ : Type u
g : β₀ → F β₁
g' : β₁ → G β₂
x : t α β₀
⊢ Comp.mk (tsnd g' <$> tsnd g x) = tsnd (Comp.mk ∘ map g' ∘ g) x
[PROOFSTEP]
rw [← comp_bitraverse]
[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α β₀ β₁ β₂ : Type u
g : β₀ → F β₁
g' : β₁ → G β₂
x : t α β₀
⊢ bitraverse (Comp.mk ∘ map pure ∘ pure) (Comp.mk ∘ map g' ∘ g) x = tsnd (Comp.mk ∘ map g' ∘ g) x
[PROOFSTEP]
simp only [Function.comp, map_pure]
[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α β₀ β₁ β₂ : Type u
g : β₀ → F β₁
g' : β₁ → G β₂
x : t α β₀
⊢ bitraverse (fun x => Comp.mk (pure (pure x))) (fun x => Comp.mk (g' <$> g x)) x =
    tsnd (fun x => Comp.mk (g' <$> g x)) x
[PROOFSTEP]
rfl
[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β✝ : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α α' β : Type u
f : α → α'
x : t α β
⊢ tfst (pure ∘ f) x = pure (fst f x)
[PROOFSTEP]
apply bitraverse_eq_bimap_id
[GOAL]
t : Type u → Type u → Type u
inst✝⁵ : Bitraversable t
β✝ : Type u
F G : Type u → Type u
inst✝⁴ : Applicative F
inst✝³ : Applicative G
inst✝² : LawfulBitraversable t
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α β β' : Type u
f : β → β'
x : t α β
⊢ tsnd (pure ∘ f) x = pure (snd f x)
[PROOFSTEP]
apply bitraverse_eq_bimap_id


[GOAL]
α : Type u_1
inst✝ : DecidableEq α
a : α
as : List α
x : α
⊢ x ∈ List.insert a as ↔ x ∈ a :: as
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
as bs : List α
x : α
⊢ x ∈ as ∪ bs ↔ x ∈ as ++ bs
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b : α
as : List α
⊢ b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
[PROOFSTEP]
induction as with
| nil => simp [remove]
| cons a' as ih =>
  simp [remove]
  cases Decidable.em (a = a') with
  | inl h =>
    simp only [if_pos h, ih]
    exact ⟨fun ⟨h1, h2⟩ ↦ ⟨Or.inr h1, h2⟩, fun ⟨h1, h2⟩ ↦ ⟨Or.resolve_left h1 (h ▸ h2), h2⟩⟩
  | inr h =>
    simp [if_neg h, ih]
    constructor
    {focus
        intro h'
        cases h' with
        | inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
        | inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
    }
    intro ⟨h1, h2⟩
    cases h1 with
    | inl h1' => exact Or.inl h1'
    | inr h1' => exact Or.inr ⟨h1', h2⟩
[GOAL]
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b : α
as : List α
⊢ b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
[PROOFSTEP]
induction as with
| nil => simp [remove]
| cons a' as ih =>
  simp [remove]
  cases Decidable.em (a = a') with
  | inl h =>
    simp only [if_pos h, ih]
    exact ⟨fun ⟨h1, h2⟩ ↦ ⟨Or.inr h1, h2⟩, fun ⟨h1, h2⟩ ↦ ⟨Or.resolve_left h1 (h ▸ h2), h2⟩⟩
  | inr h =>
    simp [if_neg h, ih]
    constructor
    {focus
        intro h'
        cases h' with
        | inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
        | inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
    }
    intro ⟨h1, h2⟩
    cases h1 with
    | inl h1' => exact Or.inl h1'
    | inr h1' => exact Or.inr ⟨h1', h2⟩
[GOAL]
case nil
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b : α
⊢ b ∈ remove a [] ↔ b ∈ [] ∧ b ≠ a
[PROOFSTEP]

| nil => simp [remove]
[GOAL]
case nil
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b : α
⊢ b ∈ remove a [] ↔ b ∈ [] ∧ b ≠ a
[PROOFSTEP]
simp [remove]
[GOAL]
case cons
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
⊢ b ∈ remove a (a' :: as) ↔ b ∈ a' :: as ∧ b ≠ a
[PROOFSTEP]

| cons a' as ih =>
  simp [remove]
  cases Decidable.em (a = a') with
  | inl h =>
    simp only [if_pos h, ih]
    exact ⟨fun ⟨h1, h2⟩ ↦ ⟨Or.inr h1, h2⟩, fun ⟨h1, h2⟩ ↦ ⟨Or.resolve_left h1 (h ▸ h2), h2⟩⟩
  | inr h =>
    simp [if_neg h, ih]
    constructor
    {focus
        intro h'
        cases h' with
        | inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
        | inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
    }
    intro ⟨h1, h2⟩
    cases h1 with
    | inl h1' => exact Or.inl h1'
    | inr h1' => exact Or.inr ⟨h1', h2⟩
[GOAL]
case cons
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
⊢ b ∈ remove a (a' :: as) ↔ b ∈ a' :: as ∧ b ≠ a
[PROOFSTEP]
simp [remove]
[GOAL]
case cons
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
⊢ (b ∈ if a = a' then remove a as else a' :: remove a as) ↔ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
cases Decidable.em (a = a') with
| inl h =>
  simp only [if_pos h, ih]
  exact ⟨fun ⟨h1, h2⟩ ↦ ⟨Or.inr h1, h2⟩, fun ⟨h1, h2⟩ ↦ ⟨Or.resolve_left h1 (h ▸ h2), h2⟩⟩
| inr h =>
  simp [if_neg h, ih]
  constructor
  {focus
      intro h'
      cases h' with
      | inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
      | inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
  }
  intro ⟨h1, h2⟩
  cases h1 with
  | inl h1' => exact Or.inl h1'
  | inr h1' => exact Or.inr ⟨h1', h2⟩
[GOAL]
case cons
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
x✝ : a = a' ∨ ¬a = a'
⊢ (b ∈ if a = a' then remove a as else a' :: remove a as) ↔ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
cases Decidable.em (a = a') with
| inl h =>
  simp only [if_pos h, ih]
  exact ⟨fun ⟨h1, h2⟩ ↦ ⟨Or.inr h1, h2⟩, fun ⟨h1, h2⟩ ↦ ⟨Or.resolve_left h1 (h ▸ h2), h2⟩⟩
| inr h =>
  simp [if_neg h, ih]
  constructor
  {focus
      intro h'
      cases h' with
      | inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
      | inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
  }
  intro ⟨h1, h2⟩
  cases h1 with
  | inl h1' => exact Or.inl h1'
  | inr h1' => exact Or.inr ⟨h1', h2⟩
[GOAL]
case cons.inl
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : a = a'
⊢ (b ∈ if a = a' then remove a as else a' :: remove a as) ↔ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]

| inl h =>
  simp only [if_pos h, ih]
  exact ⟨fun ⟨h1, h2⟩ ↦ ⟨Or.inr h1, h2⟩, fun ⟨h1, h2⟩ ↦ ⟨Or.resolve_left h1 (h ▸ h2), h2⟩⟩
[GOAL]
case cons.inl
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : a = a'
⊢ (b ∈ if a = a' then remove a as else a' :: remove a as) ↔ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
simp only [if_pos h, ih]
[GOAL]
case cons.inl
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : a = a'
⊢ b ∈ as ∧ b ≠ a ↔ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
exact ⟨fun ⟨h1, h2⟩ ↦ ⟨Or.inr h1, h2⟩, fun ⟨h1, h2⟩ ↦ ⟨Or.resolve_left h1 (h ▸ h2), h2⟩⟩
[GOAL]
case cons.inr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
⊢ (b ∈ if a = a' then remove a as else a' :: remove a as) ↔ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]

| inr h =>
  simp [if_neg h, ih]
  constructor
  {focus
      intro h'
      cases h' with
      | inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
      | inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
  }
  intro ⟨h1, h2⟩
  cases h1 with
  | inl h1' => exact Or.inl h1'
  | inr h1' => exact Or.inr ⟨h1', h2⟩
[GOAL]
case cons.inr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
⊢ (b ∈ if a = a' then remove a as else a' :: remove a as) ↔ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
simp [if_neg h, ih]
[GOAL]
case cons.inr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
⊢ b = a' ∨ b ∈ as ∧ ¬b = a ↔ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
constructor
[GOAL]
case cons.inr.mp
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
⊢ b = a' ∨ b ∈ as ∧ ¬b = a → (b = a' ∨ b ∈ as) ∧ ¬b = a
case cons.inr.mpr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
⊢ (b = a' ∨ b ∈ as) ∧ ¬b = a → b = a' ∨ b ∈ as ∧ ¬b = a
[PROOFSTEP]
{focus
    intro h'
    cases h' with
    | inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
    | inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
}
[GOAL]
case cons.inr.mp
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
⊢ b = a' ∨ b ∈ as ∧ ¬b = a → (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
focus
  intro h'
  cases h' with
  | inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
  | inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
[GOAL]
case cons.inr.mp
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
⊢ b = a' ∨ b ∈ as ∧ ¬b = a → (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
intro h'
[GOAL]
case cons.inr.mp
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h' : b = a' ∨ b ∈ as ∧ ¬b = a
⊢ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
cases h' with
| inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
| inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
[GOAL]
case cons.inr.mp
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h' : b = a' ∨ b ∈ as ∧ ¬b = a
⊢ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
cases h' with
| inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
| inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
[GOAL]
case cons.inr.mp.inl
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h₁ : b = a'
⊢ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]

| inl h₁ => exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
[GOAL]
case cons.inr.mp.inl
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h₁ : b = a'
⊢ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
exact ⟨Or.inl h₁, h₁.symm ▸ (Ne.symm h)⟩
[GOAL]
case cons.inr.mp.inr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h₁ : b ∈ as ∧ ¬b = a
⊢ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]

| inr h₁ => exact ⟨Or.inr h₁.1, h₁.2⟩
[GOAL]
case cons.inr.mp.inr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h₁ : b ∈ as ∧ ¬b = a
⊢ (b = a' ∨ b ∈ as) ∧ ¬b = a
[PROOFSTEP]
exact ⟨Or.inr h₁.1, h₁.2⟩
[GOAL]
case cons.inr.mpr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
⊢ (b = a' ∨ b ∈ as) ∧ ¬b = a → b = a' ∨ b ∈ as ∧ ¬b = a
[PROOFSTEP]
intro ⟨h1, h2⟩
[GOAL]
case cons.inr.mpr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h1 : b = a' ∨ b ∈ as
h2 : ¬b = a
⊢ b = a' ∨ b ∈ as ∧ ¬b = a
[PROOFSTEP]
cases h1 with
| inl h1' => exact Or.inl h1'
| inr h1' => exact Or.inr ⟨h1', h2⟩
[GOAL]
case cons.inr.mpr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h1 : b = a' ∨ b ∈ as
h2 : ¬b = a
⊢ b = a' ∨ b ∈ as ∧ ¬b = a
[PROOFSTEP]
cases h1 with
| inl h1' => exact Or.inl h1'
| inr h1' => exact Or.inr ⟨h1', h2⟩
[GOAL]
case cons.inr.mpr.inl
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h2 : ¬b = a
h1' : b = a'
⊢ b = a' ∨ b ∈ as ∧ ¬b = a
[PROOFSTEP]

| inl h1' => exact Or.inl h1'
[GOAL]
case cons.inr.mpr.inl
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h2 : ¬b = a
h1' : b = a'
⊢ b = a' ∨ b ∈ as ∧ ¬b = a
[PROOFSTEP]
exact Or.inl h1'
[GOAL]
case cons.inr.mpr.inr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h2 : ¬b = a
h1' : b ∈ as
⊢ b = a' ∨ b ∈ as ∧ ¬b = a
[PROOFSTEP]

| inr h1' => exact Or.inr ⟨h1', h2⟩
[GOAL]
case cons.inr.mpr.inr
α : Type u_1
β : Sort ?u.8926
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b a' : α
as : List α
ih : b ∈ remove a as ↔ b ∈ as ∧ b ≠ a
h : ¬a = a'
h2 : ¬b = a
h1' : b ∈ as
⊢ b = a' ∨ b ∈ as ∧ ¬b = a
[PROOFSTEP]
exact Or.inr ⟨h1', h2⟩
[GOAL]
α : Type u_1
β : Sort ?u.19025
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
x✝ : ¬a ∈ []
⊢ remove a [] = []
[PROOFSTEP]
simp [remove]
[GOAL]
α : Type u_1
β : Sort ?u.19025
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : ¬a ∈ a' :: as
⊢ remove a (a' :: as) = a' :: as
[PROOFSTEP]
have h1 : a ≠ a' := fun h' ↦ h (by rw [h']; apply mem_cons_self)
[GOAL]
α : Type u_1
β : Sort ?u.19025
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : ¬a ∈ a' :: as
h' : a = a'
⊢ a ∈ a' :: as
[PROOFSTEP]
rw [h']
[GOAL]
α : Type u_1
β : Sort ?u.19025
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : ¬a ∈ a' :: as
h' : a = a'
⊢ a' ∈ a' :: as
[PROOFSTEP]
apply mem_cons_self
[GOAL]
α : Type u_1
β : Sort ?u.19025
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : ¬a ∈ a' :: as
h1 : a ≠ a'
⊢ remove a (a' :: as) = a' :: as
[PROOFSTEP]
have h2 : a ∉ as := fun h' ↦ h (mem_cons_of_mem _ h')
[GOAL]
α : Type u_1
β : Sort ?u.19025
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : ¬a ∈ a' :: as
h1 : a ≠ a'
h2 : ¬a ∈ as
⊢ remove a (a' :: as) = a' :: as
[PROOFSTEP]
simp [remove, h1, remove_eq_of_not_mem h2]
[GOAL]
α : Type u_1
β : Sort ?u.19685
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b : α
as : List α
h : b ∈ remove a as
⊢ b ∈ as
[PROOFSTEP]
rw [mem_remove_iff] at h
[GOAL]
α : Type u_1
β : Sort ?u.19685
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a b : α
as : List α
h : b ∈ as ∧ b ≠ a
⊢ b ∈ as
[PROOFSTEP]
exact
  h.1
    /- card -/
[GOAL]
α : Type u_1
β : Sort ?u.20767
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as : List α
h : a ∈ as
⊢ card (a :: as) = card as
[PROOFSTEP]
simp [card, h]
[GOAL]
α : Type u_1
β : Sort ?u.21944
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as : List α
h : ¬a ∈ as
⊢ card (a :: as) = card as + 1
[PROOFSTEP]
simp [card, h]
[GOAL]
α : Type u_1
β : Sort ?u.22769
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as : List α
⊢ card as ≤ card (a :: as)
[PROOFSTEP]
cases Decidable.em (a ∈ as) with
| inl h => simp [h, Nat.le_refl]
| inr h => simp [h, Nat.le_succ]
[GOAL]
α : Type u_1
β : Sort ?u.22769
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as : List α
x✝ : a ∈ as ∨ ¬a ∈ as
⊢ card as ≤ card (a :: as)
[PROOFSTEP]
cases Decidable.em (a ∈ as) with
| inl h => simp [h, Nat.le_refl]
| inr h => simp [h, Nat.le_succ]
[GOAL]
case inl
α : Type u_1
β : Sort ?u.22769
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as : List α
h : a ∈ as
⊢ card as ≤ card (a :: as)
[PROOFSTEP]

| inl h => simp [h, Nat.le_refl]
[GOAL]
case inl
α : Type u_1
β : Sort ?u.22769
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as : List α
h : a ∈ as
⊢ card as ≤ card (a :: as)
[PROOFSTEP]
simp [h, Nat.le_refl]
[GOAL]
case inr
α : Type u_1
β : Sort ?u.22769
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as : List α
h : ¬a ∈ as
⊢ card as ≤ card (a :: as)
[PROOFSTEP]

| inr h => simp [h, Nat.le_succ]
[GOAL]
case inr
α : Type u_1
β : Sort ?u.22769
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as : List α
h : ¬a ∈ as
⊢ card as ≤ card (a :: as)
[PROOFSTEP]
simp [h, Nat.le_succ]
[GOAL]
α : Type u_1
β : Sort ?u.25043
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as : List α
h : a ∈ as
⊢ card (List.insert a as) = card as
[PROOFSTEP]
simp [h]
[GOAL]
α : Type u_1
β : Sort ?u.25854
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as : List α
h : ¬a ∈ as
⊢ card (List.insert a as) = card as + 1
[PROOFSTEP]
simp [h]
[GOAL]
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1
[PROOFSTEP]
cases Decidable.em (a = a') with
| inl h' =>
  simp [remove, if_pos h']
  cases Decidable.em (a ∈ as) with
  | inl h'' =>
    have h₃ : a' ∈ as := h' ▸ h''
    simp [card_remove_of_mem h'', h₃]
  | inr h'' =>
    have h₃ : a' ∉ as := h' ▸ h''
    simp [card_cons_of_not_mem h₃, remove_eq_of_not_mem h'']
| inr h' =>
  have h₃ : a ∈ as := (mem_cons.1 h).resolve_left h'
  simp [remove, h']
  cases Decidable.em (a' ∈ as) with
  | inl h'' =>
    have : a' ∈ remove a as := by rw [mem_remove_iff]; exact ⟨h'', Ne.symm h'⟩
    simp [h'', this, card_remove_of_mem h₃]
  | inr h'' =>
    have : a' ∉ remove a as := fun h ↦ h'' (mem_of_mem_remove h)
    simp [h'', this, card_remove_of_mem h₃]
[GOAL]
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
x✝ : a = a' ∨ ¬a = a'
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1
[PROOFSTEP]
cases Decidable.em (a = a') with
| inl h' =>
  simp [remove, if_pos h']
  cases Decidable.em (a ∈ as) with
  | inl h'' =>
    have h₃ : a' ∈ as := h' ▸ h''
    simp [card_remove_of_mem h'', h₃]
  | inr h'' =>
    have h₃ : a' ∉ as := h' ▸ h''
    simp [card_cons_of_not_mem h₃, remove_eq_of_not_mem h'']
| inr h' =>
  have h₃ : a ∈ as := (mem_cons.1 h).resolve_left h'
  simp [remove, h']
  cases Decidable.em (a' ∈ as) with
  | inl h'' =>
    have : a' ∈ remove a as := by rw [mem_remove_iff]; exact ⟨h'', Ne.symm h'⟩
    simp [h'', this, card_remove_of_mem h₃]
  | inr h'' =>
    have : a' ∉ remove a as := fun h ↦ h'' (mem_of_mem_remove h)
    simp [h'', this, card_remove_of_mem h₃]
[GOAL]
case inl
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1
[PROOFSTEP]

| inl h' =>
  simp [remove, if_pos h']
  cases Decidable.em (a ∈ as) with
  | inl h'' =>
    have h₃ : a' ∈ as := h' ▸ h''
    simp [card_remove_of_mem h'', h₃]
  | inr h'' =>
    have h₃ : a' ∉ as := h' ▸ h''
    simp [card_cons_of_not_mem h₃, remove_eq_of_not_mem h'']
[GOAL]
case inl
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1
[PROOFSTEP]
simp [remove, if_pos h']
[GOAL]
case inl
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
⊢ card (a' :: as) = card (remove a as) + 1
[PROOFSTEP]
cases Decidable.em (a ∈ as) with
| inl h'' =>
  have h₃ : a' ∈ as := h' ▸ h''
  simp [card_remove_of_mem h'', h₃]
| inr h'' =>
  have h₃ : a' ∉ as := h' ▸ h''
  simp [card_cons_of_not_mem h₃, remove_eq_of_not_mem h'']
[GOAL]
case inl
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
x✝ : a ∈ as ∨ ¬a ∈ as
⊢ card (a' :: as) = card (remove a as) + 1
[PROOFSTEP]
cases Decidable.em (a ∈ as) with
| inl h'' =>
  have h₃ : a' ∈ as := h' ▸ h''
  simp [card_remove_of_mem h'', h₃]
| inr h'' =>
  have h₃ : a' ∉ as := h' ▸ h''
  simp [card_cons_of_not_mem h₃, remove_eq_of_not_mem h'']
[GOAL]
case inl.inl
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
h'' : a ∈ as
⊢ card (a' :: as) = card (remove a as) + 1
[PROOFSTEP]

| inl h'' =>
  have h₃ : a' ∈ as := h' ▸ h''
  simp [card_remove_of_mem h'', h₃]
[GOAL]
case inl.inl
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
h'' : a ∈ as
⊢ card (a' :: as) = card (remove a as) + 1
[PROOFSTEP]
have h₃ : a' ∈ as := h' ▸ h''
[GOAL]
case inl.inl
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
h'' : a ∈ as
h₃ : a' ∈ as
⊢ card (a' :: as) = card (remove a as) + 1
[PROOFSTEP]
simp [card_remove_of_mem h'', h₃]
[GOAL]
case inl.inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
h'' : ¬a ∈ as
⊢ card (a' :: as) = card (remove a as) + 1
[PROOFSTEP]

| inr h'' =>
  have h₃ : a' ∉ as := h' ▸ h''
  simp [card_cons_of_not_mem h₃, remove_eq_of_not_mem h'']
[GOAL]
case inl.inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
h'' : ¬a ∈ as
⊢ card (a' :: as) = card (remove a as) + 1
[PROOFSTEP]
have h₃ : a' ∉ as := h' ▸ h''
[GOAL]
case inl.inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
h'' : ¬a ∈ as
h₃ : ¬a' ∈ as
⊢ card (a' :: as) = card (remove a as) + 1
[PROOFSTEP]
simp [card_cons_of_not_mem h₃, remove_eq_of_not_mem h'']
[GOAL]
case inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1
[PROOFSTEP]

| inr h' =>
  have h₃ : a ∈ as := (mem_cons.1 h).resolve_left h'
  simp [remove, h']
  cases Decidable.em (a' ∈ as) with
  | inl h'' =>
    have : a' ∈ remove a as := by rw [mem_remove_iff]; exact ⟨h'', Ne.symm h'⟩
    simp [h'', this, card_remove_of_mem h₃]
  | inr h'' =>
    have : a' ∉ remove a as := fun h ↦ h'' (mem_of_mem_remove h)
    simp [h'', this, card_remove_of_mem h₃]
[GOAL]
case inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1
[PROOFSTEP]
have h₃ : a ∈ as := (mem_cons.1 h).resolve_left h'
[GOAL]
case inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1
[PROOFSTEP]
simp [remove, h']
[GOAL]
case inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
⊢ card (a' :: as) = card (a' :: remove a as) + 1
[PROOFSTEP]
cases Decidable.em (a' ∈ as) with
| inl h'' =>
  have : a' ∈ remove a as := by rw [mem_remove_iff]; exact ⟨h'', Ne.symm h'⟩
  simp [h'', this, card_remove_of_mem h₃]
| inr h'' =>
  have : a' ∉ remove a as := fun h ↦ h'' (mem_of_mem_remove h)
  simp [h'', this, card_remove_of_mem h₃]
[GOAL]
case inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
x✝ : a' ∈ as ∨ ¬a' ∈ as
⊢ card (a' :: as) = card (a' :: remove a as) + 1
[PROOFSTEP]
cases Decidable.em (a' ∈ as) with
| inl h'' =>
  have : a' ∈ remove a as := by rw [mem_remove_iff]; exact ⟨h'', Ne.symm h'⟩
  simp [h'', this, card_remove_of_mem h₃]
| inr h'' =>
  have : a' ∉ remove a as := fun h ↦ h'' (mem_of_mem_remove h)
  simp [h'', this, card_remove_of_mem h₃]
[GOAL]
case inr.inl
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : a' ∈ as
⊢ card (a' :: as) = card (a' :: remove a as) + 1
[PROOFSTEP]

| inl h'' =>
  have : a' ∈ remove a as := by rw [mem_remove_iff]; exact ⟨h'', Ne.symm h'⟩
  simp [h'', this, card_remove_of_mem h₃]
[GOAL]
case inr.inl
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : a' ∈ as
⊢ card (a' :: as) = card (a' :: remove a as) + 1
[PROOFSTEP]
have : a' ∈ remove a as := by rw [mem_remove_iff]; exact ⟨h'', Ne.symm h'⟩
[GOAL]
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : a' ∈ as
⊢ a' ∈ remove a as
[PROOFSTEP]
rw [mem_remove_iff]
[GOAL]
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : a' ∈ as
⊢ a' ∈ as ∧ a' ≠ a
[PROOFSTEP]
exact ⟨h'', Ne.symm h'⟩
[GOAL]
case inr.inl
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : a' ∈ as
this : a' ∈ remove a as
⊢ card (a' :: as) = card (a' :: remove a as) + 1
[PROOFSTEP]
simp [h'', this, card_remove_of_mem h₃]
[GOAL]
case inr.inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : ¬a' ∈ as
⊢ card (a' :: as) = card (a' :: remove a as) + 1
[PROOFSTEP]

| inr h'' =>
  have : a' ∉ remove a as := fun h ↦ h'' (mem_of_mem_remove h)
  simp [h'', this, card_remove_of_mem h₃]
[GOAL]
case inr.inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : ¬a' ∈ as
⊢ card (a' :: as) = card (a' :: remove a as) + 1
[PROOFSTEP]
have : a' ∉ remove a as := fun h ↦ h'' (mem_of_mem_remove h)
[GOAL]
case inr.inr
α : Type u_1
β : Sort ?u.27827
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : ¬a' ∈ as
this : ¬a' ∈ remove a as
⊢ card (a' :: as) = card (a' :: remove a as) + 1
[PROOFSTEP]
simp [h'', this, card_remove_of_mem h₃]
[GOAL]
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
bs : List α
x✝ : [] ⊆ bs
⊢ card [] ≤ card bs
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
⊢ card (a :: as) ≤ card bs
[PROOFSTEP]
cases Decidable.em (a ∈ as) with
| inl h' =>
  have hsub' : as ⊆ bs := fun _ xmem ↦ hsub (mem_cons_of_mem a xmem)
  simp [h', card_subset_le hsub']
| inr h' =>
  have : a ∈ bs := hsub (Mem.head ..)
  rw [card_cons_of_not_mem h', card_remove_of_mem this]
  apply Nat.add_le_add_right
  apply card_subset_le
  intro x xmem
  rw [mem_remove_iff]
  exact ⟨hsub (mem_cons_of_mem _ xmem), fun h ↦ h' (h ▸ xmem)⟩
[GOAL]
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
x✝ : a ∈ as ∨ ¬a ∈ as
⊢ card (a :: as) ≤ card bs
[PROOFSTEP]
cases Decidable.em (a ∈ as) with
| inl h' =>
  have hsub' : as ⊆ bs := fun _ xmem ↦ hsub (mem_cons_of_mem a xmem)
  simp [h', card_subset_le hsub']
| inr h' =>
  have : a ∈ bs := hsub (Mem.head ..)
  rw [card_cons_of_not_mem h', card_remove_of_mem this]
  apply Nat.add_le_add_right
  apply card_subset_le
  intro x xmem
  rw [mem_remove_iff]
  exact ⟨hsub (mem_cons_of_mem _ xmem), fun h ↦ h' (h ▸ xmem)⟩
[GOAL]
case inl
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : a ∈ as
⊢ card (a :: as) ≤ card bs
[PROOFSTEP]

| inl h' =>
  have hsub' : as ⊆ bs := fun _ xmem ↦ hsub (mem_cons_of_mem a xmem)
  simp [h', card_subset_le hsub']
[GOAL]
case inl
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : a ∈ as
⊢ card (a :: as) ≤ card bs
[PROOFSTEP]
have hsub' : as ⊆ bs := fun _ xmem ↦ hsub (mem_cons_of_mem a xmem)
[GOAL]
case inl
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : a ∈ as
hsub' : as ⊆ bs
⊢ card (a :: as) ≤ card bs
[PROOFSTEP]
simp [h', card_subset_le hsub']
[GOAL]
case inr
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
⊢ card (a :: as) ≤ card bs
[PROOFSTEP]

| inr h' =>
  have : a ∈ bs := hsub (Mem.head ..)
  rw [card_cons_of_not_mem h', card_remove_of_mem this]
  apply Nat.add_le_add_right
  apply card_subset_le
  intro x xmem
  rw [mem_remove_iff]
  exact ⟨hsub (mem_cons_of_mem _ xmem), fun h ↦ h' (h ▸ xmem)⟩
[GOAL]
case inr
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
⊢ card (a :: as) ≤ card bs
[PROOFSTEP]
have : a ∈ bs := hsub (Mem.head ..)
[GOAL]
case inr
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
this : a ∈ bs
⊢ card (a :: as) ≤ card bs
[PROOFSTEP]
rw [card_cons_of_not_mem h', card_remove_of_mem this]
[GOAL]
case inr
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
this : a ∈ bs
⊢ card as + 1 ≤ card (remove a bs) + 1
[PROOFSTEP]
apply Nat.add_le_add_right
[GOAL]
case inr.h
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
this : a ∈ bs
⊢ card as ≤ card (remove a bs)
[PROOFSTEP]
apply card_subset_le
[GOAL]
case inr.h.a
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
this : a ∈ bs
⊢ as ⊆ remove a bs
[PROOFSTEP]
intro x xmem
[GOAL]
case inr.h.a
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
this : a ∈ bs
x : α
xmem : x ∈ as
⊢ x ∈ remove a bs
[PROOFSTEP]
rw [mem_remove_iff]
[GOAL]
case inr.h.a
α : Type u_1
β : Sort ?u.43663
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
this : a ∈ bs
x : α
xmem : x ∈ as
⊢ x ∈ bs ∧ x ≠ a
[PROOFSTEP]
exact ⟨hsub (mem_cons_of_mem _ xmem), fun h ↦ h' (h ▸ xmem)⟩
[GOAL]
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
as : List α
⊢ card (map f as) ≤ card as
[PROOFSTEP]
induction as with
| nil => simp
| cons a as ih =>
  cases Decidable.em (f a ∈ map f as) with
  | inl h =>
    rw [map, card_cons_of_mem h]
    apply Nat.le_trans ih (card_le_card_cons ..)
  | inr h =>
    have : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
    rw [map, card_cons_of_not_mem h, card_cons_of_not_mem this]
    exact Nat.add_le_add_right ih _
[GOAL]
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
as : List α
⊢ card (map f as) ≤ card as
[PROOFSTEP]
induction as with
| nil => simp
| cons a as ih =>
  cases Decidable.em (f a ∈ map f as) with
  | inl h =>
    rw [map, card_cons_of_mem h]
    apply Nat.le_trans ih (card_le_card_cons ..)
  | inr h =>
    have : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
    rw [map, card_cons_of_not_mem h, card_cons_of_not_mem this]
    exact Nat.add_le_add_right ih _
[GOAL]
case nil
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
⊢ card (map f []) ≤ card []
[PROOFSTEP]

| nil => simp
[GOAL]
case nil
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
⊢ card (map f []) ≤ card []
[PROOFSTEP]
simp
[GOAL]
case cons
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : card (map f as) ≤ card as
⊢ card (map f (a :: as)) ≤ card (a :: as)
[PROOFSTEP]

| cons a as ih =>
  cases Decidable.em (f a ∈ map f as) with
  | inl h =>
    rw [map, card_cons_of_mem h]
    apply Nat.le_trans ih (card_le_card_cons ..)
  | inr h =>
    have : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
    rw [map, card_cons_of_not_mem h, card_cons_of_not_mem this]
    exact Nat.add_le_add_right ih _
[GOAL]
case cons
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : card (map f as) ≤ card as
⊢ card (map f (a :: as)) ≤ card (a :: as)
[PROOFSTEP]
cases Decidable.em (f a ∈ map f as) with
| inl h =>
  rw [map, card_cons_of_mem h]
  apply Nat.le_trans ih (card_le_card_cons ..)
| inr h =>
  have : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
  rw [map, card_cons_of_not_mem h, card_cons_of_not_mem this]
  exact Nat.add_le_add_right ih _
[GOAL]
case cons
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : card (map f as) ≤ card as
x✝ : f a ∈ map f as ∨ ¬f a ∈ map f as
⊢ card (map f (a :: as)) ≤ card (a :: as)
[PROOFSTEP]
cases Decidable.em (f a ∈ map f as) with
| inl h =>
  rw [map, card_cons_of_mem h]
  apply Nat.le_trans ih (card_le_card_cons ..)
| inr h =>
  have : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
  rw [map, card_cons_of_not_mem h, card_cons_of_not_mem this]
  exact Nat.add_le_add_right ih _
[GOAL]
case cons.inl
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : card (map f as) ≤ card as
h : f a ∈ map f as
⊢ card (map f (a :: as)) ≤ card (a :: as)
[PROOFSTEP]

| inl h =>
  rw [map, card_cons_of_mem h]
  apply Nat.le_trans ih (card_le_card_cons ..)
[GOAL]
case cons.inl
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : card (map f as) ≤ card as
h : f a ∈ map f as
⊢ card (map f (a :: as)) ≤ card (a :: as)
[PROOFSTEP]
rw [map, card_cons_of_mem h]
[GOAL]
case cons.inl
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : card (map f as) ≤ card as
h : f a ∈ map f as
⊢ card (map f as) ≤ card (a :: as)
[PROOFSTEP]
apply Nat.le_trans ih (card_le_card_cons ..)
[GOAL]
case cons.inr
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : card (map f as) ≤ card as
h : ¬f a ∈ map f as
⊢ card (map f (a :: as)) ≤ card (a :: as)
[PROOFSTEP]

| inr h =>
  have : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
  rw [map, card_cons_of_not_mem h, card_cons_of_not_mem this]
  exact Nat.add_le_add_right ih _
[GOAL]
case cons.inr
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : card (map f as) ≤ card as
h : ¬f a ∈ map f as
⊢ card (map f (a :: as)) ≤ card (a :: as)
[PROOFSTEP]
have : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
[GOAL]
case cons.inr
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : card (map f as) ≤ card as
h : ¬f a ∈ map f as
this : ¬a ∈ as
⊢ card (map f (a :: as)) ≤ card (a :: as)
[PROOFSTEP]
rw [map, card_cons_of_not_mem h, card_cons_of_not_mem this]
[GOAL]
case cons.inr
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : card (map f as) ≤ card as
h : ¬f a ∈ map f as
this : ¬a ∈ as
⊢ card (map f as) + 1 ≤ card as + 1
[PROOFSTEP]
exact Nat.add_le_add_right ih _
[GOAL]
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
as : List α
⊢ inj_on f as → card (map f as) = card as
[PROOFSTEP]
induction as with
| nil => simp
| cons a as ih =>
  cases Decidable.em (f a ∈ map f as) with
  | inl h =>
    intro inj_on'
    cases (exists_of_mem_map h) with
    | intro x hx =>
      have : x = a := inj_on' (mem_cons_of_mem _ hx.1) (mem_cons_self ..) hx.2
      have h1 : a ∈ as := this ▸ hx.1
      have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
      rw [map, card_cons_of_mem h, ih h2, card_cons_of_mem h1]
  | inr h =>
    intro inj_on'
    have h1 : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
    have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
    rw [map, card_cons_of_not_mem h, card_cons_of_not_mem h1, ih h2]
[GOAL]
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
as : List α
⊢ inj_on f as → card (map f as) = card as
[PROOFSTEP]
induction as with
| nil => simp
| cons a as ih =>
  cases Decidable.em (f a ∈ map f as) with
  | inl h =>
    intro inj_on'
    cases (exists_of_mem_map h) with
    | intro x hx =>
      have : x = a := inj_on' (mem_cons_of_mem _ hx.1) (mem_cons_self ..) hx.2
      have h1 : a ∈ as := this ▸ hx.1
      have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
      rw [map, card_cons_of_mem h, ih h2, card_cons_of_mem h1]
  | inr h =>
    intro inj_on'
    have h1 : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
    have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
    rw [map, card_cons_of_not_mem h, card_cons_of_not_mem h1, ih h2]
[GOAL]
case nil
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
⊢ inj_on f [] → card (map f []) = card []
[PROOFSTEP]

| nil => simp
[GOAL]
case nil
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
⊢ inj_on f [] → card (map f []) = card []
[PROOFSTEP]
simp
[GOAL]
case cons
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
⊢ inj_on f (a :: as) → card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]

| cons a as ih =>
  cases Decidable.em (f a ∈ map f as) with
  | inl h =>
    intro inj_on'
    cases (exists_of_mem_map h) with
    | intro x hx =>
      have : x = a := inj_on' (mem_cons_of_mem _ hx.1) (mem_cons_self ..) hx.2
      have h1 : a ∈ as := this ▸ hx.1
      have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
      rw [map, card_cons_of_mem h, ih h2, card_cons_of_mem h1]
  | inr h =>
    intro inj_on'
    have h1 : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
    have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
    rw [map, card_cons_of_not_mem h, card_cons_of_not_mem h1, ih h2]
[GOAL]
case cons
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
⊢ inj_on f (a :: as) → card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
cases Decidable.em (f a ∈ map f as) with
| inl h =>
  intro inj_on'
  cases (exists_of_mem_map h) with
  | intro x hx =>
    have : x = a := inj_on' (mem_cons_of_mem _ hx.1) (mem_cons_self ..) hx.2
    have h1 : a ∈ as := this ▸ hx.1
    have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
    rw [map, card_cons_of_mem h, ih h2, card_cons_of_mem h1]
| inr h =>
  intro inj_on'
  have h1 : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
  have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
  rw [map, card_cons_of_not_mem h, card_cons_of_not_mem h1, ih h2]
[GOAL]
case cons
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
x✝ : f a ∈ map f as ∨ ¬f a ∈ map f as
⊢ inj_on f (a :: as) → card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
cases Decidable.em (f a ∈ map f as) with
| inl h =>
  intro inj_on'
  cases (exists_of_mem_map h) with
  | intro x hx =>
    have : x = a := inj_on' (mem_cons_of_mem _ hx.1) (mem_cons_self ..) hx.2
    have h1 : a ∈ as := this ▸ hx.1
    have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
    rw [map, card_cons_of_mem h, ih h2, card_cons_of_mem h1]
| inr h =>
  intro inj_on'
  have h1 : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
  have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
  rw [map, card_cons_of_not_mem h, card_cons_of_not_mem h1, ih h2]
[GOAL]
case cons.inl
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : f a ∈ map f as
⊢ inj_on f (a :: as) → card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]

| inl h =>
  intro inj_on'
  cases (exists_of_mem_map h) with
  | intro x hx =>
    have : x = a := inj_on' (mem_cons_of_mem _ hx.1) (mem_cons_self ..) hx.2
    have h1 : a ∈ as := this ▸ hx.1
    have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
    rw [map, card_cons_of_mem h, ih h2, card_cons_of_mem h1]
[GOAL]
case cons.inl
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : f a ∈ map f as
⊢ inj_on f (a :: as) → card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
intro inj_on'
[GOAL]
case cons.inl
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : f a ∈ map f as
inj_on' : inj_on f (a :: as)
⊢ card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
cases (exists_of_mem_map h) with
| intro x hx =>
  have : x = a := inj_on' (mem_cons_of_mem _ hx.1) (mem_cons_self ..) hx.2
  have h1 : a ∈ as := this ▸ hx.1
  have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
  rw [map, card_cons_of_mem h, ih h2, card_cons_of_mem h1]
[GOAL]
case cons.inl
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : f a ∈ map f as
inj_on' : inj_on f (a :: as)
x✝ : ∃ a_1, a_1 ∈ as ∧ f a_1 = f a
⊢ card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
cases (exists_of_mem_map h) with
| intro x hx =>
  have : x = a := inj_on' (mem_cons_of_mem _ hx.1) (mem_cons_self ..) hx.2
  have h1 : a ∈ as := this ▸ hx.1
  have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
  rw [map, card_cons_of_mem h, ih h2, card_cons_of_mem h1]
[GOAL]
case cons.inl.intro
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : f a ∈ map f as
inj_on' : inj_on f (a :: as)
x : α
hx : x ∈ as ∧ f x = f a
⊢ card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]

| intro x hx =>
  have : x = a := inj_on' (mem_cons_of_mem _ hx.1) (mem_cons_self ..) hx.2
  have h1 : a ∈ as := this ▸ hx.1
  have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
  rw [map, card_cons_of_mem h, ih h2, card_cons_of_mem h1]
[GOAL]
case cons.inl.intro
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : f a ∈ map f as
inj_on' : inj_on f (a :: as)
x : α
hx : x ∈ as ∧ f x = f a
⊢ card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
have : x = a := inj_on' (mem_cons_of_mem _ hx.1) (mem_cons_self ..) hx.2
[GOAL]
case cons.inl.intro
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : f a ∈ map f as
inj_on' : inj_on f (a :: as)
x : α
hx : x ∈ as ∧ f x = f a
this : x = a
⊢ card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
have h1 : a ∈ as := this ▸ hx.1
[GOAL]
case cons.inl.intro
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : f a ∈ map f as
inj_on' : inj_on f (a :: as)
x : α
hx : x ∈ as ∧ f x = f a
this : x = a
h1 : a ∈ as
⊢ card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
[GOAL]
case cons.inl.intro
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : f a ∈ map f as
inj_on' : inj_on f (a :: as)
x : α
hx : x ∈ as ∧ f x = f a
this : x = a
h1 : a ∈ as
h2 : inj_on f as
⊢ card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
rw [map, card_cons_of_mem h, ih h2, card_cons_of_mem h1]
[GOAL]
case cons.inr
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : ¬f a ∈ map f as
⊢ inj_on f (a :: as) → card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]

| inr h =>
  intro inj_on'
  have h1 : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
  have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
  rw [map, card_cons_of_not_mem h, card_cons_of_not_mem h1, ih h2]
[GOAL]
case cons.inr
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : ¬f a ∈ map f as
⊢ inj_on f (a :: as) → card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
intro inj_on'
[GOAL]
case cons.inr
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : ¬f a ∈ map f as
inj_on' : inj_on f (a :: as)
⊢ card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
have h1 : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
[GOAL]
case cons.inr
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : ¬f a ∈ map f as
inj_on' : inj_on f (a :: as)
h1 : ¬a ∈ as
⊢ card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
have h2 : inj_on f as := inj_on_of_subset inj_on' (subset_cons _ _)
[GOAL]
case cons.inr
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
a : α
as : List α
ih : inj_on f as → card (map f as) = card as
h : ¬f a ∈ map f as
inj_on' : inj_on f (a :: as)
h1 : ¬a ∈ as
h2 : inj_on f as
⊢ card (map f (a :: as)) = card (a :: as)
[PROOFSTEP]
rw [map, card_cons_of_not_mem h, card_cons_of_not_mem h1, ih h2]
[GOAL]
α : Type u_1
β : Sort ?u.48627
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
x✝¹ : List α
x✝ : Disjoint [] x✝¹
⊢ card ([] ++ x✝¹) = card [] + card x✝¹
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
β : Sort ?u.48627
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
disj : Disjoint (a :: as) bs
⊢ card (a :: as ++ bs) = card (a :: as) + card bs
[PROOFSTEP]
have disj' : Disjoint as bs := fun _ h1 h2 ↦ disj (mem_cons_of_mem a h1) h2
[GOAL]
α : Type u_1
β : Sort ?u.48627
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
disj : Disjoint (a :: as) bs
disj' : Disjoint as bs
⊢ card (a :: as ++ bs) = card (a :: as) + card bs
[PROOFSTEP]
cases Decidable.em (a ∈ as) with
| inl h => simp [h, card_append_disjoint disj']
| inr h =>
  have h1 : a ∉ bs := fun h' ↦ disj (mem_cons_self a as) h'
  simp [h, h1, card_append_disjoint disj']
  rw [Nat.add_right_comm]
[GOAL]
α : Type u_1
β : Sort ?u.48627
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
disj : Disjoint (a :: as) bs
disj' : Disjoint as bs
x✝ : a ∈ as ∨ ¬a ∈ as
⊢ card (a :: as ++ bs) = card (a :: as) + card bs
[PROOFSTEP]
cases Decidable.em (a ∈ as) with
| inl h => simp [h, card_append_disjoint disj']
| inr h =>
  have h1 : a ∉ bs := fun h' ↦ disj (mem_cons_self a as) h'
  simp [h, h1, card_append_disjoint disj']
  rw [Nat.add_right_comm]
[GOAL]
case inl
α : Type u_1
β : Sort ?u.48627
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
disj : Disjoint (a :: as) bs
disj' : Disjoint as bs
h : a ∈ as
⊢ card (a :: as ++ bs) = card (a :: as) + card bs
[PROOFSTEP]

| inl h => simp [h, card_append_disjoint disj']
[GOAL]
case inl
α : Type u_1
β : Sort ?u.48627
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
disj : Disjoint (a :: as) bs
disj' : Disjoint as bs
h : a ∈ as
⊢ card (a :: as ++ bs) = card (a :: as) + card bs
[PROOFSTEP]
simp [h, card_append_disjoint disj']
[GOAL]
case inr
α : Type u_1
β : Sort ?u.48627
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
disj : Disjoint (a :: as) bs
disj' : Disjoint as bs
h : ¬a ∈ as
⊢ card (a :: as ++ bs) = card (a :: as) + card bs
[PROOFSTEP]

| inr h =>
  have h1 : a ∉ bs := fun h' ↦ disj (mem_cons_self a as) h'
  simp [h, h1, card_append_disjoint disj']
  rw [Nat.add_right_comm]
[GOAL]
case inr
α : Type u_1
β : Sort ?u.48627
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
disj : Disjoint (a :: as) bs
disj' : Disjoint as bs
h : ¬a ∈ as
⊢ card (a :: as ++ bs) = card (a :: as) + card bs
[PROOFSTEP]
have h1 : a ∉ bs := fun h' ↦ disj (mem_cons_self a as) h'
[GOAL]
case inr
α : Type u_1
β : Sort ?u.48627
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
disj : Disjoint (a :: as) bs
disj' : Disjoint as bs
h : ¬a ∈ as
h1 : ¬a ∈ bs
⊢ card (a :: as ++ bs) = card (a :: as) + card bs
[PROOFSTEP]
simp [h, h1, card_append_disjoint disj']
[GOAL]
case inr
α : Type u_1
β : Sort ?u.48627
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
disj : Disjoint (a :: as) bs
disj' : Disjoint as bs
h : ¬a ∈ as
h1 : ¬a ∈ bs
⊢ card as + card bs + 1 = card as + 1 + card bs
[PROOFSTEP]
rw [Nat.add_right_comm]
[GOAL]
α : Type u_1
β : Sort ?u.54019
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
as bs : List α
h : Disjoint as bs
⊢ card (as ∪ bs) = card as + card bs
[PROOFSTEP]
rw [card_eq_of_equiv (union_equiv_append as bs), card_append_disjoint h]


[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
g✝ g₁ g₂ g : Set α → Filter β
⊢ Filter.lift ⊤ g = g univ
[PROOFSTEP]
simp [Filter.lift]
[GOAL]
α : Type u_1
β✝ : Type u_2
γ : Type u_3
ι✝ : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β✝
ι : Sort u_6
p : ι → Prop
s✝ : ι → Set α
f : Filter α
hf : HasBasis f p s✝
β : ι → Type u_5
pg : (i : ι) → β i → Prop
sg : (i : ι) → β i → Set γ
g : Set α → Filter γ
hg : ∀ (i : ι), HasBasis (g (s✝ i)) (pg i) (sg i)
gm : Monotone g
s : Set γ
⊢ s ∈ Filter.lift f g ↔ ∃ i, p i ∧ ∃ x, pg i x ∧ sg i x ⊆ s
[PROOFSTEP]
refine' (mem_biInf_of_directed _ ⟨univ, univ_sets _⟩).trans _
[GOAL]
case refine'_1
α : Type u_1
β✝ : Type u_2
γ : Type u_3
ι✝ : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β✝
ι : Sort u_6
p : ι → Prop
s✝ : ι → Set α
f : Filter α
hf : HasBasis f p s✝
β : ι → Type u_5
pg : (i : ι) → β i → Prop
sg : (i : ι) → β i → Set γ
g : Set α → Filter γ
hg : ∀ (i : ι), HasBasis (g (s✝ i)) (pg i) (sg i)
gm : Monotone g
s : Set γ
⊢ DirectedOn ((fun s => g s) ⁻¹'o fun x x_1 => x ≥ x_1) f.sets
[PROOFSTEP]
intro t₁ ht₁ t₂ ht₂
[GOAL]
case refine'_1
α : Type u_1
β✝ : Type u_2
γ : Type u_3
ι✝ : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β✝
ι : Sort u_6
p : ι → Prop
s✝ : ι → Set α
f : Filter α
hf : HasBasis f p s✝
β : ι → Type u_5
pg : (i : ι) → β i → Prop
sg : (i : ι) → β i → Set γ
g : Set α → Filter γ
hg : ∀ (i : ι), HasBasis (g (s✝ i)) (pg i) (sg i)
gm : Monotone g
s : Set γ
t₁ : Set α
ht₁ : t₁ ∈ f.sets
t₂ : Set α
ht₂ : t₂ ∈ f.sets
⊢ ∃ z, z ∈ f.sets ∧ ((fun s => g s) ⁻¹'o fun x x_1 => x ≥ x_1) t₁ z ∧ ((fun s => g s) ⁻¹'o fun x x_1 => x ≥ x_1) t₂ z
[PROOFSTEP]
exact ⟨t₁ ∩ t₂, inter_mem ht₁ ht₂, gm <| inter_subset_left _ _, gm <| inter_subset_right _ _⟩
[GOAL]
case refine'_2
α : Type u_1
β✝ : Type u_2
γ : Type u_3
ι✝ : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β✝
ι : Sort u_6
p : ι → Prop
s✝ : ι → Set α
f : Filter α
hf : HasBasis f p s✝
β : ι → Type u_5
pg : (i : ι) → β i → Prop
sg : (i : ι) → β i → Set γ
g : Set α → Filter γ
hg : ∀ (i : ι), HasBasis (g (s✝ i)) (pg i) (sg i)
gm : Monotone g
s : Set γ
⊢ (∃ i, i ∈ f.sets ∧ s ∈ g i) ↔ ∃ i, p i ∧ ∃ x, pg i x ∧ sg i x ⊆ s
[PROOFSTEP]
simp only [← (hg _).mem_iff]
[GOAL]
case refine'_2
α : Type u_1
β✝ : Type u_2
γ : Type u_3
ι✝ : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β✝
ι : Sort u_6
p : ι → Prop
s✝ : ι → Set α
f : Filter α
hf : HasBasis f p s✝
β : ι → Type u_5
pg : (i : ι) → β i → Prop
sg : (i : ι) → β i → Set γ
g : Set α → Filter γ
hg : ∀ (i : ι), HasBasis (g (s✝ i)) (pg i) (sg i)
gm : Monotone g
s : Set γ
⊢ (∃ i, i ∈ f.sets ∧ s ∈ g i) ↔ ∃ i, p i ∧ s ∈ g (s✝ i)
[PROOFSTEP]
exact hf.exists_iff fun t₁ t₂ ht H => gm ht H
[GOAL]
α : Type u_1
β✝ : Type u_2
γ : Type u_3
ι✝ : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β✝
ι : Type u_6
p : ι → Prop
s : ι → Set α
f : Filter α
hf : HasBasis f p s
β : ι → Type u_5
pg : (i : ι) → β i → Prop
sg : (i : ι) → β i → Set γ
g : Set α → Filter γ
hg : ∀ (i : ι), HasBasis (g (s i)) (pg i) (sg i)
gm : Monotone g
⊢ HasBasis (Filter.lift f g) (fun i => p i.fst ∧ pg i.fst i.snd) fun i => sg i.fst i.snd
[PROOFSTEP]
refine' ⟨fun t => (hf.mem_lift_iff hg gm).trans _⟩
[GOAL]
α : Type u_1
β✝ : Type u_2
γ : Type u_3
ι✝ : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β✝
ι : Type u_6
p : ι → Prop
s : ι → Set α
f : Filter α
hf : HasBasis f p s
β : ι → Type u_5
pg : (i : ι) → β i → Prop
sg : (i : ι) → β i → Set γ
g : Set α → Filter γ
hg : ∀ (i : ι), HasBasis (g (s i)) (pg i) (sg i)
gm : Monotone g
t : Set γ
⊢ (∃ i, p i ∧ ∃ x, pg i x ∧ sg i x ⊆ t) ↔ ∃ i, (p i.fst ∧ pg i.fst i.snd) ∧ sg i.fst i.snd ⊆ t
[PROOFSTEP]
simp [Sigma.exists, and_assoc, exists_and_left]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
g g₁ g₂ : Set α → Filter β
hg : Monotone g
s : Set β
⊢ (∃ i, i ∈ f ∧ ∃ x, x ∈ g i ∧ id x ⊆ s) ↔ ∃ t, t ∈ f ∧ s ∈ g t
[PROOFSTEP]
simp only [id, exists_mem_subset_iff]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
g g₁ g₂ : Set α → Filter β
hg : Monotone g
⊢ ⋂₀ {s | s ∈ Filter.lift f g} = ⋂ (s : Set α) (_ : s ∈ f), ⋂₀ {t | t ∈ g s}
[PROOFSTEP]
simp only [sInter_eq_biInter, mem_setOf_eq, Filter.mem_sets, mem_lift_sets hg, iInter_exists, iInter_and,
  @iInter_comm _ (Set β)]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
g g₁ g₂ : Set α → Filter β
m : γ → β
l : Filter γ
⊢ Tendsto m l (Filter.lift f g) ↔ ∀ (s : Set α), s ∈ f → Tendsto m l (g s)
[PROOFSTEP]
simp only [Filter.lift, tendsto_iInf]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
g g₁ g₂ : Set α → Filter β
m : β → γ
hg : Monotone g
this : Monotone (map m ∘ g)
s : Set γ
⊢ s ∈ map m (Filter.lift f g) ↔ s ∈ Filter.lift f (map m ∘ g)
[PROOFSTEP]
simp only [mem_lift_sets hg, mem_lift_sets this, exists_prop, mem_map, Function.comp_apply]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
g g₁ g₂ : Set α → Filter β
m : γ → β
⊢ comap m (Filter.lift f g) = Filter.lift f (comap m ∘ g)
[PROOFSTEP]
simp only [Filter.lift, comap_iInf]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
g g₁ g₂ : Set α → Filter β
m : γ → β
⊢ ⨅ (i : Set α) (_ : i ∈ f), comap m (g i) = ⨅ (s : Set α) (_ : s ∈ f), (comap m ∘ g) s
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
g g₁ g₂ : Set α → Filter β
hm : Monotone g
⊢ NeBot (Filter.lift f g) ↔ ∀ (s : Set α), s ∈ f → NeBot (g s)
[PROOFSTEP]
simp only [neBot_iff, Ne.def, ← empty_mem_iff_bot, mem_lift_sets hm, not_exists, not_and]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
f : Filter α
g h : Set α → Filter β
⊢ (Filter.lift f fun x => g x ⊓ h x) = Filter.lift f g ⊓ Filter.lift f h
[PROOFSTEP]
simp only [Filter.lift, iInf_inf_eq]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g g₁ g₂ : Set α → Filter β
f : Filter α
s : Set α
hs : s ∈ f
⊢ f ≤ 𝓟 s
[PROOFSTEP]
simp only [hs, le_principal_iff]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
⊢ Filter.lift (iInf f) g = ⨅ (i : ι), Filter.lift (f i) g
[PROOFSTEP]
refine' lift_iInf_le.antisymm fun s => _
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
s : Set β
⊢ s ∈ Filter.lift (iInf f) g → s ∈ ⨅ (i : ι), Filter.lift (f i) g
[PROOFSTEP]
have H : ∀ t ∈ iInf f, ⨅ i, (f i).lift g ≤ g t := by
  intro t ht
  refine' iInf_sets_induct ht _ fun hs ht => _
  · inhabit ι
    exact iInf₂_le_of_le default univ (iInf_le _ univ_mem)
  · rw [hg]
    exact le_inf (iInf₂_le_of_le _ _ <| iInf_le _ hs) ht
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
s : Set β
⊢ ∀ (t : Set α), t ∈ iInf f → ⨅ (i : ι), Filter.lift (f i) g ≤ g t
[PROOFSTEP]
intro t ht
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
s : Set β
t : Set α
ht : t ∈ iInf f
⊢ ⨅ (i : ι), Filter.lift (f i) g ≤ g t
[PROOFSTEP]
refine' iInf_sets_induct ht _ fun hs ht => _
[GOAL]
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
s : Set β
t : Set α
ht : t ∈ iInf f
⊢ ⨅ (i : ι), Filter.lift (f i) g ≤ g univ
[PROOFSTEP]
inhabit ι
[GOAL]
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
s : Set β
t : Set α
ht : t ∈ iInf f
inhabited_h : Inhabited ι
⊢ ⨅ (i : ι), Filter.lift (f i) g ≤ g univ
[PROOFSTEP]
exact iInf₂_le_of_le default univ (iInf_le _ univ_mem)
[GOAL]
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
s : Set β
t : Set α
ht✝ : t ∈ iInf f
i✝ : ι
s₁✝ s₂✝ : Set α
hs : s₁✝ ∈ f i✝
ht : ⨅ (i : ι), Filter.lift (f i) g ≤ g s₂✝
⊢ ⨅ (i : ι), Filter.lift (f i) g ≤ g (s₁✝ ∩ s₂✝)
[PROOFSTEP]
rw [hg]
[GOAL]
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
s : Set β
t : Set α
ht✝ : t ∈ iInf f
i✝ : ι
s₁✝ s₂✝ : Set α
hs : s₁✝ ∈ f i✝
ht : ⨅ (i : ι), Filter.lift (f i) g ≤ g s₂✝
⊢ ⨅ (i : ι), Filter.lift (f i) g ≤ g s₁✝ ⊓ g s₂✝
[PROOFSTEP]
exact le_inf (iInf₂_le_of_le _ _ <| iInf_le _ hs) ht
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
s : Set β
H : ∀ (t : Set α), t ∈ iInf f → ⨅ (i : ι), Filter.lift (f i) g ≤ g t
⊢ s ∈ Filter.lift (iInf f) g → s ∈ ⨅ (i : ι), Filter.lift (f i) g
[PROOFSTEP]
simp only [mem_lift_sets (Monotone.of_map_inf hg), exists_imp, and_imp]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
s : Set β
H : ∀ (t : Set α), t ∈ iInf f → ⨅ (i : ι), Filter.lift (f i) g ≤ g t
⊢ ∀ (x : Set α), x ∈ iInf f → s ∈ g x → s ∈ ⨅ (i : ι), Filter.lift (f i) g
[PROOFSTEP]
exact fun t ht hs => H t ht hs
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hf : Directed (fun x x_1 => x ≥ x_1) f
hg : Monotone g
s : Set β
⊢ s ∈ Filter.lift (iInf f) g → s ∈ ⨅ (i : ι), Filter.lift (f i) g
[PROOFSTEP]
simp only [mem_lift_sets hg, exists_imp, and_imp, mem_iInf_of_directed hf]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Filter β
hf : Directed (fun x x_1 => x ≥ x_1) f
hg : Monotone g
s : Set β
⊢ ∀ (x : Set α) (x_1 : ι), x ∈ f x_1 → s ∈ g x → s ∈ ⨅ (i : ι), Filter.lift (f i) g
[PROOFSTEP]
exact fun t i ht hs => mem_iInf_of_mem i <| mem_lift ht hs
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
hg' : g univ = ⊤
⊢ Filter.lift (iInf f) g = ⨅ (i : ι), Filter.lift (f i) g
[PROOFSTEP]
cases isEmpty_or_nonempty ι
[GOAL]
case inl
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
hg' : g univ = ⊤
h✝ : IsEmpty ι
⊢ Filter.lift (iInf f) g = ⨅ (i : ι), Filter.lift (f i) g
[PROOFSTEP]
simp [iInf_of_empty, hg']
[GOAL]
case inr
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
g✝ g₁ g₂ : Set α → Filter β
f : ι → Filter α
g : Set α → Filter β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ⊓ g t
hg' : g univ = ⊤
h✝ : Nonempty ι
⊢ Filter.lift (iInf f) g = ⨅ (i : ι), Filter.lift (f i) g
[PROOFSTEP]
exact lift_iInf hg
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
m : γ → β
l : Filter γ
⊢ Tendsto m l (Filter.lift' f h) ↔ ∀ (s : Set α), s ∈ f → ∀ᶠ (a : γ) in l, m a ∈ h s
[PROOFSTEP]
simp only [Filter.lift', tendsto_lift, tendsto_principal, comp]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι✝ : Sort u_4
f f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
ι : Sort u_5
p : ι → Prop
s : ι → Set α
hf : HasBasis f p s
hh : Monotone h
t : Set β
⊢ (∃ i, p i ∧ ∃ x, True ∧ h (s i) ⊆ t) ↔ ∃ i, p i ∧ (h ∘ s) i ⊆ t
[PROOFSTEP]
simp only [exists_const, true_and, comp]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
m : β → γ
hh : Monotone h
⊢ Filter.lift f (map m ∘ 𝓟 ∘ h) = Filter.lift' f (image m ∘ h)
[PROOFSTEP]
simp only [comp, Filter.lift', map_principal]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
m : γ → β
⊢ comap m (Filter.lift' f h) = Filter.lift' f (preimage m ∘ h)
[PROOFSTEP]
simp only [Filter.lift', comap_lift_eq, (· ∘ ·), comap_principal]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
a : α
hh : Monotone h
⊢ Filter.lift' (pure a) h = 𝓟 (h {a})
[PROOFSTEP]
rw [← principal_singleton, lift'_principal hh]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
hh : Monotone h
⊢ Filter.lift' ⊥ h = 𝓟 (h ∅)
[PROOFSTEP]
rw [← principal_empty, lift'_principal hh]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
h✝ h₁ h₂ g : Set α → Set β
h : Set β → Filter γ
hg : Monotone g
hh : Monotone h
⊢ (Filter.lift f fun s => Filter.lift (𝓟 (g s)) h) = Filter.lift f fun s => h (g s)
[PROOFSTEP]
simp only [lift_principal, hh, eq_self_iff_true]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
h✝ h₁ h₂ h : Set α → Set β
s : Set β
⊢ Filter.lift' f h ⊓ 𝓟 s = Filter.lift' f fun t => h t ∩ s
[PROOFSTEP]
simp only [Filter.lift', Filter.lift, (· ∘ ·), ← inf_principal, iInf_subtype', ← iInf_inf]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
hh : Monotone h
⊢ (∀ (s : Set α), s ∈ f → NeBot (𝓟 (h s))) ↔ ∀ (s : Set α), s ∈ f → Set.Nonempty (h s)
[PROOFSTEP]
simp only [principal_neBot_iff]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
inst✝ : Nonempty ι
f : ι → Filter α
g : Set α → Set β
hg : ∀ (s t : Set α), g (s ∩ t) = g s ∩ g t
s t : Set α
⊢ (𝓟 ∘ g) (s ∩ t) = (𝓟 ∘ g) s ⊓ (𝓟 ∘ g) t
[PROOFSTEP]
simp only [inf_principal, comp, hg]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
f : ι → Filter α
g : Set α → Set β
hg : ∀ {s t : Set α}, g (s ∩ t) = g s ∩ g t
hg' : g univ = univ
s t : Set α
⊢ (𝓟 ∘ g) (s ∩ t) = (𝓟 ∘ g) s ⊓ (𝓟 ∘ g) t
[PROOFSTEP]
simp only [inf_principal, comp, hg]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
f : ι → Filter α
g : Set α → Set β
hg : ∀ {s t : Set α}, g (s ∩ t) = g s ∩ g t
hg' : g univ = univ
⊢ (𝓟 ∘ g) univ = ⊤
[PROOFSTEP]
rw [Function.comp_apply, hg', principal_univ]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
f g : Filter α
s : Set α → Set β
hs : ∀ (t₁ t₂ : Set α), s (t₁ ∩ t₂) = s t₁ ∩ s t₂
⊢ Filter.lift' (f ⊓ g) s = Filter.lift' f s ⊓ Filter.lift' g s
[PROOFSTEP]
rw [inf_eq_iInf, inf_eq_iInf, lift'_iInf hs]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
f g : Filter α
s : Set α → Set β
hs : ∀ (t₁ t₂ : Set α), s (t₁ ∩ t₂) = s t₁ ∩ s t₂
⊢ ⨅ (i : Bool), Filter.lift' (bif i then f else g) s = ⨅ (b : Bool), bif b then Filter.lift' f s else Filter.lift' g s
[PROOFSTEP]
refine iInf_congr ?_
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
f g : Filter α
s : Set α → Set β
hs : ∀ (t₁ t₂ : Set α), s (t₁ ∩ t₂) = s t₁ ∩ s t₂
⊢ ∀ (i : Bool), Filter.lift' (bif i then f else g) s = bif i then Filter.lift' f s else Filter.lift' g s
[PROOFSTEP]
rintro (_ | _)
[GOAL]
case false
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
f g : Filter α
s : Set α → Set β
hs : ∀ (t₁ t₂ : Set α), s (t₁ ∩ t₂) = s t₁ ∩ s t₂
⊢ Filter.lift' (bif false then f else g) s = bif false then Filter.lift' f s else Filter.lift' g s
[PROOFSTEP]
rfl
[GOAL]
case true
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f₁ f₂ : Filter α
h h₁ h₂ : Set α → Set β
f g : Filter α
s : Set α → Set β
hs : ∀ (t₁ t₂ : Set α), s (t₁ ∩ t₂) = s t₁ ∩ s t₂
⊢ Filter.lift' (bif true then f else g) s = bif true then Filter.lift' f s else Filter.lift' g s
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ f : Filter α
g : Filter β
⊢ f ×ˢ g = Filter.lift f fun s => Filter.lift' g fun t => s ×ˢ t
[PROOFSTEP]
simpa only [Filter.lift', Filter.lift, (f.basis_sets.prod g.basis_sets).eq_biInf, iInf_prod, iInf_and] using
  iInf_congr fun i => iInf_comm
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f✝ : Filter α
f : α × α → β
x : Filter α
y : Filter β
⊢ Tendsto f (x ×ˢ x) y ↔ ∀ (W : Set β), W ∈ y → ∃ U, U ∈ x ∧ ∀ (x x' : α), x ∈ U → x' ∈ U → f (x, x') ∈ W
[PROOFSTEP]
simp only [tendsto_def, mem_prod_same_iff, prod_sub_preimage_iff, exists_prop, iff_self_iff]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f : Filter α
α₁ : Type u_5
α₂ : Type u_6
β₁ : Type u_7
β₂ : Type u_8
f₁ : Filter α₁
f₂ : Filter α₂
g₁ : Set α₁ → Filter β₁
g₂ : Set α₂ → Filter β₂
hg₁ : Monotone g₁
hg₂ : Monotone g₂
⊢ Filter.lift f₁ g₁ ×ˢ Filter.lift f₂ g₂ = Filter.lift f₁ fun s => Filter.lift f₂ fun t => g₁ s ×ˢ g₂ t
[PROOFSTEP]
simp only [prod_def, lift_assoc hg₁]
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f : Filter α
α₁ : Type u_5
α₂ : Type u_6
β₁ : Type u_7
β₂ : Type u_8
f₁ : Filter α₁
f₂ : Filter α₂
g₁ : Set α₁ → Filter β₁
g₂ : Set α₂ → Filter β₂
hg₁ : Monotone g₁
hg₂ : Monotone g₂
⊢ (Filter.lift f₁ fun s => Filter.lift (g₁ s) fun s => Filter.lift' (Filter.lift f₂ g₂) fun t => s ×ˢ t) =
    Filter.lift f₁ fun s => Filter.lift f₂ fun t => Filter.lift (g₁ s) fun s => Filter.lift' (g₂ t) fun t => s ×ˢ t
[PROOFSTEP]
apply congr_arg
[GOAL]
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f : Filter α
α₁ : Type u_5
α₂ : Type u_6
β₁ : Type u_7
β₂ : Type u_8
f₁ : Filter α₁
f₂ : Filter α₂
g₁ : Set α₁ → Filter β₁
g₂ : Set α₂ → Filter β₂
hg₁ : Monotone g₁
hg₂ : Monotone g₂
⊢ (fun s => Filter.lift (g₁ s) fun s => Filter.lift' (Filter.lift f₂ g₂) fun t => s ×ˢ t) = fun s =>
    Filter.lift f₂ fun t => Filter.lift (g₁ s) fun s => Filter.lift' (g₂ t) fun t => s ×ˢ t
[PROOFSTEP]
funext x
[GOAL]
case h.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f : Filter α
α₁ : Type u_5
α₂ : Type u_6
β₁ : Type u_7
β₂ : Type u_8
f₁ : Filter α₁
f₂ : Filter α₂
g₁ : Set α₁ → Filter β₁
g₂ : Set α₂ → Filter β₂
hg₁ : Monotone g₁
hg₂ : Monotone g₂
x : Set α₁
⊢ (Filter.lift (g₁ x) fun s => Filter.lift' (Filter.lift f₂ g₂) fun t => s ×ˢ t) =
    Filter.lift f₂ fun t => Filter.lift (g₁ x) fun s => Filter.lift' (g₂ t) fun t => s ×ˢ t
[PROOFSTEP]
rw [lift_comm]
[GOAL]
case h.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f : Filter α
α₁ : Type u_5
α₂ : Type u_6
β₁ : Type u_7
β₂ : Type u_8
f₁ : Filter α₁
f₂ : Filter α₂
g₁ : Set α₁ → Filter β₁
g₂ : Set α₂ → Filter β₂
hg₁ : Monotone g₁
hg₂ : Monotone g₂
x : Set α₁
⊢ (Filter.lift (g₁ x) fun s => Filter.lift' (Filter.lift f₂ g₂) fun t => s ×ˢ t) =
    Filter.lift (g₁ x) fun t => Filter.lift f₂ fun s => Filter.lift' (g₂ s) fun t_1 => t ×ˢ t_1
[PROOFSTEP]
apply congr_arg
[GOAL]
case h.h.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f : Filter α
α₁ : Type u_5
α₂ : Type u_6
β₁ : Type u_7
β₂ : Type u_8
f₁ : Filter α₁
f₂ : Filter α₂
g₁ : Set α₁ → Filter β₁
g₂ : Set α₂ → Filter β₂
hg₁ : Monotone g₁
hg₂ : Monotone g₂
x : Set α₁
⊢ (fun s => Filter.lift' (Filter.lift f₂ g₂) fun t => s ×ˢ t) = fun t =>
    Filter.lift f₂ fun s => Filter.lift' (g₂ s) fun t_1 => t ×ˢ t_1
[PROOFSTEP]
funext y
[GOAL]
case h.h.h.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f : Filter α
α₁ : Type u_5
α₂ : Type u_6
β₁ : Type u_7
β₂ : Type u_8
f₁ : Filter α₁
f₂ : Filter α₂
g₁ : Set α₁ → Filter β₁
g₂ : Set α₂ → Filter β₂
hg₁ : Monotone g₁
hg₂ : Monotone g₂
x : Set α₁
y : Set β₁
⊢ (Filter.lift' (Filter.lift f₂ g₂) fun t => y ×ˢ t) = Filter.lift f₂ fun s => Filter.lift' (g₂ s) fun t => y ×ˢ t
[PROOFSTEP]
apply lift'_lift_assoc hg₂
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f : Filter α
α₁ : Type u_5
α₂ : Type u_6
β₁ : Type u_7
β₂ : Type u_8
f₁ : Filter α₁
f₂ : Filter α₂
g₁ : Set α₁ → Set β₁
g₂ : Set α₂ → Set β₂
hg₁ : Monotone g₁
hg₂ : Monotone g₂
⊢ (Filter.lift f₁ fun s => Filter.lift f₂ fun t => 𝓟 (g₁ s) ×ˢ 𝓟 (g₂ t)) =
    Filter.lift f₁ fun s => Filter.lift f₂ fun t => 𝓟 (g₁ s ×ˢ g₂ t)
[PROOFSTEP]
{simp only [prod_principal_principal]
}
[GOAL]
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
f : Filter α
α₁ : Type u_5
α₂ : Type u_6
β₁ : Type u_7
β₂ : Type u_8
f₁ : Filter α₁
f₂ : Filter α₂
g₁ : Set α₁ → Set β₁
g₂ : Set α₂ → Set β₂
hg₁ : Monotone g₁
hg₂ : Monotone g₂
⊢ (Filter.lift f₁ fun s => Filter.lift f₂ fun t => 𝓟 (g₁ s) ×ˢ 𝓟 (g₂ t)) =
    Filter.lift f₁ fun s => Filter.lift f₂ fun t => 𝓟 (g₁ s ×ˢ g₂ t)
[PROOFSTEP]
simp only [prod_principal_principal]