Theorem: Behrend.card_sphere_le_rothNumberNat
File: Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean

tactic: cases n
state_before: α : Type u_1
β : Type u_2
n✝ d✝ k✝ N : ℕ
x : Fin n✝ → ℕ
n d k : ℕ
⊢ (sphere n d k).card ≤ rothNumberNat ((2 * d - 1) ^ n)
state_after: case zero
α : Type u_1
β : Type u_2
n d✝ k✝ N : ℕ
x : Fin n → ℕ
d k : ℕ
⊢ (sphere 0 d k).card ≤ rothNumberNat ((2 * d - 1) ^ 0)

case succ
α : Type u_1
β : Type u_2
n d✝ k✝ N : ℕ
x : Fin n → ℕ
d k n✝ : ℕ
⊢ (sphere (n✝ + 1) d k).card ≤ rothNumberNat ((2 * d - 1) ^ (n✝ + 1))

tactic: cases d
state_before: case succ
α : Type u_1
β : Type u_2
n d✝ k✝ N : ℕ
x : Fin n → ℕ
d k n✝ : ℕ
⊢ (sphere (n✝ + 1) d k).card ≤ rothNumberNat ((2 * d - 1) ^ (n✝ + 1))
state_after: case succ.zero
α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝ : ℕ
⊢ (sphere (n✝ + 1) 0 k).card ≤ rothNumberNat ((2 * 0 - 1) ^ (n✝ + 1))

case succ.succ
α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ (sphere (n✝¹ + 1) (n✝ + 1) k).card ≤ rothNumberNat ((2 * (n✝ + 1) - 1) ^ (n✝¹ + 1))

tactic: apply threeAPFree_image_sphere.le_rothNumberNat _ _ (card_image_of_injOn _)
state_before: case succ.succ
α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ (sphere (n✝¹ + 1) (n✝ + 1) k).card ≤ rothNumberNat ((2 * (n✝ + 1) - 1) ^ (n✝¹ + 1))
state_after: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ Fin (n✝¹ + 1) → ℕ

α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ ∀ x ∈ image (⇑(map (2 * (n✝ + 1) - 1))) (sphere (n✝¹ + 1) (n✝ + 1) k), x < (2 * (n✝ + 1) - 1) ^ (n✝¹ + 1)

α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ Set.InjOn ⇑(map (2 * (n✝ + 1) - 1)) ↑(sphere (n✝¹ + 1) (n✝ + 1) k)

tactic: apply map_injOn.mono fun x => ?_
state_before: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ Set.InjOn ⇑(map (2 * (n✝ + 1) - 1)) ↑(sphere (n✝¹ + 1) (n✝ + 1) k)
state_after: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ Fin (n✝¹ + 1) → ℕ

α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x✝ : Fin n → ℕ
k n✝¹ n✝ : ℕ
x : Fin (n✝¹ + 1) → ℕ
⊢ x ∈ ↑(sphere (n✝¹ + 1) (n✝ + 1) k) → x ∈ {x | ∀ (i : Fin (n✝¹ + 1)), x i < 2 * (n✝ + 1) - 1}

tactic: simp only [mem_coe, sphere, mem_filter, mem_box, and_imp, two_mul]
state_before: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x✝ : Fin n → ℕ
k n✝¹ n✝ : ℕ
x : Fin (n✝¹ + 1) → ℕ
⊢ x ∈ ↑(sphere (n✝¹ + 1) (n✝ + 1) k) → x ∈ {x | ∀ (i : Fin (n✝¹ + 1)), x i < 2 * (n✝ + 1) - 1}
state_after: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x✝ : Fin n → ℕ
k n✝¹ n✝ : ℕ
x : Fin (n✝¹ + 1) → ℕ
⊢ (∀ (i : Fin (n✝¹ + 1)), x i < n✝ + 1) →
    ∑ i : Fin (n✝¹ + 1), x i ^ 2 = k → x ∈ {x | ∀ (i : Fin (n✝¹ + 1)), x i < n✝ + 1 + (n✝ + 1) - 1}

tactic: exact fun h _ i => (h i).trans_le le_self_add
state_before: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x✝ : Fin n → ℕ
k n✝¹ n✝ : ℕ
x : Fin (n✝¹ + 1) → ℕ
⊢ (∀ (i : Fin (n✝¹ + 1)), x i < n✝ + 1) →
    ∑ i : Fin (n✝¹ + 1), x i ^ 2 = k → x ∈ {x | ∀ (i : Fin (n✝¹ + 1)), x i < n✝ + 1 + (n✝ + 1) - 1}
state_after: no goals

tactic: dsimp
state_before: case zero
α : Type u_1
β : Type u_2
n d✝ k✝ N : ℕ
x : Fin n → ℕ
d k : ℕ
⊢ (sphere 0 d k).card ≤ rothNumberNat ((2 * d - 1) ^ 0)
state_after: case zero
α : Type u_1
β : Type u_2
n d✝ k✝ N : ℕ
x : Fin n → ℕ
d k : ℕ
⊢ (sphere 0 d k).card ≤ rothNumberNat 1

tactic: refine (card_le_univ _).trans_eq ?_
state_before: case zero
α : Type u_1
β : Type u_2
n d✝ k✝ N : ℕ
x : Fin n → ℕ
d k : ℕ
⊢ (sphere 0 d k).card ≤ rothNumberNat 1
state_after: case zero
α : Type u_1
β : Type u_2
n d✝ k✝ N : ℕ
x : Fin n → ℕ
d k : ℕ
⊢ Fintype.card (Fin 0 → ℕ) = rothNumberNat 1

tactic: rfl
state_before: case zero
α : Type u_1
β : Type u_2
n d✝ k✝ N : ℕ
x : Fin n → ℕ
d k : ℕ
⊢ Fintype.card (Fin 0 → ℕ) = rothNumberNat 1
state_after: no goals

tactic: simp
state_before: case succ.zero
α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝ : ℕ
⊢ (sphere (n✝ + 1) 0 k).card ≤ rothNumberNat ((2 * 0 - 1) ^ (n✝ + 1))
state_after: no goals

tactic: intro
state_before: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ Fin (n✝¹ + 1) → ℕ
state_after: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
a✝ : Fin (n✝¹ + 1)
⊢ ℕ

tactic: assumption
state_before: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
a✝ : Fin (n✝¹ + 1)
⊢ ℕ
state_after: no goals

tactic: simp only [subset_iff, mem_image, and_imp, forall_exists_index, mem_range,
  forall_apply_eq_imp_iff₂, sphere, mem_filter]
state_before: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ ∀ x ∈ image (⇑(map (2 * (n✝ + 1) - 1))) (sphere (n✝¹ + 1) (n✝ + 1) k), x < (2 * (n✝ + 1) - 1) ^ (n✝¹ + 1)
state_after: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ ∀ (x : ℕ),
    ∀ x_1 ∈ box (n✝¹ + 1) (n✝ + 1),
      ∑ i : Fin (n✝¹ + 1), x_1 i ^ 2 = k → (map (2 * (n✝ + 1) - 1)) x_1 = x → x < (2 * (n✝ + 1) - 1) ^ (n✝¹ + 1)

tactic: rintro _ x hx _ rfl
state_before: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x : Fin n → ℕ
k n✝¹ n✝ : ℕ
⊢ ∀ (x : ℕ),
    ∀ x_1 ∈ box (n✝¹ + 1) (n✝ + 1),
      ∑ i : Fin (n✝¹ + 1), x_1 i ^ 2 = k → (map (2 * (n✝ + 1) - 1)) x_1 = x → x < (2 * (n✝ + 1) - 1) ^ (n✝¹ + 1)
state_after: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x✝ : Fin n → ℕ
k n✝¹ n✝ : ℕ
x : Fin (n✝¹ + 1) → ℕ
hx : x ∈ box (n✝¹ + 1) (n✝ + 1)
a✝ : ∑ i : Fin (n✝¹ + 1), x i ^ 2 = k
⊢ (map (2 * (n✝ + 1) - 1)) x < (2 * (n✝ + 1) - 1) ^ (n✝¹ + 1)

tactic: exact (map_le_of_mem_box hx).trans_lt sum_lt
state_before: α : Type u_1
β : Type u_2
n d k✝ N : ℕ
x✝ : Fin n → ℕ
k n✝¹ n✝ : ℕ
x : Fin (n✝¹ + 1) → ℕ
hx : x ∈ box (n✝¹ + 1) (n✝ + 1)
a✝ : ∑ i : Fin (n✝¹ + 1), x i ^ 2 = k
⊢ (map (2 * (n✝ + 1) - 1)) x < (2 * (n✝ + 1) - 1) ^ (n✝¹ + 1)
state_after: no goals