Theorem: Colex.sum_two_pow_lt_iff_lt
File: Mathlib/Combinatorics/Colex.lean

tactic: refine'
  ⟨fun h => (lt_trichotomy A B).resolve_right fun h₁ => h₁.elim _ (not_lt_of_gt h ∘ z _ _), z A B⟩
state_before: α : Type ?u.84084
A B : Finset ℕ
z : ∀ (A B : Finset ℕ), toColex A < toColex B → ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i
⊢ ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i ↔ toColex A < toColex B

tactic: rintro rfl
state_before: α : Type ?u.84084
A B : Finset ℕ
z : ∀ (A B : Finset ℕ), toColex A < toColex B → ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i
h : ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i
h₁ : A = B ∨ B < A
⊢ A = B → False

tactic: apply irrefl _ h
state_before: α : Type ?u.84084
A : Finset ℕ
z : ∀ (A B : Finset ℕ), toColex A < toColex B → ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i
h : ∑ i in A, 2 ^ i < ∑ i in A, 2 ^ i
h₁ : A = A ∨ A < A
⊢ False

tactic: intro A B
state_before: α : Type ?u.84084
A B : Finset ℕ
⊢ ∀ (A B : Finset ℕ), toColex A < toColex B → ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i

tactic: rw [← sdiff_lt_sdiff_iff_lt, Colex.lt_def]
state_before: α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
⊢ toColex A < toColex B → ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i

tactic: rintro ⟨k, z, kA, kB⟩
state_before: α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
⊢ (∃ k, (∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)) ∧ ¬k ∈ A \ B ∧ k ∈ B \ A) → ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i

tactic: rw [← sdiff_union_inter A B]
state_before: case intro.intro.intro
α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
⊢ ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i

tactic: conv_rhs => rw [← sdiff_union_inter B A]
state_before: case intro.intro.intro
α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
⊢ ∑ i in A \ B ∪ A ∩ B, 2 ^ i < ∑ i in B, 2 ^ i

tactic: rw [sum_union (disjoint_sdiff_inter _ _), sum_union (disjoint_sdiff_inter _ _), inter_comm,
  add_lt_add_iff_right]
state_before: case intro.intro.intro
α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
⊢ ∑ i in A \ B ∪ A ∩ B, 2 ^ i < ∑ i in B \ A ∪ B ∩ A, 2 ^ i

tactic: apply lt_of_lt_of_le (@Nat.sum_two_pow_lt k (A \ B) _)
state_before: case intro.intro.intro
α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
⊢ ∑ x in A \ B, 2 ^ x < ∑ x in B \ A, 2 ^ x

tactic: intro x hx
state_before: α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
⊢ ∀ {x : ℕ}, x ∈ A \ B → x < k

tactic: apply lt_of_le_of_ne (le_of_not_lt _)
state_before: α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
x : ℕ
hx : x ∈ A \ B
⊢ x < k

tactic: intro kx
state_before: α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
x : ℕ
hx : x ∈ A \ B
⊢ ¬k < x

tactic: have := (z kx).1 hx
state_before: α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
x : ℕ
hx : x ∈ A \ B
kx : k < x
⊢ False

tactic: rw [mem_sdiff] at this hx
state_before: α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
x : ℕ
hx : x ∈ A \ B
kx : k < x
this : x ∈ B \ A
⊢ False

tactic: exact hx.2 this.1
state_before: α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
x : ℕ
hx : x ∈ A ∧ ¬x ∈ B
kx : k < x
this : x ∈ B ∧ ¬x ∈ A
⊢ False

tactic: apply single_le_sum (fun _ _ => Nat.zero_le _) kB
state_before: case intro.intro.intro
α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
⊢ 2 ^ k ≤ ∑ x in B \ A, 2 ^ x

tactic: apply ne_of_mem_of_not_mem hx kA
state_before: α : Type ?u.84084
A✝ B✝ A B : Finset ℕ
k : ℕ
z : ∀ {x : ℕ}, k < x → (x ∈ A \ B ↔ x ∈ B \ A)
kA : ¬k ∈ A \ B
kB : k ∈ B \ A
x : ℕ
hx : x ∈ A \ B
⊢ x ≠ k