α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x : Fin n → ℕ
f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toZeroHom := { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) },
    map_add' :=
      (_ :
        ∀ (x x_1 : Fin n → ℕ),
          ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } (x + x_1) =
            ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x +
              ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x_1) }
⊢ AddSalemSpencer ↑(sphere n d k)
α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x : Fin n → ℕ
⊢ AddSalemSpencer ↑(sphere n d k)
set f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toFun := fun f => ((↑) : ℕ → ℝ) ∘ f
    map_zero' := funext fun _ => cast_zero
    map_add' := fun _ _ => funext fun _ => cast_add _ _ }
case refine'_1
α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x : Fin n → ℕ
f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toZeroHom := { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) },
    map_add' :=
      (_ :
        ∀ (x x_1 : Fin n → ℕ),
          ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } (x + x_1) =
            ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x +
              ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x_1) }
⊢ Set.InjOn ↑(AddMonoidHom.toAddFreimanHom (↑(sphere n d k)) 2 f) ↑(sphere n d k)

case refine'_2
α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x : Fin n → ℕ
f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toZeroHom := { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) },
    map_add' :=
      (_ :
        ∀ (x x_1 : Fin n → ℕ),
          ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } (x + x_1) =
            ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x +
              ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x_1) }
⊢ AddSalemSpencer (↑(AddMonoidHom.toAddFreimanHom (↑(sphere n d k)) 2 f) '' ↑(sphere n d k))
α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x : Fin n → ℕ
f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toZeroHom := { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) },
    map_add' :=
      (_ :
        ∀ (x x_1 : Fin n → ℕ),
          ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } (x + x_1) =
            ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x +
              ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x_1) }
⊢ AddSalemSpencer ↑(sphere n d k)
refine' AddSalemSpencer.of_image (f.toAddFreimanHom (sphere n d k : Set (Fin n → ℕ)) 2) _ _
case refine'_2
α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x✝ : Fin n → ℕ
f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toZeroHom := { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) },
    map_add' :=
      (_ :
        ∀ (x x_1 : Fin n → ℕ),
          ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } (x + x_1) =
            ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x +
              ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x_1) }
x : Fin n → ℕ
⊢ x ∈ ↑(sphere n d k) → x ∈ ↑(AddMonoidHom.toAddFreimanHom (↑(sphere n d k)) 2 f) ⁻¹' Metric.sphere 0 (Real.sqrt ↑k)
case refine'_2
α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x : Fin n → ℕ
f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toZeroHom := { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) },
    map_add' :=
      (_ :
        ∀ (x x_1 : Fin n → ℕ),
          ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } (x + x_1) =
            ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x +
              ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x_1) }
⊢ AddSalemSpencer (↑(AddMonoidHom.toAddFreimanHom (↑(sphere n d k)) 2 f) '' ↑(sphere n d k))
refine' (addSalemSpencer_sphere 0 <| Real.sqrt k).mono (Set.image_subset_iff.2 fun x => _)
case refine'_2
α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x✝ : Fin n → ℕ
f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toZeroHom := { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) },
    map_add' :=
      (_ :
        ∀ (x x_1 : Fin n → ℕ),
          ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } (x + x_1) =
            ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x +
              ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x_1) }
x : Fin n → ℕ
⊢ x ∈ ↑(sphere n d k) → ‖↑(AddMonoidHom.toAddFreimanHom (↑(sphere n d k)) 2 f) x‖ = Real.sqrt ↑k
case refine'_2
α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x✝ : Fin n → ℕ
f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toZeroHom := { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) },
    map_add' :=
      (_ :
        ∀ (x x_1 : Fin n → ℕ),
          ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } (x + x_1) =
            ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x +
              ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x_1) }
x : Fin n → ℕ
⊢ x ∈ ↑(sphere n d k) → x ∈ ↑(AddMonoidHom.toAddFreimanHom (↑(sphere n d k)) 2 f) ⁻¹' Metric.sphere 0 (Real.sqrt ↑k)
rw [Set.mem_preimage, mem_sphere_zero_iff_norm]
no goals
case refine'_2
α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x✝ : Fin n → ℕ
f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toZeroHom := { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) },
    map_add' :=
      (_ :
        ∀ (x x_1 : Fin n → ℕ),
          ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } (x + x_1) =
            ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x +
              ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x_1) }
x : Fin n → ℕ
⊢ x ∈ ↑(sphere n d k) → ‖↑(AddMonoidHom.toAddFreimanHom (↑(sphere n d k)) 2 f) x‖ = Real.sqrt ↑k
exact norm_of_mem_sphere
no goals
case refine'_1
α : Type ?u.454879
β : Type ?u.454882
n d k N : ℕ
x : Fin n → ℕ
f : (Fin n → ℕ) →+ EuclideanSpace ℝ (Fin n) :=
  { toZeroHom := { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) },
    map_add' :=
      (_ :
        ∀ (x x_1 : Fin n → ℕ),
          ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } (x + x_1) =
            ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x +
              ZeroHom.toFun { toFun := fun f => Nat.cast ∘ f, map_zero' := (_ : (fun f => Nat.cast ∘ f) 0 = 0) } x_1) }
⊢ Set.InjOn ↑(AddMonoidHom.toAddFreimanHom (↑(sphere n d k)) 2 f) ↑(sphere n d k)
exact cast_injective.comp_left.injOn _