l3lab/ntp-mathlib huggingface dataset:
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by 

Proof state:
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
bs : List α
x✝ : [] ⊆ bs
⊢ card [] ≤ card bs

Next tactic:
simp
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    

Proof state:
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
⊢ card (a :: as) ≤ card bs

Next tactic:
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)⟩
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    

Proof state:
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
x✝ : a ∈ as ∨ ¬a ∈ as
⊢ card (a :: as) ≤ card bs

Next tactic:
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)⟩
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    cases Decidable.em (a ∈ as) with
    

Proof state:
case inl
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : a ∈ as
⊢ card (a :: as) ≤ card bs

Next tactic:
| inl h' =>
      have hsub' : as ⊆ bs := fun _ xmem ↦ hsub (mem_cons_of_mem a xmem)
      simp [h', card_subset_le hsub']
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    cases Decidable.em (a ∈ as) with
    | inl h' =>
      

Proof state:
case inl
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : a ∈ as
⊢ card (a :: as) ≤ card bs

Next tactic:
have hsub' : as ⊆ bs := fun _ xmem ↦ hsub (mem_cons_of_mem a xmem)
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    cases Decidable.em (a ∈ as) with
    | inl h' =>
      have hsub' : as ⊆ bs := fun _ xmem ↦ hsub (mem_cons_of_mem a xmem)
      

Proof state:
case inl
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : a ∈ as
hsub' : as ⊆ bs
⊢ card (a :: as) ≤ card bs

Next tactic:
simp [h', card_subset_le hsub']
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    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']
    

Proof state:
case inr
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
⊢ card (a :: as) ≤ card bs

Next tactic:
| 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)⟩
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    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' =>
      

Proof state:
case inr
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
⊢ card (a :: as) ≤ card bs

Next tactic:
have : a ∈ bs := hsub (Mem.head ..)
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    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 ..)
      

Proof state:
case inr
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
this : a ∈ bs
⊢ card (a :: as) ≤ card bs

Next tactic:
rw [card_cons_of_not_mem h', card_remove_of_mem this]
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    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]
      

Proof state:
case inr
α : Type u_1
β : Sort ?u.24610
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

Next tactic:
apply Nat.add_le_add_right
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    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
      

Proof state:
case inr.h
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
this : a ∈ bs
⊢ card as ≤ card (remove a bs)

Next tactic:
apply card_subset_le
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    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
      

Proof state:
case inr.h.a
α : Type u_1
β : Sort ?u.24610
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
as bs : List α
hsub : a :: as ⊆ bs
h' : ¬a ∈ as
this : a ∈ bs
⊢ as ⊆ remove a bs

Next tactic:
intro x xmem
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    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
      

Proof state:
case inr.h.a
α : Type u_1
β : Sort ?u.24610
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

Next tactic:
rw [mem_remove_iff]
theorem card_subset_le : ∀ {as bs : List α}, as ⊆ bs → card as ≤ card bs
  | [], bs, _ => by simp
  | (a :: as), bs, hsub => by
    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]
      

Proof state:
case inr.h.a
α : Type u_1
β : Sort ?u.24610
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

Next tactic:
exact ⟨hsub (mem_cons_of_mem _ xmem), fun h ↦ h' (h ▸ xmem)⟩
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
as : List α
⊢ card (map f as) ≤ card as

Next tactic:
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 _
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  induction as with
  

Proof state:
case nil
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
⊢ card (map f []) ≤ card []

Next tactic:
| nil => simp
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  induction as with
  | nil => 

Proof state:
case nil
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
⊢ card (map f []) ≤ card []

Next tactic:
simp
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  induction as with
  | nil => simp
  

Proof state:
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)

Next tactic:
| 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 _
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  induction as with
  | nil => simp
  | cons a as ih =>
    

Proof state:
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)

Next tactic:
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 _
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  induction as with
  | nil => simp
  | cons a as ih =>
    

Proof state:
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)

Next tactic:
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 _
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  induction as with
  | nil => simp
  | cons a as ih =>
    cases Decidable.em (f a ∈ map f as) with
    

Proof state:
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)

Next tactic:
| inl h =>
      rw [map, card_cons_of_mem h]
      apply Nat.le_trans ih (card_le_card_cons ..)
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  induction as with
  | nil => simp
  | cons a as ih =>
    cases Decidable.em (f a ∈ map f as) with
    | inl h =>
      

Proof state:
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)

Next tactic:
rw [map, card_cons_of_mem h]
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  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]
      

Proof state:
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)

Next tactic:
apply Nat.le_trans ih (card_le_card_cons ..)
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  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 ..)
    

Proof state:
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)

Next tactic:
| 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 _
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  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 =>
      

Proof state:
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)

Next tactic:
have : a ∉ as := fun h'' ↦ h (mem_map_of_mem _ h'')
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  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'')
      

Proof state:
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)

Next tactic:
rw [map, card_cons_of_not_mem h, card_cons_of_not_mem this]
theorem card_map_le (f : α → β) (as : List α) : card (as.map f) ≤ card as := by
  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]
      

Proof state:
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

Next tactic:
exact Nat.add_le_add_right ih _
theorem card_map_eq_of_inj_on {f : α → β} {as : List α} :
    inj_on f as → card (as.map f) = card as := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
as : List α
⊢ inj_on f as → card (map f as) = card as

Next tactic:
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]
theorem card_map_eq_of_inj_on {f : α → β} {as : List α} :
    inj_on f as → card (as.map f) = card as := by
  induction as with
  

Proof state:
case nil
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
⊢ inj_on f [] → card (map f []) = card []

Next tactic:
| nil => simp
theorem card_map_eq_of_inj_on {f : α → β} {as : List α} :
    inj_on f as → card (as.map f) = card as := by
  induction as with
  | nil => 

Proof state:
case nil
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
f : α → β
⊢ inj_on f [] → card (map f []) = card []

Next tactic:
simp
theorem card_map_eq_of_inj_on {f : α → β} {as : List α} :
    inj_on f as → card (as.map f) = card as := by
  induction as with
  | nil => simp
  

Proof state:
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)

Next tactic:
| 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]
theorem card_map_eq_of_inj_on {f : α → β} {as : List α} :
    inj_on f as → card (as.map f) = card as := by
  induction as with
  | nil => simp
  | cons a as ih =>
    

Proof state:
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)

Next tactic:
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]
theorem card_map_eq_of_inj_on {f : α → β} {as : List α} :
    inj_on f as → card (as.map f) = card as := by
  induction as with
  | nil => simp
  | cons a as ih =>
    

Proof state:
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)

Next tactic:
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]
theorem card_map_eq_of_inj_on {f : α → β} {as : List α} :
    inj_on f as → card (as.map f) = card as := by
  induction as with
  | nil => simp
  | cons a as ih =>
    cases Decidable.em (f a ∈ map f as) with
    

Proof state:
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)

Next tactic:
| 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]
theorem card_map_eq_of_inj_on {f : α → β} {as : List α} :
    inj_on f as → card (as.map f) = card as := by
  induction as with
  | nil => simp
  | cons a as ih =>
    cases Decidable.em (f a ∈ map f as) with
    | inl h =>
      

Proof state:
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)

Next tactic:
intro inj_on'
theorem card_map_eq_of_inj_on {f : α → β} {as : List α} :
    inj_on f as → card (as.map f) = card as := by
  induction as with
  | nil => simp
  | cons a as ih =>
    cases Decidable.em (f a ∈ map f as) with
    | inl h =>
      intro inj_on'
      

Proof state:
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)

Next tactic:
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]
theorem card_map_eq_of_inj_on {f : α → β} {as : List α} :
    inj_on f as → card (as.map f) = card as := by
  induction as with
  | nil => simp
  | cons a as ih =>
    cases Decidable.em (f a ∈ map f as) with
    | inl h =>
      intro inj_on'
      

Proof state:
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)

Next tactic:
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]