[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
⊢ card 𝒜 * r ≤ card (∂ 𝒜) * (Fintype.card α - r + 1)
[PROOFSTEP]
let i : DecidableRel ((· ⊆ ·) : Finset α → Finset α → Prop) := fun _ _ => Classical.dec _
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
⊢ card 𝒜 * r ≤ card (∂ 𝒜) * (Fintype.card α - r + 1)
[PROOFSTEP]
refine' card_mul_le_card_mul' (· ⊆ ·) (fun s hs => _) (fun s hs => _)
[GOAL]
case refine'_1
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ 𝒜
⊢ r ≤ card (bipartiteBelow (fun x x_1 => x ⊆ x_1) (∂ 𝒜) s)
[PROOFSTEP]
rw [← h𝒜 hs, ← card_image_of_injOn s.erase_injOn]
[GOAL]
case refine'_1
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ 𝒜
⊢ card (image (erase s) s) ≤ card (bipartiteBelow (fun x x_1 => x ⊆ x_1) (∂ 𝒜) s)
[PROOFSTEP]
refine' card_le_of_subset _
[GOAL]
case refine'_1
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ 𝒜
⊢ image (erase s) s ⊆ bipartiteBelow (fun x x_1 => x ⊆ x_1) (∂ 𝒜) s
[PROOFSTEP]
simp_rw [image_subset_iff, mem_bipartiteBelow]
[GOAL]
case refine'_1
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ 𝒜
⊢ ∀ (x : α), x ∈ s → erase s x ∈ ∂ 𝒜 ∧ erase s x ⊆ s
[PROOFSTEP]
exact fun a ha => ⟨erase_mem_shadow hs ha, erase_subset _ _⟩
[GOAL]
case refine'_2
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
⊢ card (bipartiteAbove (fun x x_1 => x ⊆ x_1) 𝒜 s) ≤ Fintype.card α - r + 1
[PROOFSTEP]
refine' le_trans _ tsub_tsub_le_tsub_add
[GOAL]
case refine'_2
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
⊢ card (bipartiteAbove (fun x x_1 => x ⊆ x_1) 𝒜 s) ≤ Fintype.card α - (r - 1)
[PROOFSTEP]
rw [← (Set.Sized.shadow h𝒜) hs, ← card_compl, ← card_image_of_injOn (insert_inj_on' _)]
[GOAL]
case refine'_2
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
⊢ card (bipartiteAbove (fun x x_1 => x ⊆ x_1) 𝒜 s) ≤ card (image (fun a => insert a s) sᶜ)
[PROOFSTEP]
refine'
  card_le_of_subset fun t ht =>
    _
      -- porting note: commented out the following line
        -- infer_instance
[GOAL]
case refine'_2
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
t : Finset α
ht : t ∈ bipartiteAbove (fun x x_1 => x ⊆ x_1) 𝒜 s
⊢ t ∈ image (fun a => insert a s) sᶜ
[PROOFSTEP]
rw [mem_bipartiteAbove] at ht
[GOAL]
case refine'_2
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
t : Finset α
ht : t ∈ 𝒜 ∧ s ⊆ t
⊢ t ∈ image (fun a => insert a s) sᶜ
[PROOFSTEP]
have : ∅ ∉ 𝒜 := by
  rw [← mem_coe, h𝒜.empty_mem_iff, coe_eq_singleton]
  rintro rfl
  rw [shadow_singleton_empty] at hs
  exact not_mem_empty s hs
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
t : Finset α
ht : t ∈ 𝒜 ∧ s ⊆ t
⊢ ¬∅ ∈ 𝒜
[PROOFSTEP]
rw [← mem_coe, h𝒜.empty_mem_iff, coe_eq_singleton]
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
t : Finset α
ht : t ∈ 𝒜 ∧ s ⊆ t
⊢ ¬𝒜 = {∅}
[PROOFSTEP]
rintro rfl
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
r : ℕ
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s t : Finset α
h𝒜 : Set.Sized r ↑{∅}
hs : s ∈ ∂ {∅}
ht : t ∈ {∅} ∧ s ⊆ t
⊢ False
[PROOFSTEP]
rw [shadow_singleton_empty] at hs
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
r : ℕ
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s t : Finset α
h𝒜 : Set.Sized r ↑{∅}
hs : s ∈ ∅
ht : t ∈ {∅} ∧ s ⊆ t
⊢ False
[PROOFSTEP]
exact not_mem_empty s hs
[GOAL]
case refine'_2
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
t : Finset α
ht : t ∈ 𝒜 ∧ s ⊆ t
this : ¬∅ ∈ 𝒜
⊢ t ∈ image (fun a => insert a s) sᶜ
[PROOFSTEP]
have h :=
  exists_eq_insert_iff.2 ⟨ht.2, by rw [(sized_shadow_iff this).1 (Set.Sized.shadow h𝒜) ht.1, (Set.Sized.shadow h𝒜) hs]⟩
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
t : Finset α
ht : t ∈ 𝒜 ∧ s ⊆ t
this : ¬∅ ∈ 𝒜
⊢ card s + 1 = card t
[PROOFSTEP]
rw [(sized_shadow_iff this).1 (Set.Sized.shadow h𝒜) ht.1, (Set.Sized.shadow h𝒜) hs]
[GOAL]
case refine'_2
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
t : Finset α
ht : t ∈ 𝒜 ∧ s ⊆ t
this : ¬∅ ∈ 𝒜
h : ∃ a x, insert a s = t
⊢ t ∈ image (fun a => insert a s) sᶜ
[PROOFSTEP]
rcases h with ⟨a, ha, rfl⟩
[GOAL]
case refine'_2.intro.intro
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
h𝒜 : Set.Sized r ↑𝒜
i : DecidableRel fun x x_1 => x ⊆ x_1 := fun x x_1 => Classical.dec ((fun x x_2 => x ⊆ x_2) x x_1)
s : Finset α
hs : s ∈ ∂ 𝒜
this : ¬∅ ∈ 𝒜
a : α
ha : ¬a ∈ s
ht : insert a s ∈ 𝒜 ∧ s ⊆ insert a s
⊢ insert a s ∈ image (fun a => insert a s) sᶜ
[PROOFSTEP]
exact mem_image_of_mem _ (mem_compl.2 ha)
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
h𝒜 : Set.Sized r ↑𝒜
⊢ ↑(card 𝒜) / ↑(Nat.choose (Fintype.card α) r) ≤ ↑(card (∂ 𝒜)) / ↑(Nat.choose (Fintype.card α) (r - 1))
[PROOFSTEP]
obtain hr' | hr' := lt_or_le (Fintype.card α) r
[GOAL]
case inl
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
h𝒜 : Set.Sized r ↑𝒜
hr' : Fintype.card α < r
⊢ ↑(card 𝒜) / ↑(Nat.choose (Fintype.card α) r) ≤ ↑(card (∂ 𝒜)) / ↑(Nat.choose (Fintype.card α) (r - 1))
[PROOFSTEP]
rw [choose_eq_zero_of_lt hr', cast_zero, div_zero]
[GOAL]
case inl
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
h𝒜 : Set.Sized r ↑𝒜
hr' : Fintype.card α < r
⊢ 0 ≤ ↑(card (∂ 𝒜)) / ↑(Nat.choose (Fintype.card α) (r - 1))
[PROOFSTEP]
exact div_nonneg (cast_nonneg _) (cast_nonneg _)
[GOAL]
case inr
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
h𝒜 : Set.Sized r ↑𝒜
hr' : r ≤ Fintype.card α
⊢ ↑(card 𝒜) / ↑(Nat.choose (Fintype.card α) r) ≤ ↑(card (∂ 𝒜)) / ↑(Nat.choose (Fintype.card α) (r - 1))
[PROOFSTEP]
replace h𝒜 := card_mul_le_card_shadow_mul h𝒜
[GOAL]
case inr
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
hr' : r ≤ Fintype.card α
h𝒜 : card 𝒜 * r ≤ card (∂ 𝒜) * (Fintype.card α - r + 1)
⊢ ↑(card 𝒜) / ↑(Nat.choose (Fintype.card α) r) ≤ ↑(card (∂ 𝒜)) / ↑(Nat.choose (Fintype.card α) (r - 1))
[PROOFSTEP]
rw [div_le_div_iff]
[GOAL]
case inr
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
hr' : r ≤ Fintype.card α
h𝒜 : card 𝒜 * r ≤ card (∂ 𝒜) * (Fintype.card α - r + 1)
⊢ ↑(card 𝒜) * ↑(Nat.choose (Fintype.card α) (r - 1)) ≤ ↑(card (∂ 𝒜)) * ↑(Nat.choose (Fintype.card α) r)
[PROOFSTEP]
norm_cast
[GOAL]
case inr.b0
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
hr' : r ≤ Fintype.card α
h𝒜 : card 𝒜 * r ≤ card (∂ 𝒜) * (Fintype.card α - r + 1)
⊢ 0 < ↑(Nat.choose (Fintype.card α) r)
[PROOFSTEP]
norm_cast
[GOAL]
case inr.d0
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
hr' : r ≤ Fintype.card α
h𝒜 : card 𝒜 * r ≤ card (∂ 𝒜) * (Fintype.card α - r + 1)
⊢ 0 < ↑(Nat.choose (Fintype.card α) (r - 1))
[PROOFSTEP]
norm_cast
[GOAL]
case inr
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
hr' : r ≤ Fintype.card α
h𝒜 : card 𝒜 * r ≤ card (∂ 𝒜) * (Fintype.card α - r + 1)
⊢ card 𝒜 * Nat.choose (Fintype.card α) (r - 1) ≤ card (∂ 𝒜) * Nat.choose (Fintype.card α) r
[PROOFSTEP]
cases' r with r
[GOAL]
case inr.zero
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
hr : zero ≠ 0
hr' : zero ≤ Fintype.card α
h𝒜 : card 𝒜 * zero ≤ card (∂ 𝒜) * (Fintype.card α - zero + 1)
⊢ card 𝒜 * Nat.choose (Fintype.card α) (zero - 1) ≤ card (∂ 𝒜) * Nat.choose (Fintype.card α) zero
[PROOFSTEP]
exact (hr rfl).elim
[GOAL]
case inr.succ
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : succ r ≠ 0
hr' : succ r ≤ Fintype.card α
h𝒜 : card 𝒜 * succ r ≤ card (∂ 𝒜) * (Fintype.card α - succ r + 1)
⊢ card 𝒜 * Nat.choose (Fintype.card α) (succ r - 1) ≤ card (∂ 𝒜) * Nat.choose (Fintype.card α) (succ r)
[PROOFSTEP]
rw [Nat.succ_eq_add_one] at *
[GOAL]
case inr.succ
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r + 1 ≠ 0
hr' : r + 1 ≤ Fintype.card α
h𝒜 : card 𝒜 * (r + 1) ≤ card (∂ 𝒜) * (Fintype.card α - (r + 1) + 1)
⊢ card 𝒜 * Nat.choose (Fintype.card α) (r + 1 - 1) ≤ card (∂ 𝒜) * Nat.choose (Fintype.card α) (r + 1)
[PROOFSTEP]
rw [tsub_add_eq_add_tsub hr', add_tsub_add_eq_tsub_right] at h𝒜
[GOAL]
case inr.succ
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r + 1 ≠ 0
hr' : r + 1 ≤ Fintype.card α
h𝒜 : card 𝒜 * (r + 1) ≤ card (∂ 𝒜) * (Fintype.card α - r)
⊢ card 𝒜 * Nat.choose (Fintype.card α) (r + 1 - 1) ≤ card (∂ 𝒜) * Nat.choose (Fintype.card α) (r + 1)
[PROOFSTEP]
apply le_of_mul_le_mul_right _ (pos_iff_ne_zero.2 hr)
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r + 1 ≠ 0
hr' : r + 1 ≤ Fintype.card α
h𝒜 : card 𝒜 * (r + 1) ≤ card (∂ 𝒜) * (Fintype.card α - r)
⊢ card 𝒜 * Nat.choose (Fintype.card α) (r + 1 - 1) * (r + 1) ≤
    card (∂ 𝒜) * Nat.choose (Fintype.card α) (r + 1) * (r + 1)
[PROOFSTEP]
convert Nat.mul_le_mul_right ((Fintype.card α).choose r) h𝒜 using 1
[GOAL]
case h.e'_3
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r + 1 ≠ 0
hr' : r + 1 ≤ Fintype.card α
h𝒜 : card 𝒜 * (r + 1) ≤ card (∂ 𝒜) * (Fintype.card α - r)
⊢ card 𝒜 * Nat.choose (Fintype.card α) (r + 1 - 1) * (r + 1) = card 𝒜 * (r + 1) * Nat.choose (Fintype.card α) r
[PROOFSTEP]
simp [mul_assoc, Nat.choose_succ_right_eq]
[GOAL]
case h.e'_3
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r + 1 ≠ 0
hr' : r + 1 ≤ Fintype.card α
h𝒜 : card 𝒜 * (r + 1) ≤ card (∂ 𝒜) * (Fintype.card α - r)
⊢ Nat.choose (Fintype.card α) r * (r + 1) = (r + 1) * Nat.choose (Fintype.card α) r ∨ 𝒜 = ∅
[PROOFSTEP]
exact Or.inl (mul_comm _ _)
[GOAL]
case h.e'_4
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r + 1 ≠ 0
hr' : r + 1 ≤ Fintype.card α
h𝒜 : card 𝒜 * (r + 1) ≤ card (∂ 𝒜) * (Fintype.card α - r)
⊢ card (∂ 𝒜) * Nat.choose (Fintype.card α) (r + 1) * (r + 1) =
    card (∂ 𝒜) * (Fintype.card α - r) * Nat.choose (Fintype.card α) r
[PROOFSTEP]
simp only [mul_assoc, choose_succ_right_eq, mul_eq_mul_left_iff]
[GOAL]
case h.e'_4
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r + 1 ≠ 0
hr' : r + 1 ≤ Fintype.card α
h𝒜 : card 𝒜 * (r + 1) ≤ card (∂ 𝒜) * (Fintype.card α - r)
⊢ Nat.choose (Fintype.card α) r * (Fintype.card α - r) = (Fintype.card α - r) * Nat.choose (Fintype.card α) r ∨
    card (∂ 𝒜) = 0
[PROOFSTEP]
exact Or.inl (mul_comm _ _)
[GOAL]
case inr.b0
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
hr' : r ≤ Fintype.card α
h𝒜 : card 𝒜 * r ≤ card (∂ 𝒜) * (Fintype.card α - r + 1)
⊢ 0 < Nat.choose (Fintype.card α) r
[PROOFSTEP]
exact Nat.choose_pos hr'
[GOAL]
case inr.d0
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
inst✝ : Fintype α
𝒜 : Finset (Finset α)
r : ℕ
hr : r ≠ 0
hr' : r ≤ Fintype.card α
h𝒜 : card 𝒜 * r ≤ card (∂ 𝒜) * (Fintype.card α - r + 1)
⊢ 0 < Nat.choose (Fintype.card α) (r - 1)
[PROOFSTEP]
exact Nat.choose_pos (r.pred_le.trans hr')
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s : Finset α
⊢ s ∈ falling k 𝒜 ↔ (∃ t, t ∈ 𝒜 ∧ s ⊆ t) ∧ card s = k
[PROOFSTEP]
simp_rw [falling, mem_sup, mem_powersetLen]
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s : Finset α
⊢ (∃ v, v ∈ 𝒜 ∧ s ⊆ v ∧ card s = k) ↔ (∃ t, t ∈ 𝒜 ∧ s ⊆ t) ∧ card s = k
[PROOFSTEP]
aesop
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s : Finset α
⊢ 𝒜 # k ∪ ∂ (falling (k + 1) 𝒜) = falling k 𝒜
[PROOFSTEP]
ext s
[GOAL]
case a
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
⊢ s ∈ 𝒜 # k ∪ ∂ (falling (k + 1) 𝒜) ↔ s ∈ falling k 𝒜
[PROOFSTEP]
simp_rw [mem_union, mem_slice, mem_shadow_iff, mem_falling]
[GOAL]
case a
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
⊢ (s ∈ 𝒜 ∧ card s = k ∨ ∃ t, ((∃ t_1, t_1 ∈ 𝒜 ∧ t ⊆ t_1) ∧ card t = k + 1) ∧ ∃ a, a ∈ t ∧ erase t a = s) ↔
    (∃ t, t ∈ 𝒜 ∧ s ⊆ t) ∧ card s = k
[PROOFSTEP]
constructor
[GOAL]
case a.mp
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
⊢ (s ∈ 𝒜 ∧ card s = k ∨ ∃ t, ((∃ t_1, t_1 ∈ 𝒜 ∧ t ⊆ t_1) ∧ card t = k + 1) ∧ ∃ a, a ∈ t ∧ erase t a = s) →
    (∃ t, t ∈ 𝒜 ∧ s ⊆ t) ∧ card s = k
[PROOFSTEP]
rintro (h | ⟨s, ⟨⟨t, ht, hst⟩, hs⟩, a, ha, rfl⟩)
[GOAL]
case a.mp.inl
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
h : s ∈ 𝒜 ∧ card s = k
⊢ (∃ t, t ∈ 𝒜 ∧ s ⊆ t) ∧ card s = k
[PROOFSTEP]
exact ⟨⟨s, h.1, Subset.refl _⟩, h.2⟩
[GOAL]
case a.mp.inr.intro.intro.intro.intro.intro.intro.intro
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
hs : card s = k + 1
t : Finset α
ht : t ∈ 𝒜
hst : s ⊆ t
a : α
ha : a ∈ s
⊢ (∃ t, t ∈ 𝒜 ∧ erase s a ⊆ t) ∧ card (erase s a) = k
[PROOFSTEP]
refine' ⟨⟨t, ht, (erase_subset _ _).trans hst⟩, _⟩
[GOAL]
case a.mp.inr.intro.intro.intro.intro.intro.intro.intro
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
hs : card s = k + 1
t : Finset α
ht : t ∈ 𝒜
hst : s ⊆ t
a : α
ha : a ∈ s
⊢ card (erase s a) = k
[PROOFSTEP]
rw [card_erase_of_mem ha, hs]
[GOAL]
case a.mp.inr.intro.intro.intro.intro.intro.intro.intro
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
hs : card s = k + 1
t : Finset α
ht : t ∈ 𝒜
hst : s ⊆ t
a : α
ha : a ∈ s
⊢ k + 1 - 1 = k
[PROOFSTEP]
rfl
[GOAL]
case a.mpr
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
⊢ (∃ t, t ∈ 𝒜 ∧ s ⊆ t) ∧ card s = k →
    s ∈ 𝒜 ∧ card s = k ∨ ∃ t, ((∃ t_1, t_1 ∈ 𝒜 ∧ t ⊆ t_1) ∧ card t = k + 1) ∧ ∃ a, a ∈ t ∧ erase t a = s
[PROOFSTEP]
rintro ⟨⟨t, ht, hst⟩, hs⟩
[GOAL]
case a.mpr.intro.intro.intro
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
hs : card s = k
t : Finset α
ht : t ∈ 𝒜
hst : s ⊆ t
⊢ s ∈ 𝒜 ∧ card s = k ∨ ∃ t, ((∃ t_1, t_1 ∈ 𝒜 ∧ t ⊆ t_1) ∧ card t = k + 1) ∧ ∃ a, a ∈ t ∧ erase t a = s
[PROOFSTEP]
by_cases h : s ∈ 𝒜
[GOAL]
case pos
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
hs : card s = k
t : Finset α
ht : t ∈ 𝒜
hst : s ⊆ t
h : s ∈ 𝒜
⊢ s ∈ 𝒜 ∧ card s = k ∨ ∃ t, ((∃ t_1, t_1 ∈ 𝒜 ∧ t ⊆ t_1) ∧ card t = k + 1) ∧ ∃ a, a ∈ t ∧ erase t a = s
[PROOFSTEP]
exact Or.inl ⟨h, hs⟩
[GOAL]
case neg
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
hs : card s = k
t : Finset α
ht : t ∈ 𝒜
hst : s ⊆ t
h : ¬s ∈ 𝒜
⊢ s ∈ 𝒜 ∧ card s = k ∨ ∃ t, ((∃ t_1, t_1 ∈ 𝒜 ∧ t ⊆ t_1) ∧ card t = k + 1) ∧ ∃ a, a ∈ t ∧ erase t a = s
[PROOFSTEP]
obtain ⟨a, ha, hst⟩ := ssubset_iff.1 (ssubset_of_subset_of_ne hst (ht.ne_of_not_mem h).symm)
[GOAL]
case neg.intro.intro
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
hs : card s = k
t : Finset α
ht : t ∈ 𝒜
hst✝ : s ⊆ t
h : ¬s ∈ 𝒜
a : α
ha : ¬a ∈ s
hst : insert a s ⊆ t
⊢ s ∈ 𝒜 ∧ card s = k ∨ ∃ t, ((∃ t_1, t_1 ∈ 𝒜 ∧ t ⊆ t_1) ∧ card t = k + 1) ∧ ∃ a, a ∈ t ∧ erase t a = s
[PROOFSTEP]
refine' Or.inr ⟨insert a s, ⟨⟨t, ht, hst⟩, _⟩, a, mem_insert_self _ _, erase_insert ha⟩
[GOAL]
case neg.intro.intro
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ s : Finset α
hs : card s = k
t : Finset α
ht : t ∈ 𝒜
hst✝ : s ⊆ t
h : ¬s ∈ 𝒜
a : α
ha : ¬a ∈ s
hst : insert a s ⊆ t
⊢ card (insert a s) = k + 1
[PROOFSTEP]
rw [card_insert_of_not_mem ha, hs]
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ : Finset α
m n : ℕ
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
s : Finset α
h₁ : s ∈ ∂ (falling n 𝒜)
h₂ : s ∈ 𝒜 # m
⊢ False
[PROOFSTEP]
simp_rw [mem_shadow_iff, mem_falling] at h₁
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ : Finset α
m n : ℕ
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
s : Finset α
h₂ : s ∈ 𝒜 # m
h₁ : ∃ t, ((∃ t_1, t_1 ∈ 𝒜 ∧ t ⊆ t_1) ∧ card t = n) ∧ ∃ a, a ∈ t ∧ erase t a = s
⊢ False
[PROOFSTEP]
obtain ⟨s, ⟨⟨t, ht, hst⟩, _⟩, a, ha, rfl⟩ := h₁
[GOAL]
case intro.intro.intro.intro.intro.intro.intro
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ : Finset α
m n : ℕ
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
s : Finset α
right✝ : card s = n
t : Finset α
ht : t ∈ 𝒜
hst : s ⊆ t
a : α
ha : a ∈ s
h₂ : erase s a ∈ 𝒜 # m
⊢ False
[PROOFSTEP]
refine' h𝒜 (slice_subset h₂) ht _ ((erase_subset _ _).trans hst)
[GOAL]
case intro.intro.intro.intro.intro.intro.intro
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ : Finset α
m n : ℕ
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
s : Finset α
right✝ : card s = n
t : Finset α
ht : t ∈ 𝒜
hst : s ⊆ t
a : α
ha : a ∈ s
h₂ : erase s a ∈ 𝒜 # m
⊢ erase s a ≠ t
[PROOFSTEP]
rintro rfl
[GOAL]
case intro.intro.intro.intro.intro.intro.intro
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s✝ : Finset α
m n : ℕ
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
s : Finset α
right✝ : card s = n
a : α
ha : a ∈ s
h₂ : erase s a ∈ 𝒜 # m
ht : erase s a ∈ 𝒜
hst : s ⊆ erase s a
⊢ False
[PROOFSTEP]
exact not_mem_erase _ _ (hst ha)
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s : Finset α
inst✝ : Fintype α
hk : k ≤ Fintype.card α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ ∑ r in range (k + 1), ↑(card (𝒜 # (Fintype.card α - r))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - r)) ≤
    ↑(card (falling (Fintype.card α - k) 𝒜)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - k))
[PROOFSTEP]
induction' k with k ih
[GOAL]
case zero
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s : Finset α
inst✝ : Fintype α
hk✝ : k ≤ Fintype.card α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
hk : zero ≤ Fintype.card α
⊢ ∑ r in range (zero + 1), ↑(card (𝒜 # (Fintype.card α - r))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - r)) ≤
    ↑(card (falling (Fintype.card α - zero) 𝒜)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - zero))
[PROOFSTEP]
simp only [tsub_zero, cast_one, cast_le, sum_singleton, div_one, choose_self, range_one, zero_eq, zero_add, range_one,
  ge_iff_le, sum_singleton, nonpos_iff_eq_zero, tsub_zero, choose_self, cast_one, div_one, cast_le]
[GOAL]
case zero
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
k : ℕ
𝒜 : Finset (Finset α)
s : Finset α
inst✝ : Fintype α
hk✝ : k ≤ Fintype.card α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
hk : zero ≤ Fintype.card α
⊢ card (𝒜 # Fintype.card α) ≤ card (falling (Fintype.card α) 𝒜)
[PROOFSTEP]
exact card_le_of_subset (slice_subset_falling _ _)
[GOAL]
case succ
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
k✝ : ℕ
𝒜 : Finset (Finset α)
s : Finset α
inst✝ : Fintype α
hk✝ : k✝ ≤ Fintype.card α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
k : ℕ
ih :
  k ≤ Fintype.card α →
    ∑ r in range (k + 1), ↑(card (𝒜 # (Fintype.card α - r))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - r)) ≤
      ↑(card (falling (Fintype.card α - k) 𝒜)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - k))
hk : succ k ≤ Fintype.card α
⊢ ∑ r in range (succ k + 1), ↑(card (𝒜 # (Fintype.card α - r))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - r)) ≤
    ↑(card (falling (Fintype.card α - succ k) 𝒜)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - succ k))
[PROOFSTEP]
rw [succ_eq_add_one] at *
[GOAL]
case succ
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
k✝ : ℕ
𝒜 : Finset (Finset α)
s : Finset α
inst✝ : Fintype α
hk✝ : k✝ ≤ Fintype.card α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
k : ℕ
ih :
  k ≤ Fintype.card α →
    ∑ r in range (k + 1), ↑(card (𝒜 # (Fintype.card α - r))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - r)) ≤
      ↑(card (falling (Fintype.card α - k) 𝒜)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - k))
hk : k + 1 ≤ Fintype.card α
⊢ ∑ r in range (k + 1 + 1), ↑(card (𝒜 # (Fintype.card α - r))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - r)) ≤
    ↑(card (falling (Fintype.card α - (k + 1)) 𝒜)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - (k + 1)))
[PROOFSTEP]
rw [sum_range_succ, ← slice_union_shadow_falling_succ,
  card_disjoint_union (IsAntichain.disjoint_slice_shadow_falling h𝒜), cast_add, _root_.add_div, add_comm]
[GOAL]
case succ
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
k✝ : ℕ
𝒜 : Finset (Finset α)
s : Finset α
inst✝ : Fintype α
hk✝ : k✝ ≤ Fintype.card α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
k : ℕ
ih :
  k ≤ Fintype.card α →
    ∑ r in range (k + 1), ↑(card (𝒜 # (Fintype.card α - r))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - r)) ≤
      ↑(card (falling (Fintype.card α - k) 𝒜)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - k))
hk : k + 1 ≤ Fintype.card α
⊢ ↑(card (𝒜 # (Fintype.card α - (k + 1)))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - (k + 1))) +
      ∑ x in range (k + 1), ↑(card (𝒜 # (Fintype.card α - x))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - x)) ≤
    ↑(card (𝒜 # (Fintype.card α - (k + 1)))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - (k + 1))) +
      ↑(card (∂ (falling (Fintype.card α - (k + 1) + 1) 𝒜))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - (k + 1)))
[PROOFSTEP]
rw [← tsub_tsub, tsub_add_cancel_of_le (le_tsub_of_add_le_left hk)]
[GOAL]
case succ
𝕜 : Type u_1
α : Type u_2
inst✝² : LinearOrderedField 𝕜
inst✝¹ : DecidableEq α
k✝ : ℕ
𝒜 : Finset (Finset α)
s : Finset α
inst✝ : Fintype α
hk✝ : k✝ ≤ Fintype.card α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
k : ℕ
ih :
  k ≤ Fintype.card α →
    ∑ r in range (k + 1), ↑(card (𝒜 # (Fintype.card α - r))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - r)) ≤
      ↑(card (falling (Fintype.card α - k) 𝒜)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - k))
hk : k + 1 ≤ Fintype.card α
⊢ ↑(card (𝒜 # (Fintype.card α - k - 1))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - k - 1)) +
      ∑ x in range (k + 1), ↑(card (𝒜 # (Fintype.card α - x))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - x)) ≤
    ↑(card (𝒜 # (Fintype.card α - k - 1))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - k - 1)) +
      ↑(card (∂ (falling (Fintype.card α - k) 𝒜))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - k - 1))
[PROOFSTEP]
exact
  add_le_add_left
    ((ih <| le_of_succ_le hk).trans <|
      card_div_choose_le_card_shadow_div_choose (tsub_pos_iff_lt.2 <| Nat.succ_le_iff.1 hk).ne' <| sized_falling _ _)
    _
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
𝒜 : Finset (Finset α)
s : Finset α
k : ℕ
inst✝ : Fintype α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ ∑ r in range (Fintype.card α + 1), ↑(card (𝒜 # r)) / ↑(Nat.choose (Fintype.card α) r) ≤ 1
[PROOFSTEP]
classical
rw [← sum_flip]
refine' (le_card_falling_div_choose le_rfl h𝒜).trans _
rw [div_le_iff] <;> norm_cast
· simpa only [Nat.sub_self, one_mul, Nat.choose_zero_right, falling] using Set.Sized.card_le (sized_falling 0 𝒜)
· rw [tsub_self, choose_zero_right]
  exact zero_lt_one
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
𝒜 : Finset (Finset α)
s : Finset α
k : ℕ
inst✝ : Fintype α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ ∑ r in range (Fintype.card α + 1), ↑(card (𝒜 # r)) / ↑(Nat.choose (Fintype.card α) r) ≤ 1
[PROOFSTEP]
rw [← sum_flip]
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
𝒜 : Finset (Finset α)
s : Finset α
k : ℕ
inst✝ : Fintype α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ ∑ r in range (Fintype.card α + 1),
      ↑(card (𝒜 # (Fintype.card α - r))) / ↑(Nat.choose (Fintype.card α) (Fintype.card α - r)) ≤
    1
[PROOFSTEP]
refine' (le_card_falling_div_choose le_rfl h𝒜).trans _
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
𝒜 : Finset (Finset α)
s : Finset α
k : ℕ
inst✝ : Fintype α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ ↑(card (falling (Fintype.card α - Fintype.card α) 𝒜)) /
      ↑(Nat.choose (Fintype.card α) (Fintype.card α - Fintype.card α)) ≤
    1
[PROOFSTEP]
rw [div_le_iff]
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
𝒜 : Finset (Finset α)
s : Finset α
k : ℕ
inst✝ : Fintype α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ ↑(card (falling (Fintype.card α - Fintype.card α) 𝒜)) ≤
    1 * ↑(Nat.choose (Fintype.card α) (Fintype.card α - Fintype.card α))
[PROOFSTEP]
norm_cast
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
𝒜 : Finset (Finset α)
s : Finset α
k : ℕ
inst✝ : Fintype α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ 0 < ↑(Nat.choose (Fintype.card α) (Fintype.card α - Fintype.card α))
[PROOFSTEP]
norm_cast
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
𝒜 : Finset (Finset α)
s : Finset α
k : ℕ
inst✝ : Fintype α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ card (falling (Fintype.card α - Fintype.card α) 𝒜) ≤ 1 * Nat.choose (Fintype.card α) (Fintype.card α - Fintype.card α)
[PROOFSTEP]
simpa only [Nat.sub_self, one_mul, Nat.choose_zero_right, falling] using Set.Sized.card_le (sized_falling 0 𝒜)
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
𝒜 : Finset (Finset α)
s : Finset α
k : ℕ
inst✝ : Fintype α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ 0 < Nat.choose (Fintype.card α) (Fintype.card α - Fintype.card α)
[PROOFSTEP]
rw [tsub_self, choose_zero_right]
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
𝒜 : Finset (Finset α)
s : Finset α
k : ℕ
inst✝ : Fintype α
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ 0 < 1
[PROOFSTEP]
exact zero_lt_one
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ card 𝒜 ≤ Nat.choose (Fintype.card α) (Fintype.card α / 2)
[PROOFSTEP]
classical
suffices (∑ r in Iic (Fintype.card α), ((𝒜 # r).card : ℚ) / (Fintype.card α).choose (Fintype.card α / 2)) ≤ 1
  by
  rw [← sum_div, ← Nat.cast_sum, div_le_one] at this
  simp only [cast_le] at this
  rwa [sum_card_slice] at this
  simp only [cast_pos]
  exact choose_pos (Nat.div_le_self _ _)
rw [Iic_eq_Icc, ← Ico_succ_right, bot_eq_zero, Ico_zero_eq_range]
refine' (sum_le_sum fun r hr => _).trans (sum_card_slice_div_choose_le_one h𝒜)
rw [mem_range] at hr
refine' div_le_div_of_le_left _ _ _ <;> norm_cast
· exact Nat.zero_le _
· exact choose_pos (lt_succ_iff.1 hr)
· exact choose_le_middle _ _
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ card 𝒜 ≤ Nat.choose (Fintype.card α) (Fintype.card α / 2)
[PROOFSTEP]
suffices (∑ r in Iic (Fintype.card α), ((𝒜 # r).card : ℚ) / (Fintype.card α).choose (Fintype.card α / 2)) ≤ 1
  by
  rw [← sum_div, ← Nat.cast_sum, div_le_one] at this
  simp only [cast_le] at this
  rwa [sum_card_slice] at this
  simp only [cast_pos]
  exact choose_pos (Nat.div_le_self _ _)
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
this : ∑ r in Iic (Fintype.card α), ↑(card (𝒜 # r)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2)) ≤ 1
⊢ card 𝒜 ≤ Nat.choose (Fintype.card α) (Fintype.card α / 2)
[PROOFSTEP]
rw [← sum_div, ← Nat.cast_sum, div_le_one] at this
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
this : ↑(∑ x in Iic (Fintype.card α), card (𝒜 # x)) ≤ ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2))
⊢ card 𝒜 ≤ Nat.choose (Fintype.card α) (Fintype.card α / 2)
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
this : ↑(∑ x in Iic (Fintype.card α), card (𝒜 # x)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2)) ≤ 1
⊢ 0 < ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2))
[PROOFSTEP]
simp only [cast_le] at this
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
this : ∑ x in Iic (Fintype.card α), card (𝒜 # x) ≤ Nat.choose (Fintype.card α) (Fintype.card α / 2)
⊢ card 𝒜 ≤ Nat.choose (Fintype.card α) (Fintype.card α / 2)
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
this : ↑(∑ x in Iic (Fintype.card α), card (𝒜 # x)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2)) ≤ 1
⊢ 0 < ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2))
[PROOFSTEP]
rwa [sum_card_slice] at this
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
this : ↑(∑ x in Iic (Fintype.card α), card (𝒜 # x)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2)) ≤ 1
⊢ 0 < ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2))
[PROOFSTEP]
simp only [cast_pos]
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
this : ↑(∑ x in Iic (Fintype.card α), card (𝒜 # x)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2)) ≤ 1
⊢ 0 < Nat.choose (Fintype.card α) (Fintype.card α / 2)
[PROOFSTEP]
exact choose_pos (Nat.div_le_self _ _)
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ ∑ r in Iic (Fintype.card α), ↑(card (𝒜 # r)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2)) ≤ 1
[PROOFSTEP]
rw [Iic_eq_Icc, ← Ico_succ_right, bot_eq_zero, Ico_zero_eq_range]
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
⊢ ∑ r in range (succ (Fintype.card α)), ↑(card (𝒜 # r)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2)) ≤ 1
[PROOFSTEP]
refine' (sum_le_sum fun r hr => _).trans (sum_card_slice_div_choose_le_one h𝒜)
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
r : ℕ
hr : r ∈ range (succ (Fintype.card α))
⊢ ↑(card (𝒜 # r)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2)) ≤
    ↑(card (𝒜 # r)) / ↑(Nat.choose (Fintype.card α) r)
[PROOFSTEP]
rw [mem_range] at hr
[GOAL]
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
r : ℕ
hr : r < succ (Fintype.card α)
⊢ ↑(card (𝒜 # r)) / ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2)) ≤
    ↑(card (𝒜 # r)) / ↑(Nat.choose (Fintype.card α) r)
[PROOFSTEP]
refine' div_le_div_of_le_left _ _ _
[GOAL]
case refine'_1
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
r : ℕ
hr : r < succ (Fintype.card α)
⊢ 0 ≤ ↑(card (𝒜 # r))
[PROOFSTEP]
norm_cast
[GOAL]
case refine'_2
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
r : ℕ
hr : r < succ (Fintype.card α)
⊢ 0 < ↑(Nat.choose (Fintype.card α) r)
[PROOFSTEP]
norm_cast
[GOAL]
case refine'_3
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
r : ℕ
hr : r < succ (Fintype.card α)
⊢ ↑(Nat.choose (Fintype.card α) r) ≤ ↑(Nat.choose (Fintype.card α) (Fintype.card α / 2))
[PROOFSTEP]
norm_cast
[GOAL]
case refine'_1
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
r : ℕ
hr : r < succ (Fintype.card α)
⊢ 0 ≤ card (𝒜 # r)
[PROOFSTEP]
exact Nat.zero_le _
[GOAL]
case refine'_2
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
r : ℕ
hr : r < succ (Fintype.card α)
⊢ 0 < Nat.choose (Fintype.card α) r
[PROOFSTEP]
exact choose_pos (lt_succ_iff.1 hr)
[GOAL]
case refine'_3
𝕜 : Type u_1
α : Type u_2
inst✝¹ : LinearOrderedField 𝕜
inst✝ : Fintype α
𝒜 : Finset (Finset α)
h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜
r : ℕ
hr : r < succ (Fintype.card α)
⊢ Nat.choose (Fintype.card α) r ≤ Nat.choose (Fintype.card α) (Fintype.card α / 2)
[PROOFSTEP]
exact choose_le_middle _ _


[GOAL]
α : Type u_1
⊢ LeftInverse toList ofList
[PROOFSTEP]
intro xs
[GOAL]
α : Type u_1
xs : List α
⊢ toList (ofList xs) = xs
[PROOFSTEP]
induction xs
[GOAL]
case nil
α : Type u_1
⊢ toList (ofList []) = []
[PROOFSTEP]
rfl
[GOAL]
case cons
α : Type u_1
head✝ : α
tail✝ : List α
tail_ih✝ : toList (ofList tail✝) = tail✝
⊢ toList (ofList (head✝ :: tail✝)) = head✝ :: tail✝
[PROOFSTEP]
simpa [ofList, toList]
[GOAL]
α : Type u_1
⊢ Function.RightInverse toList ofList
[PROOFSTEP]
intro xs
[GOAL]
α : Type u_1
xs : LazyList α
⊢ ofList (toList xs) = xs
[PROOFSTEP]
induction' xs using LazyList.rec with _ _ _ _ ih
[GOAL]
case nil
α : Type u_1
⊢ ofList (toList nil) = nil
[PROOFSTEP]
rfl
[GOAL]
case cons
α : Type u_1
xs : LazyList α
hd✝ : α
tl✝ : Thunk (LazyList α)
tl_ih✝ : ?m.1024 tl✝
⊢ ofList (toList (cons hd✝ tl✝)) = cons hd✝ tl✝
[PROOFSTEP]
simpa only [toList, ofList, cons.injEq, true_and]
[GOAL]
case mk
α : Type u_1
xs : LazyList α
fn✝ : Unit → LazyList α
ih : ∀ (a : Unit), ofList (toList (fn✝ a)) = fn✝ a
⊢ { fn := fun x => ofList (toList (Thunk.get { fn := fn✝ })) } = { fn := fn✝ }
[PROOFSTEP]
rw [Thunk.get, ih]
[GOAL]
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : x = y
h2 : ¬Thunk.get xs = Thunk.get ys
⊢ Decidable (cons x xs = cons y ys)
[PROOFSTEP]
apply isFalse
[GOAL]
case h
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : x = y
h2 : ¬Thunk.get xs = Thunk.get ys
⊢ ¬cons x xs = cons y ys
[PROOFSTEP]
simp only [cons.injEq, not_and]
[GOAL]
case h
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : x = y
h2 : ¬Thunk.get xs = Thunk.get ys
⊢ x = y → ¬xs = ys
[PROOFSTEP]
intro _ xs_ys
[GOAL]
case h
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : x = y
h2 : ¬Thunk.get xs = Thunk.get ys
a✝ : x = y
xs_ys : xs = ys
⊢ False
[PROOFSTEP]
apply h2
[GOAL]
case h
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : x = y
h2 : ¬Thunk.get xs = Thunk.get ys
a✝ : x = y
xs_ys : xs = ys
⊢ Thunk.get xs = Thunk.get ys
[PROOFSTEP]
rw [xs_ys]
[GOAL]
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : x = y
h2 : Thunk.get xs = Thunk.get ys
⊢ Decidable (cons x xs = cons y ys)
[PROOFSTEP]
apply isTrue
[GOAL]
case h
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : x = y
h2 : Thunk.get xs = Thunk.get ys
⊢ cons x xs = cons y ys
[PROOFSTEP]
congr
[GOAL]
case h.e_tl
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : x = y
h2 : Thunk.get xs = Thunk.get ys
⊢ xs = ys
[PROOFSTEP]
ext
[GOAL]
case h.e_tl.eq
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : x = y
h2 : Thunk.get xs = Thunk.get ys
⊢ Thunk.get xs = Thunk.get ys
[PROOFSTEP]
exact h2
[GOAL]
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : ¬x = y
⊢ Decidable (cons x xs = cons y ys)
[PROOFSTEP]
apply isFalse
[GOAL]
case h
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : ¬x = y
⊢ ¬cons x xs = cons y ys
[PROOFSTEP]
simp only [cons.injEq, not_and]
[GOAL]
case h
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : ¬x = y
⊢ x = y → ¬xs = ys
[PROOFSTEP]
intro
[GOAL]
case h
α : Type u
inst✝ : DecidableEq α
x : α
xs : Thunk (LazyList α)
y : α
ys : Thunk (LazyList α)
h : ¬x = y
a✝ : x = y
⊢ ¬xs = ys
[PROOFSTEP]
contradiction
[GOAL]
α : Type u
inst✝ : DecidableEq α
hd✝ : α
tl✝ : Thunk (LazyList α)
⊢ Decidable (nil = cons hd✝ tl✝)
[PROOFSTEP]
apply isFalse
[GOAL]
case h
α : Type u
inst✝ : DecidableEq α
hd✝ : α
tl✝ : Thunk (LazyList α)
⊢ ¬nil = cons hd✝ tl✝
[PROOFSTEP]
simp
[GOAL]
α : Type u
inst✝ : DecidableEq α
hd✝ : α
tl✝ : Thunk (LazyList α)
⊢ Decidable (cons hd✝ tl✝ = nil)
[PROOFSTEP]
apply isFalse
[GOAL]
case h
α : Type u
inst✝ : DecidableEq α
hd✝ : α
tl✝ : Thunk (LazyList α)
⊢ ¬cons hd✝ tl✝ = nil
[PROOFSTEP]
simp
[GOAL]
⊢ LawfulTraversable LazyList
[PROOFSTEP]
apply Equiv.isLawfulTraversable' listEquivLazyList
[GOAL]
case h₀
⊢ ∀ {α β : Type ?u.19468} (f : α → β), Functor.map f = Equiv.map listEquivLazyList f
[PROOFSTEP]
intros
[GOAL]
case h₁
⊢ ∀ {α β : Type ?u.19468} (f : β), Functor.mapConst f = (Equiv.map listEquivLazyList ∘ const α) f
[PROOFSTEP]
intros
[GOAL]
case h₂
⊢ ∀ {F : Type ?u.19468 → Type ?u.19468} [inst : Applicative F] [inst_1 : LawfulApplicative F] {α β : Type ?u.19468}
    (f : α → F β), traverse f = Equiv.traverse listEquivLazyList f
[PROOFSTEP]
intros
[GOAL]
case h₀
α✝ β✝ : Type ?u.19468
f✝ : α✝ → β✝
⊢ Functor.map f✝ = Equiv.map listEquivLazyList f✝
[PROOFSTEP]
ext
[GOAL]
case h₁
α✝ β✝ : Type ?u.19468
f✝ : β✝
⊢ Functor.mapConst f✝ = (Equiv.map listEquivLazyList ∘ const α✝) f✝
[PROOFSTEP]
ext
[GOAL]
case h₂
F✝ : Type ?u.19468 → Type ?u.19468
inst✝¹ : Applicative F✝
inst✝ : LawfulApplicative F✝
α✝ β✝ : Type ?u.19468
f✝ : α✝ → F✝ β✝
⊢ traverse f✝ = Equiv.traverse listEquivLazyList f✝
[PROOFSTEP]
ext
[GOAL]
case h₀.h
α✝ β✝ : Type ?u.19468
f✝ : α✝ → β✝
x✝ : LazyList α✝
⊢ f✝ <$> x✝ = Equiv.map listEquivLazyList f✝ x✝
[PROOFSTEP]
rename_i f xs
[GOAL]
case h₁.h
α✝ β✝ : Type ?u.19468
f✝ : β✝
x✝ : LazyList α✝
⊢ Functor.mapConst f✝ x✝ = (Equiv.map listEquivLazyList ∘ const α✝) f✝ x✝
[PROOFSTEP]
rename_i f xs
[GOAL]
case h₂.h
F✝ : Type ?u.19468 → Type ?u.19468
inst✝¹ : Applicative F✝
inst✝ : LawfulApplicative F✝
α✝ β✝ : Type ?u.19468
f✝ : α✝ → F✝ β✝
x✝ : LazyList α✝
⊢ traverse f✝ x✝ = Equiv.traverse listEquivLazyList f✝ x✝
[PROOFSTEP]
rename_i f xs
[GOAL]
case h₀.h
α✝ β✝ : Type ?u.19468
f : α✝ → β✝
xs : LazyList α✝
⊢ f <$> xs = Equiv.map listEquivLazyList f xs
[PROOFSTEP]
induction' xs using LazyList.rec with _ _ _ _ ih
[GOAL]
case h₀.h.nil
α✝ β✝ : Type ?u.19468
f : α✝ → β✝
⊢ f <$> nil = Equiv.map listEquivLazyList f nil
[PROOFSTEP]
rfl
[GOAL]
case h₀.h.cons
α✝ β✝ : Type ?u.19468
f : α✝ → β✝
xs : LazyList α✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.19696 tl✝
⊢ f <$> cons hd✝ tl✝ = Equiv.map listEquivLazyList f (cons hd✝ tl✝)
[PROOFSTEP]
simpa only [Equiv.map, Functor.map, listEquivLazyList, Equiv.coe_fn_symm_mk, Equiv.coe_fn_mk, LazyList.traverse,
  Seq.seq, toList, ofList, cons.injEq, true_and]
[GOAL]
case h₀.h.mk
α✝ β✝ : Type ?u.19468
f : α✝ → β✝
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), f <$> fn✝ a = Equiv.map listEquivLazyList f (fn✝ a)
⊢ Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ })) =
    { fn := fun x => ofList (List.map f (toList (Thunk.get { fn := fn✝ }))) }
[PROOFSTEP]
ext
[GOAL]
case h₀.h.mk.eq
α✝ β✝ : Type ?u.19468
f : α✝ → β✝
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), f <$> fn✝ a = Equiv.map listEquivLazyList f (fn✝ a)
⊢ Thunk.get (Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ }))) =
    Thunk.get { fn := fun x => ofList (List.map f (toList (Thunk.get { fn := fn✝ }))) }
[PROOFSTEP]
apply ih
[GOAL]
case h₁.h
α✝ β✝ : Type ?u.19468
f : β✝
xs : LazyList α✝
⊢ Functor.mapConst f xs = (Equiv.map listEquivLazyList ∘ const α✝) f xs
[PROOFSTEP]
simp only [Equiv.map, listEquivLazyList, Equiv.coe_fn_symm_mk, Equiv.coe_fn_mk, comp, Functor.mapConst]
[GOAL]
case h₁.h
α✝ β✝ : Type ?u.19468
f : β✝
xs : LazyList α✝
⊢ LazyList.traverse (const α✝ f) xs = ofList (const α✝ f <$> toList xs)
[PROOFSTEP]
induction' xs using LazyList.rec with _ _ _ _ ih
[GOAL]
case h₁.h.nil
α✝ β✝ : Type ?u.19468
f : β✝
⊢ LazyList.traverse (const α✝ f) nil = ofList (const α✝ f <$> toList nil)
[PROOFSTEP]
rfl
[GOAL]
case h₁.h.cons
α✝ β✝ : Type ?u.19468
f : β✝
xs : LazyList α✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.21260 tl✝
⊢ LazyList.traverse (const α✝ f) (cons hd✝ tl✝) = ofList (const α✝ f <$> toList (cons hd✝ tl✝))
[PROOFSTEP]
simpa only [toList, ofList, LazyList.traverse, Seq.seq, Functor.map, cons.injEq, true_and]
[GOAL]
case h₁.h.mk
α✝ β✝ : Type ?u.19468
f : β✝
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), LazyList.traverse (const α✝ f) (fn✝ a) = ofList (const α✝ f <$> toList (fn✝ a))
⊢ Thunk.pure (LazyList.traverse (const α✝ f) (Thunk.get { fn := fn✝ })) =
    { fn := fun x => ofList (List.map (const α✝ f) (toList (Thunk.get { fn := fn✝ }))) }
[PROOFSTEP]
congr
[GOAL]
case h₁.h.mk.e_a
α✝ β✝ : Type ?u.19468
f : β✝
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), LazyList.traverse (const α✝ f) (fn✝ a) = ofList (const α✝ f <$> toList (fn✝ a))
⊢ LazyList.traverse (const α✝ f) (Thunk.get { fn := fn✝ }) =
    ofList (List.map (const α✝ f) (toList (Thunk.get { fn := fn✝ })))
[PROOFSTEP]
apply ih
[GOAL]
case h₂.h
F✝ : Type ?u.19468 → Type ?u.19468
inst✝¹ : Applicative F✝
inst✝ : LawfulApplicative F✝
α✝ β✝ : Type ?u.19468
f : α✝ → F✝ β✝
xs : LazyList α✝
⊢ traverse f xs = Equiv.traverse listEquivLazyList f xs
[PROOFSTEP]
simp only [traverse, Equiv.traverse, listEquivLazyList, Equiv.coe_fn_mk, Equiv.coe_fn_symm_mk]
[GOAL]
case h₂.h
F✝ : Type ?u.19468 → Type ?u.19468
inst✝¹ : Applicative F✝
inst✝ : LawfulApplicative F✝
α✝ β✝ : Type ?u.19468
f : α✝ → F✝ β✝
xs : LazyList α✝
⊢ LazyList.traverse f xs = ofList <$> List.traverse f (toList xs)
[PROOFSTEP]
induction' xs using LazyList.rec with _ tl ih _ ih
[GOAL]
case h₂.h.nil
F✝ : Type ?u.19468 → Type ?u.19468
inst✝¹ : Applicative F✝
inst✝ : LawfulApplicative F✝
α✝ β✝ : Type ?u.19468
f : α✝ → F✝ β✝
⊢ LazyList.traverse f nil = ofList <$> List.traverse f (toList nil)
[PROOFSTEP]
simp only [List.traverse, map_pure]
[GOAL]
case h₂.h.nil
F✝ : Type ?u.19468 → Type ?u.19468
inst✝¹ : Applicative F✝
inst✝ : LawfulApplicative F✝
α✝ β✝ : Type ?u.19468
f : α✝ → F✝ β✝
⊢ LazyList.traverse f nil = pure (ofList [])
[PROOFSTEP]
rfl
[GOAL]
case h₂.h.cons
F✝ : Type ?u.19468 → Type ?u.19468
inst✝¹ : Applicative F✝
inst✝ : LawfulApplicative F✝
α✝ β✝ : Type ?u.19468
f : α✝ → F✝ β✝
xs : LazyList α✝
hd✝ : α✝
tl : Thunk (LazyList α✝)
ih : ?m.22684 tl
⊢ LazyList.traverse f (cons hd✝ tl) = ofList <$> List.traverse f (toList (cons hd✝ tl))
[PROOFSTEP]
have : tl.get.traverse f = ofList <$> tl.get.toList.traverse f := ih
[GOAL]
case h₂.h.cons
F✝ : Type ?u.19468 → Type ?u.19468
inst✝¹ : Applicative F✝
inst✝ : LawfulApplicative F✝
α✝ β✝ : Type ?u.19468
f : α✝ → F✝ β✝
xs : LazyList α✝
hd✝ : α✝
tl : Thunk (LazyList α✝)
ih this : LazyList.traverse f (Thunk.get tl) = ofList <$> List.traverse f (toList (Thunk.get tl))
⊢ LazyList.traverse f (cons hd✝ tl) = ofList <$> List.traverse f (toList (cons hd✝ tl))
[PROOFSTEP]
simp only [traverse._eq_2, ih, Functor.map_map, seq_map_assoc, toList, List.traverse, map_seq]
[GOAL]
case h₂.h.cons
F✝ : Type ?u.19468 → Type ?u.19468
inst✝¹ : Applicative F✝
inst✝ : LawfulApplicative F✝
α✝ β✝ : Type ?u.19468
f : α✝ → F✝ β✝
xs : LazyList α✝
hd✝ : α✝
tl : Thunk (LazyList α✝)
ih this : LazyList.traverse f (Thunk.get tl) = ofList <$> List.traverse f (toList (Thunk.get tl))
⊢ (Seq.seq (((fun x => x ∘ Thunk.pure ∘ ofList) ∘ cons) <$> f hd✝) fun x => List.traverse f (toList (Thunk.get tl))) =
    Seq.seq (((fun x => ofList ∘ x) ∘ List.cons) <$> f hd✝) fun x => List.traverse f (toList (Thunk.get tl))
[PROOFSTEP]
rfl
[GOAL]
case h₂.h.mk
F✝ : Type ?u.19468 → Type ?u.19468
inst✝¹ : Applicative F✝
inst✝ : LawfulApplicative F✝
α✝ β✝ : Type ?u.19468
f : α✝ → F✝ β✝
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), LazyList.traverse f (fn✝ a) = ofList <$> List.traverse f (toList (fn✝ a))
⊢ LazyList.traverse f (Thunk.get { fn := fn✝ }) = ofList <$> List.traverse f (toList (Thunk.get { fn := fn✝ }))
[PROOFSTEP]
apply ih
[GOAL]
α : Type u_1
xs : LazyList α
⊢ append xs (Thunk.pure nil) = xs
[PROOFSTEP]
induction' xs using LazyList.rec with _ _ _ _ ih
[GOAL]
case nil
α : Type u_1
⊢ append nil (Thunk.pure nil) = nil
[PROOFSTEP]
rfl
[GOAL]
case cons
α : Type u_1
xs : LazyList α
hd✝ : α
tl✝ : Thunk (LazyList α)
tl_ih✝ : ?m.62141 tl✝
⊢ append (cons hd✝ tl✝) (Thunk.pure nil) = cons hd✝ tl✝
[PROOFSTEP]
simpa only [append, cons.injEq, true_and]
[GOAL]
case mk
α : Type u_1
xs : LazyList α
fn✝ : Unit → LazyList α
ih : ∀ (a : Unit), append (fn✝ a) (Thunk.pure nil) = fn✝ a
⊢ { fn := fun x => append (Thunk.get { fn := fn✝ }) (Thunk.pure nil) } = { fn := fn✝ }
[PROOFSTEP]
ext
[GOAL]
case mk.eq
α : Type u_1
xs : LazyList α
fn✝ : Unit → LazyList α
ih : ∀ (a : Unit), append (fn✝ a) (Thunk.pure nil) = fn✝ a
⊢ Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) (Thunk.pure nil) } = Thunk.get { fn := fn✝ }
[PROOFSTEP]
apply ih
[GOAL]
α : Type u_1
xs ys zs : LazyList α
⊢ append (append xs { fn := fun x => ys }) { fn := fun x => zs } =
    append xs { fn := fun x => append ys { fn := fun x => zs } }
[PROOFSTEP]
induction' xs using LazyList.rec with _ _ _ _ ih
[GOAL]
case nil
α : Type u_1
ys zs : LazyList α
⊢ append (append nil { fn := fun x => ys }) { fn := fun x => zs } =
    append nil { fn := fun x => append ys { fn := fun x => zs } }
[PROOFSTEP]
rfl
[GOAL]
case cons
α : Type u_1
xs ys zs : LazyList α
hd✝ : α
tl✝ : Thunk (LazyList α)
tl_ih✝ : ?m.65384 tl✝
⊢ append (append (cons hd✝ tl✝) { fn := fun x => ys }) { fn := fun x => zs } =
    append (cons hd✝ tl✝) { fn := fun x => append ys { fn := fun x => zs } }
[PROOFSTEP]
simpa only [append, cons.injEq, true_and]
[GOAL]
case mk
α : Type u_1
xs ys zs : LazyList α
fn✝ : Unit → LazyList α
ih :
  ∀ (a : Unit),
    append (append (fn✝ a) { fn := fun x => ys }) { fn := fun x => zs } =
      append (fn✝ a) { fn := fun x => append ys { fn := fun x => zs } }
⊢ {
      fn := fun x =>
        append (Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => ys } })
          { fn := fun x => zs } } =
    { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => append ys { fn := fun x => zs } } }
[PROOFSTEP]
ext
[GOAL]
case mk.eq
α : Type u_1
xs ys zs : LazyList α
fn✝ : Unit → LazyList α
ih :
  ∀ (a : Unit),
    append (append (fn✝ a) { fn := fun x => ys }) { fn := fun x => zs } =
      append (fn✝ a) { fn := fun x => append ys { fn := fun x => zs } }
⊢ Thunk.get
      {
        fn := fun x =>
          append (Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => ys } })
            { fn := fun x => zs } } =
    Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => append ys { fn := fun x => zs } } }
[PROOFSTEP]
apply ih
[GOAL]
α : Type u_1
β : Type u_2
xs : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
⊢ LazyList.bind (append xs ys) f = append (LazyList.bind xs f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
[PROOFSTEP]
match xs with
| LazyList.nil => rfl
| LazyList.cons x xs =>
  simp only [append, Thunk.get, LazyList.bind]
  have := append_bind xs.get ys f
  simp only [Thunk.get] at this
  rw [this, append_assoc]
[GOAL]
α : Type u_1
β : Type u_2
xs : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
⊢ LazyList.bind (append nil ys) f = append (LazyList.bind nil f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
⊢ LazyList.bind (append (cons x xs) ys) f =
    append (LazyList.bind (cons x xs) f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
[PROOFSTEP]
simp only [append, Thunk.get, LazyList.bind]
[GOAL]
α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
⊢ append (f x) { fn := fun x => LazyList.bind (append (Thunk.fn xs ()) ys) f } =
    append (append (f x) { fn := fun x => LazyList.bind (Thunk.fn xs ()) f })
      { fn := fun x => LazyList.bind (Thunk.fn ys ()) f }
[PROOFSTEP]
have := append_bind xs.get ys f
[GOAL]
α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
this :
  LazyList.bind (append (Thunk.get xs) ys) f =
    append (LazyList.bind (Thunk.get xs) f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
⊢ append (f x) { fn := fun x => LazyList.bind (append (Thunk.fn xs ()) ys) f } =
    append (append (f x) { fn := fun x => LazyList.bind (Thunk.fn xs ()) f })
      { fn := fun x => LazyList.bind (Thunk.fn ys ()) f }
[PROOFSTEP]
simp only [Thunk.get] at this
[GOAL]
α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
this :
  LazyList.bind (append (Thunk.fn xs ()) ys) f =
    append (LazyList.bind (Thunk.fn xs ()) f) { fn := fun x => LazyList.bind (Thunk.fn ys ()) f }
⊢ append (f x) { fn := fun x => LazyList.bind (append (Thunk.fn xs ()) ys) f } =
    append (append (f x) { fn := fun x => LazyList.bind (Thunk.fn xs ()) f })
      { fn := fun x => LazyList.bind (Thunk.fn ys ()) f }
[PROOFSTEP]
rw [this, append_assoc]
[GOAL]
⊢ ∀ {α : Type ?u.75696} (x : LazyList α), id <$> x = x
[PROOFSTEP]
intro _ xs
[GOAL]
α✝ : Type ?u.75696
xs : LazyList α✝
⊢ id <$> xs = xs
[PROOFSTEP]
induction' xs using LazyList.rec with _ _ _ _ ih
[GOAL]
case nil
α✝ : Type ?u.75696
⊢ id <$> nil = nil
[PROOFSTEP]
rfl
[GOAL]
case cons
α✝ : Type ?u.75696
xs : LazyList α✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.75815 tl✝
⊢ id <$> cons hd✝ tl✝ = cons hd✝ tl✝
[PROOFSTEP]
simpa only [Functor.map, traverse._eq_2, id_eq, Id.map_eq, Seq.seq, cons.injEq, true_and]
[GOAL]
case mk
α✝ : Type ?u.75696
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), id <$> fn✝ a = fn✝ a
⊢ Thunk.pure (LazyList.traverse id (Thunk.get { fn := fn✝ })) = { fn := fn✝ }
[PROOFSTEP]
ext
[GOAL]
case mk.eq
α✝ : Type ?u.75696
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), id <$> fn✝ a = fn✝ a
⊢ Thunk.get (Thunk.pure (LazyList.traverse id (Thunk.get { fn := fn✝ }))) = Thunk.get { fn := fn✝ }
[PROOFSTEP]
apply ih
[GOAL]
⊢ ∀ {α β : Type ?u.75696} (x : α) (f : α → LazyList β), pure x >>= f = f x
[PROOFSTEP]
intros
[GOAL]
α✝ β✝ : Type ?u.75696
x✝ : α✝
f✝ : α✝ → LazyList β✝
⊢ pure x✝ >>= f✝ = f✝ x✝
[PROOFSTEP]
simp only [bind, pure, singleton, LazyList.bind]
[GOAL]
α✝ β✝ : Type ?u.75696
x✝ : α✝
f✝ : α✝ → LazyList β✝
⊢ append (f✝ x✝) { fn := fun x => LazyList.bind (Thunk.get (Thunk.pure nil)) f✝ } = f✝ x✝
[PROOFSTEP]
apply append_nil
[GOAL]
⊢ ∀ {α β γ : Type ?u.75696} (x : LazyList α) (f : α → LazyList β) (g : β → LazyList γ),
    x >>= f >>= g = x >>= fun x => f x >>= g
[PROOFSTEP]
intro _ _ _ xs _ _
[GOAL]
α✝ β✝ γ✝ : Type ?u.75696
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
⊢ xs >>= f✝ >>= g✝ = xs >>= fun x => f✝ x >>= g✝
[PROOFSTEP]
induction' xs using LazyList.rec with _ _ _ _ ih
[GOAL]
case nil
α✝ β✝ γ✝ : Type ?u.75696
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
⊢ nil >>= f✝ >>= g✝ = nil >>= fun x => f✝ x >>= g✝
[PROOFSTEP]
rfl
[GOAL]
case cons
α✝ β✝ γ✝ : Type ?u.75696
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.76333 tl✝
⊢ cons hd✝ tl✝ >>= f✝ >>= g✝ = cons hd✝ tl✝ >>= fun x => f✝ x >>= g✝
[PROOFSTEP]
simp only [bind, LazyList.bind, append_bind]
[GOAL]
case cons
α✝ β✝ γ✝ : Type ?u.75696
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.76333 tl✝
⊢ append (LazyList.bind (f✝ hd✝) g✝)
      { fn := fun x => LazyList.bind (Thunk.get { fn := fun x => LazyList.bind (Thunk.get tl✝) f✝ }) g✝ } =
    append (LazyList.bind (f✝ hd✝) g✝) { fn := fun x => LazyList.bind (Thunk.get tl✝) fun x => LazyList.bind (f✝ x) g✝ }
[PROOFSTEP]
congr
[GOAL]
case mk
α✝ β✝ γ✝ : Type ?u.75696
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), fn✝ a >>= f✝ >>= g✝ = fn✝ a >>= fun x => f✝ x >>= g✝
⊢ { fn := fun x => LazyList.bind (Thunk.get { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) f✝ }) g✝ } =
    { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) fun x => LazyList.bind (f✝ x) g✝ }
[PROOFSTEP]
congr
[GOAL]
case mk.e_fn
α✝ β✝ γ✝ : Type ?u.75696
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), fn✝ a >>= f✝ >>= g✝ = fn✝ a >>= fun x => f✝ x >>= g✝
⊢ (fun x => LazyList.bind (Thunk.get { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) f✝ }) g✝) = fun x =>
    LazyList.bind (Thunk.get { fn := fn✝ }) fun x => LazyList.bind (f✝ x) g✝
[PROOFSTEP]
funext
[GOAL]
case mk.e_fn.h
α✝ β✝ γ✝ : Type ?u.75696
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), fn✝ a >>= f✝ >>= g✝ = fn✝ a >>= fun x => f✝ x >>= g✝
x✝ : Unit
⊢ LazyList.bind (Thunk.get { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) f✝ }) g✝ =
    LazyList.bind (Thunk.get { fn := fn✝ }) fun x => LazyList.bind (f✝ x) g✝
[PROOFSTEP]
apply ih
[GOAL]
⊢ ∀ {α β : Type ?u.75696} (f : α → β) (x : LazyList α),
    (do
        let y ← x
        pure (f y)) =
      f <$> x
[PROOFSTEP]
intro _ _ f xs
[GOAL]
α✝ β✝ : Type ?u.75696
f : α✝ → β✝
xs : LazyList α✝
⊢ (do
      let y ← xs
      pure (f y)) =
    f <$> xs
[PROOFSTEP]
simp only [bind, Functor.map, pure, singleton]
[GOAL]
α✝ β✝ : Type ?u.75696
f : α✝ → β✝
xs : LazyList α✝
⊢ (LazyList.bind xs fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f xs
[PROOFSTEP]
induction' xs using LazyList.rec with _ _ _ _ ih
[GOAL]
case nil
α✝ β✝ : Type ?u.75696
f : α✝ → β✝
⊢ (LazyList.bind nil fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f nil
[PROOFSTEP]
rfl
[GOAL]
case cons
α✝ β✝ : Type ?u.75696
f : α✝ → β✝
xs : LazyList α✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.77095 tl✝
⊢ (LazyList.bind (cons hd✝ tl✝) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (cons hd✝ tl✝)
[PROOFSTEP]
simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]
[GOAL]
case cons
α✝ β✝ : Type ?u.75696
f : α✝ → β✝
xs : LazyList α✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.77095 tl✝
⊢ cons (f hd✝)
      {
        fn := fun x =>
          append (Thunk.get (Thunk.pure nil))
            { fn := fun x => LazyList.bind (Thunk.get tl✝) fun y => cons (f y) (Thunk.pure nil) } } =
    Seq.seq (cons (f hd✝)) fun x => Thunk.pure (LazyList.traverse f (Thunk.get tl✝))
[PROOFSTEP]
congr
[GOAL]
case mk
α✝ β✝ : Type ?u.75696
f : α✝ → β✝
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), (LazyList.bind (fn✝ a) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (fn✝ a)
⊢ {
      fn := fun x =>
        append (Thunk.get (Thunk.pure nil))
          { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) fun y => cons (f y) (Thunk.pure nil) } } =
    (fun x => Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ }))) ()
[PROOFSTEP]
ext
[GOAL]
case mk.eq
α✝ β✝ : Type ?u.75696
f : α✝ → β✝
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), (LazyList.bind (fn✝ a) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (fn✝ a)
⊢ Thunk.get
      {
        fn := fun x =>
          append (Thunk.get (Thunk.pure nil))
            { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) fun y => cons (f y) (Thunk.pure nil) } } =
    Thunk.get ((fun x => Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ }))) ())
[PROOFSTEP]
apply ih
[GOAL]
α : Type ?u.93639
inst✝ : DecidableEq α
x : α
⊢ Decidable (x ∈ nil)
[PROOFSTEP]
apply Decidable.isFalse
[GOAL]
case h
α : Type ?u.93639
inst✝ : DecidableEq α
x : α
⊢ ¬x ∈ nil
[PROOFSTEP]
simp [Membership.mem, LazyList.Mem]
[GOAL]
α : Type ?u.93639
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : x = y
⊢ Decidable (x ∈ cons y ys)
[PROOFSTEP]
apply Decidable.isTrue
[GOAL]
case h
α : Type ?u.93639
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : x = y
⊢ x ∈ cons y ys
[PROOFSTEP]
simp only [Membership.mem, LazyList.Mem]
[GOAL]
case h
α : Type ?u.93639
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : x = y
⊢ x = y ∨ LazyList.Mem x (Thunk.get ys)
[PROOFSTEP]
exact Or.inl h
[GOAL]
α : Type ?u.93639
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : ¬x = y
⊢ Decidable (x ∈ cons y ys)
[PROOFSTEP]
have := Mem.decidable x ys.get
[GOAL]
α : Type ?u.93639
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : ¬x = y
this : Decidable (x ∈ Thunk.get ys)
⊢ Decidable (x ∈ cons y ys)
[PROOFSTEP]
have : (x ∈ ys.get) ↔ (x ∈ cons y ys) := by simp [(· ∈ ·), LazyList.Mem, h]
[GOAL]
α : Type ?u.93639
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : ¬x = y
this : Decidable (x ∈ Thunk.get ys)
⊢ x ∈ Thunk.get ys ↔ x ∈ cons y ys
[PROOFSTEP]
simp [(· ∈ ·), LazyList.Mem, h]
[GOAL]
α : Type ?u.93639
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : ¬x = y
this✝ : Decidable (x ∈ Thunk.get ys)
this : x ∈ Thunk.get ys ↔ x ∈ cons y ys
⊢ Decidable (x ∈ cons y ys)
[PROOFSTEP]
exact decidable_of_decidable_of_iff this
[GOAL]
α : Type u_1
x y : α
ys : Thunk (LazyList α)
⊢ x ∈ cons y ys ↔ x = y ∨ x ∈ Thunk.get ys
[PROOFSTEP]
simp [Membership.mem, LazyList.Mem]
[GOAL]
α : Type u_1
p : α → Prop
a : α
l : Thunk (LazyList α)
⊢ (∀ (x : α), x ∈ cons a l → p x) ↔ p a ∧ ∀ (x : α), x ∈ Thunk.get l → p x
[PROOFSTEP]
simp only [Membership.mem, LazyList.Mem, or_imp, forall_and, forall_eq]


[GOAL]
α : Type u
inst✝ : LinearOrder α
⊢ IsTotalPreorder α fun x x_1 => x ≤ x_1
[PROOFSTEP]
infer_instance
  -- porting note: added
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b = Ordering.lt ↔ a < b
[PROOFSTEP]
rw [LinearOrder.compare_eq_compareOfLessAndEq, compareOfLessAndEq]
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ (if a < b then Ordering.lt else if a = b then Ordering.eq else Ordering.gt) = Ordering.lt ↔ a < b
[PROOFSTEP]
split_ifs
[GOAL]
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝ : a < b
⊢ Ordering.lt = Ordering.lt ↔ a < b
[PROOFSTEP]
simp only [*, lt_irrefl]
[GOAL]
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : a = b
⊢ False ↔ a < b
[PROOFSTEP]
simp only [*, lt_irrefl]
[GOAL]
case neg
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : ¬a = b
⊢ False ↔ a < b
[PROOFSTEP]
simp only [*, lt_irrefl]
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b = Ordering.gt ↔ a > b
[PROOFSTEP]
rw [LinearOrder.compare_eq_compareOfLessAndEq, compareOfLessAndEq]
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ (if a < b then Ordering.lt else if a = b then Ordering.eq else Ordering.gt) = Ordering.gt ↔ a > b
[PROOFSTEP]
split_ifs
[GOAL]
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝ : a < b
⊢ False ↔ a > b
[PROOFSTEP]
simp only [*, lt_irrefl, not_lt_of_gt]
[GOAL]
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : a = b
⊢ False ↔ a > b
[PROOFSTEP]
simp only [*, lt_irrefl, not_lt_of_gt]
[GOAL]
case neg
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : ¬a = b
⊢ Ordering.gt = Ordering.gt ↔ a > b
[PROOFSTEP]
simp only [*, lt_irrefl, not_lt_of_gt]
[GOAL]
case neg
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : ¬a = b
⊢ True ↔ a > b
[PROOFSTEP]
case _ h₁ h₂ =>
  have h : b < a := lt_trichotomy a b |>.resolve_left h₁ |>.resolve_left h₂
  exact true_iff_iff.2 h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
h₁ : ¬a < b
h₂ : ¬a = b
⊢ True ↔ a > b
[PROOFSTEP]
case _ h₁ h₂ =>
  have h : b < a := lt_trichotomy a b |>.resolve_left h₁ |>.resolve_left h₂
  exact true_iff_iff.2 h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
h₁ : ¬a < b
h₂ : ¬a = b
⊢ True ↔ a > b
[PROOFSTEP]
have h : b < a := lt_trichotomy a b |>.resolve_left h₁ |>.resolve_left h₂
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
h₁ : ¬a < b
h₂ : ¬a = b
h : b < a
⊢ True ↔ a > b
[PROOFSTEP]
exact true_iff_iff.2 h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b = Ordering.eq ↔ a = b
[PROOFSTEP]
rw [LinearOrder.compare_eq_compareOfLessAndEq, compareOfLessAndEq]
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ (if a < b then Ordering.lt else if a = b then Ordering.eq else Ordering.gt) = Ordering.eq ↔ a = b
[PROOFSTEP]
split_ifs
[GOAL]
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝ : a < b
⊢ False ↔ a = b
[PROOFSTEP]
try simp only []
[GOAL]
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝ : a < b
⊢ False ↔ a = b
[PROOFSTEP]
simp only []
[GOAL]
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : a = b
⊢ Ordering.eq = Ordering.eq ↔ a = b
[PROOFSTEP]
try simp only []
[GOAL]
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : a = b
⊢ Ordering.eq = Ordering.eq ↔ a = b
[PROOFSTEP]
simp only []
[GOAL]
case neg
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : ¬a = b
⊢ False ↔ a = b
[PROOFSTEP]
try simp only []
[GOAL]
case neg
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : ¬a = b
⊢ False ↔ a = b
[PROOFSTEP]
simp only []
[GOAL]
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝ : a < b
⊢ False ↔ a = b
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : a = b
⊢ True ↔ a = b
case neg α : Type u inst✝ : LinearOrder α a b : α h✝¹ : ¬a < b h✝ : ¬a = b ⊢ False ↔ a = b
[PROOFSTEP]
case _ h => exact false_iff_iff.2 <| ne_iff_lt_or_gt.2 <| .inl h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
h : a < b
⊢ False ↔ a = b
[PROOFSTEP]
case _ h => exact false_iff_iff.2 <| ne_iff_lt_or_gt.2 <| .inl h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
h : a < b
⊢ False ↔ a = b
[PROOFSTEP]
exact false_iff_iff.2 <| ne_iff_lt_or_gt.2 <| .inl h
[GOAL]
case pos
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : a = b
⊢ True ↔ a = b
case neg α : Type u inst✝ : LinearOrder α a b : α h✝¹ : ¬a < b h✝ : ¬a = b ⊢ False ↔ a = b
[PROOFSTEP]
case _ _ h => exact true_iff_iff.2 h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
h✝ : ¬a < b
h : a = b
⊢ True ↔ a = b
[PROOFSTEP]
case _ _ h => exact true_iff_iff.2 h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
h✝ : ¬a < b
h : a = b
⊢ True ↔ a = b
[PROOFSTEP]
exact true_iff_iff.2 h
[GOAL]
case neg
α : Type u
inst✝ : LinearOrder α
a b : α
h✝¹ : ¬a < b
h✝ : ¬a = b
⊢ False ↔ a = b
[PROOFSTEP]
case _ _ h => exact false_iff_iff.2 h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
h✝ : ¬a < b
h : ¬a = b
⊢ False ↔ a = b
[PROOFSTEP]
case _ _ h => exact false_iff_iff.2 h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
h✝ : ¬a < b
h : ¬a = b
⊢ False ↔ a = b
[PROOFSTEP]
exact false_iff_iff.2 h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b ≠ Ordering.gt ↔ a ≤ b
[PROOFSTEP]
cases h : compare a b
[GOAL]
case lt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.lt
⊢ Ordering.lt ≠ Ordering.gt ↔ a ≤ b
[PROOFSTEP]
simp only []
[GOAL]
case eq
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.eq
⊢ Ordering.eq ≠ Ordering.gt ↔ a ≤ b
[PROOFSTEP]
simp only []
[GOAL]
case gt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.gt
⊢ Ordering.gt ≠ Ordering.gt ↔ a ≤ b
[PROOFSTEP]
simp only []
[GOAL]
case lt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.lt
⊢ True ↔ a ≤ b
[PROOFSTEP]
exact true_iff_iff.2 <| le_of_lt <| compare_lt_iff_lt.1 h
[GOAL]
case eq
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.eq
⊢ True ↔ a ≤ b
[PROOFSTEP]
exact true_iff_iff.2 <| le_of_eq <| compare_eq_iff_eq.1 h
[GOAL]
case gt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.gt
⊢ False ↔ a ≤ b
[PROOFSTEP]
exact false_iff_iff.2 <| not_le_of_gt <| compare_gt_iff_gt.1 h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b ≠ Ordering.lt ↔ a ≥ b
[PROOFSTEP]
cases h : compare a b
[GOAL]
case lt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.lt
⊢ Ordering.lt ≠ Ordering.lt ↔ a ≥ b
[PROOFSTEP]
simp only []
[GOAL]
case eq
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.eq
⊢ Ordering.eq ≠ Ordering.lt ↔ a ≥ b
[PROOFSTEP]
simp only []
[GOAL]
case gt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.gt
⊢ Ordering.gt ≠ Ordering.lt ↔ a ≥ b
[PROOFSTEP]
simp only []
[GOAL]
case lt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.lt
⊢ False ↔ a ≥ b
[PROOFSTEP]
exact false_iff_iff.2 <| (lt_iff_not_ge a b).1 <| compare_lt_iff_lt.1 h
[GOAL]
case eq
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.eq
⊢ True ↔ a ≥ b
[PROOFSTEP]
exact true_iff_iff.2 <| le_of_eq <| (·.symm) <| compare_eq_iff_eq.1 h
[GOAL]
case gt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.gt
⊢ True ↔ a ≥ b
[PROOFSTEP]
exact true_iff_iff.2 <| le_of_lt <| compare_gt_iff_gt.1 h
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
o : Ordering
⊢ compare a b = o ↔ Ordering.toRel o a b
[PROOFSTEP]
cases o
[GOAL]
case lt
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b = Ordering.lt ↔ Ordering.toRel Ordering.lt a b
[PROOFSTEP]
simp only [Ordering.toRel]
[GOAL]
case eq
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b = Ordering.eq ↔ Ordering.toRel Ordering.eq a b
[PROOFSTEP]
simp only [Ordering.toRel]
[GOAL]
case gt
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b = Ordering.gt ↔ Ordering.toRel Ordering.gt a b
[PROOFSTEP]
simp only [Ordering.toRel]
[GOAL]
case lt
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b = Ordering.lt ↔ a < b
[PROOFSTEP]
exact compare_lt_iff_lt
[GOAL]
case eq
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b = Ordering.eq ↔ a = b
[PROOFSTEP]
exact compare_eq_iff_eq
[GOAL]
case gt
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ compare a b = Ordering.gt ↔ a > b
[PROOFSTEP]
exact compare_gt_iff_gt
[GOAL]
α : Type u
inst✝ : LinearOrder α
a b : α
⊢ Ordering.swap (compare a b) = compare b a
[PROOFSTEP]
cases h : compare a b
[GOAL]
case lt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.lt
⊢ Ordering.swap Ordering.lt = compare b a
[PROOFSTEP]
simp only [Ordering.swap]
[GOAL]
case eq
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.eq
⊢ Ordering.swap Ordering.eq = compare b a
[PROOFSTEP]
simp only [Ordering.swap]
[GOAL]
case gt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.gt
⊢ Ordering.swap Ordering.gt = compare b a
[PROOFSTEP]
simp only [Ordering.swap]
[GOAL]
case lt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.lt
⊢ Ordering.gt = compare b a
[PROOFSTEP]
symm
[GOAL]
case eq
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.eq
⊢ Ordering.eq = compare b a
[PROOFSTEP]
symm
[GOAL]
case gt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.gt
⊢ Ordering.lt = compare b a
[PROOFSTEP]
symm
[GOAL]
case lt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.lt
⊢ compare b a = Ordering.gt
[PROOFSTEP]
exact compare_gt_iff_gt.2 <| compare_lt_iff_lt.1 h
[GOAL]
case eq
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.eq
⊢ compare b a = Ordering.eq
[PROOFSTEP]
exact compare_eq_iff_eq.2 <| compare_eq_iff_eq.1 h |>.symm
[GOAL]
case gt
α : Type u
inst✝ : LinearOrder α
a b : α
h : compare a b = Ordering.gt
⊢ compare b a = Ordering.lt
[PROOFSTEP]
exact compare_lt_iff_lt.2 <| compare_gt_iff_gt.1 h