File: Mathlib/InformationTheory/Hamming.lean

full_name: hammingDist
code: /-- The Hamming distance function to the naturals. -/
def hammingDist (x y : ∀ i, β i) : ℕ 
goal: ℕ

full_name: hammingDist_self
code: /-- Corresponds to `dist_self`. -/
@[simp]
theorem hammingDist_self (x : ∀ i, β i) : hammingDist x x = 0 
goal: hammingDist x x = 0

full_name: hammingDist_nonneg
code: /-- Corresponds to `dist_nonneg`. -/
theorem hammingDist_nonneg {x y : ∀ i, β i} : 0 ≤ hammingDist x y 
goal: 0 ≤ hammingDist x y

full_name: hammingDist_comm
code: /-- Corresponds to `dist_comm`. -/
theorem hammingDist_comm (x y : ∀ i, β i) : hammingDist x y = hammingDist y x 
goal: hammingDist x y = hammingDist y x

full_name: hammingDist_triangle
code: /-- Corresponds to `dist_triangle`. -/
theorem hammingDist_triangle (x y z : ∀ i, β i) :
    hammingDist x z ≤ hammingDist x y + hammingDist y z 
goal: hammingDist x z ≤ hammingDist x y + hammingDist y z

full_name: hammingDist_triangle_left
code: /-- Corresponds to `dist_triangle_left`. -/
theorem hammingDist_triangle_left (x y z : ∀ i, β i) :
    hammingDist x y ≤ hammingDist z x + hammingDist z y 
goal: hammingDist x y ≤ hammingDist z x + hammingDist z y

full_name: hammingDist_triangle_right
code: /-- Corresponds to `dist_triangle_right`. -/
theorem hammingDist_triangle_right (x y z : ∀ i, β i) :
    hammingDist x y ≤ hammingDist x z + hammingDist y z 
goal: hammingDist x y ≤ hammingDist x z + hammingDist y z

full_name: swap_hammingDist
code: /-- Corresponds to `swap_dist`. -/
theorem swap_hammingDist : swap (@hammingDist _ β _ _) = hammingDist 
goal: Function.swap hammingDist = hammingDist

full_name: eq_of_hammingDist_eq_zero
code: /-- Corresponds to `eq_of_dist_eq_zero`. -/
theorem eq_of_hammingDist_eq_zero {x y : ∀ i, β i} : hammingDist x y = 0 → x = y 
goal: hammingDist x y = 0 → x = y

full_name: hammingDist_eq_zero
code: /-- Corresponds to `dist_eq_zero`. -/
@[simp]
theorem hammingDist_eq_zero {x y : ∀ i, β i} : hammingDist x y = 0 ↔ x = y 
goal: hammingDist x y = 0 ↔ x = y

full_name: hamming_zero_eq_dist
code: /-- Corresponds to `zero_eq_dist`. -/
@[simp]
theorem hamming_zero_eq_dist {x y : ∀ i, β i} : 0 = hammingDist x y ↔ x = y 
goal: 0 = hammingDist x y ↔ x = y

full_name: hammingDist_ne_zero
code: /-- Corresponds to `dist_ne_zero`. -/
theorem hammingDist_ne_zero {x y : ∀ i, β i} : hammingDist x y ≠ 0 ↔ x ≠ y 
goal: hammingDist x y ≠ 0 ↔ x ≠ y

full_name: hammingDist_pos
code: /-- Corresponds to `dist_pos`. -/
@[simp]
theorem hammingDist_pos {x y : ∀ i, β i} : 0 < hammingDist x y ↔ x ≠ y 
goal: 0 < hammingDist x y ↔ x ≠ y

full_name: hammingDist_lt_one
code: theorem hammingDist_lt_one {x y : ∀ i, β i} : hammingDist x y < 1 ↔ x = y 
goal: hammingDist x y < 1 ↔ x = y

full_name: hammingDist_le_card_fintype
code: theorem hammingDist_le_card_fintype {x y : ∀ i, β i} : hammingDist x y ≤ Fintype.card ι 
goal: hammingDist x y ≤ Fintype.card ι

full_name: hammingDist_comp_le_hammingDist
code: theorem hammingDist_comp_le_hammingDist (f : ∀ i, γ i → β i) {x y : ∀ i, γ i} :
    (hammingDist (fun i => f i (x i)) fun i => f i (y i)) ≤ hammingDist x y 
goal: (hammingDist (fun i => f i (x i)) fun i => f i (y i)) ≤ hammingDist x y

full_name: hammingDist_comp
code: theorem hammingDist_comp (f : ∀ i, γ i → β i) {x y : ∀ i, γ i} (hf : ∀ i, Injective (f i)) :
    (hammingDist (fun i => f i (x i)) fun i => f i (y i)) = hammingDist x y 
goal: (hammingDist (fun i => f i (x i)) fun i => f i (y i)) = hammingDist x y

full_name: hammingDist_smul_le_hammingDist
code: theorem hammingDist_smul_le_hammingDist [∀ i, SMul α (β i)] {k : α} {x y : ∀ i, β i} :
    hammingDist (k • x) (k • y) ≤ hammingDist x y 
goal: hammingDist (k • x) (k • y) ≤ hammingDist x y

full_name: hammingDist_smul
code: /-- Corresponds to `dist_smul` with the discrete norm on `α`. -/
theorem hammingDist_smul [∀ i, SMul α (β i)] {k : α} {x y : ∀ i, β i}
    (hk : ∀ i, IsSMulRegular (β i) k) : hammingDist (k • x) (k • y) = hammingDist x y 
goal: hammingDist (k • x) (k • y) = hammingDist x y

full_name: hammingNorm
code: /-- The Hamming weight function to the naturals. -/
def hammingNorm (x : ∀ i, β i) : ℕ 
goal: ℕ

full_name: hammingDist_zero_right
code: /-- Corresponds to `dist_zero_right`. -/
@[simp]
theorem hammingDist_zero_right (x : ∀ i, β i) : hammingDist x 0 = hammingNorm x 
goal: hammingDist x 0 = hammingNorm x

full_name: hammingDist_zero_left
code: /-- Corresponds to `dist_zero_left`. -/
@[simp]
theorem hammingDist_zero_left : hammingDist (0 : ∀ i, β i) = hammingNorm 
goal: hammingDist 0 = hammingNorm

full_name: hammingNorm_nonneg
code: /-- Corresponds to `norm_nonneg`. -/
-- @[simp] -- Porting note (#10618): simp can prove this
theorem hammingNorm_nonneg {x : ∀ i, β i} : 0 ≤ hammingNorm x 
goal: 0 ≤ hammingNorm x

full_name: hammingNorm_zero
code: /-- Corresponds to `norm_zero`. -/
@[simp]
theorem hammingNorm_zero : hammingNorm (0 : ∀ i, β i) = 0 
goal: hammingNorm 0 = 0

full_name: hammingNorm_eq_zero
code: /-- Corresponds to `norm_eq_zero`. -/
@[simp]
theorem hammingNorm_eq_zero {x : ∀ i, β i} : hammingNorm x = 0 ↔ x = 0 
goal: hammingNorm x = 0 ↔ x = 0

full_name: hammingNorm_ne_zero_iff
code: /-- Corresponds to `norm_ne_zero_iff`. -/
theorem hammingNorm_ne_zero_iff {x : ∀ i, β i} : hammingNorm x ≠ 0 ↔ x ≠ 0 
goal: hammingNorm x ≠ 0 ↔ x ≠ 0

full_name: hammingNorm_pos_iff
code: /-- Corresponds to `norm_pos_iff`. -/
@[simp]
theorem hammingNorm_pos_iff {x : ∀ i, β i} : 0 < hammingNorm x ↔ x ≠ 0 
goal: 0 < hammingNorm x ↔ x ≠ 0

full_name: hammingNorm_lt_one
code: theorem hammingNorm_lt_one {x : ∀ i, β i} : hammingNorm x < 1 ↔ x = 0 
goal: hammingNorm x < 1 ↔ x = 0

full_name: hammingNorm_le_card_fintype
code: theorem hammingNorm_le_card_fintype {x : ∀ i, β i} : hammingNorm x ≤ Fintype.card ι 
goal: hammingNorm x ≤ Fintype.card ι

full_name: hammingNorm_comp_le_hammingNorm
code: theorem hammingNorm_comp_le_hammingNorm (f : ∀ i, γ i → β i) {x : ∀ i, γ i} (hf : ∀ i, f i 0 = 0) :
    (hammingNorm fun i => f i (x i)) ≤ hammingNorm x 
goal: (hammingNorm fun i => f i (x i)) ≤ hammingNorm x

full_name: hammingNorm_comp
code: theorem hammingNorm_comp (f : ∀ i, γ i → β i) {x : ∀ i, γ i} (hf₁ : ∀ i, Injective (f i))
    (hf₂ : ∀ i, f i 0 = 0) : (hammingNorm fun i => f i (x i)) = hammingNorm x 
goal: (hammingNorm fun i => f i (x i)) = hammingNorm x

full_name: hammingNorm_smul_le_hammingNorm
code: theorem hammingNorm_smul_le_hammingNorm [Zero α] [∀ i, SMulWithZero α (β i)] {k : α}
    {x : ∀ i, β i} : hammingNorm (k • x) ≤ hammingNorm x 
goal: hammingNorm (k • x) ≤ hammingNorm x

full_name: hammingNorm_smul
code: theorem hammingNorm_smul [Zero α] [∀ i, SMulWithZero α (β i)] {k : α}
    (hk : ∀ i, IsSMulRegular (β i) k) (x : ∀ i, β i) : hammingNorm (k • x) = hammingNorm x 
goal: hammingNorm (k • x) = hammingNorm x

full_name: hammingDist_eq_hammingNorm
code: /-- Corresponds to `dist_eq_norm`. -/
theorem hammingDist_eq_hammingNorm [∀ i, AddGroup (β i)] (x y : ∀ i, β i) :
    hammingDist x y = hammingNorm (x - y) 
goal: hammingDist x y = hammingNorm (x - y)

full_name: Hamming
code: /-- Type synonym for a Pi type which inherits the usual algebraic instances, but is equipped with
the Hamming metric and norm, instead of `Pi.normedAddCommGroup` which uses the sup norm. -/
def Hamming {ι : Type*} (β : ι → Type*) : Type _ 
goal: Type (max u_1 u_2)

full_name: Hamming.instInhabited
code: instance [∀ i, Inhabited (β i)] : Inhabited (Hamming β) 
goal: Inhabited (Hamming β)

full_name: Hamming.instFintypeOfDecidableEq
code: instance [DecidableEq ι] [Fintype ι] [∀ i, Fintype (β i)] : Fintype (Hamming β) 
goal: Fintype (Hamming β)

full_name: Hamming.instNontrivialOfNonemptyOfDefault
code: instance [Inhabited ι] [∀ i, Nonempty (β i)] [Nontrivial (β default)] : Nontrivial (Hamming β) 
goal: Nontrivial (Hamming β)

full_name: Hamming.instDecidableEqOfFintype
code: instance [Fintype ι] [∀ i, DecidableEq (β i)] : DecidableEq (Hamming β) 
goal: DecidableEq (Hamming β)

full_name: Hamming.instZero
code: instance [∀ i, Zero (β i)] : Zero (Hamming β) 
goal: Zero (Hamming β)

full_name: Hamming.instNeg
code: instance [∀ i, Neg (β i)] : Neg (Hamming β) 
goal: Neg (Hamming β)

full_name: Hamming.instAdd
code: instance [∀ i, Add (β i)] : Add (Hamming β) 
goal: Add (Hamming β)

full_name: Hamming.instSub
code: instance [∀ i, Sub (β i)] : Sub (Hamming β) 
goal: Sub (Hamming β)

full_name: Hamming.instSMul
code: instance [∀ i, SMul α (β i)] : SMul α (Hamming β) 
goal: SMul α (Hamming β)

full_name: Hamming.instSMulWithZero
code: instance [Zero α] [∀ i, Zero (β i)] [∀ i, SMulWithZero α (β i)] : SMulWithZero α (Hamming β) 
goal: SMulWithZero α (Hamming β)

full_name: Hamming.instAddMonoid
code: instance [∀ i, AddMonoid (β i)] : AddMonoid (Hamming β) 
goal: AddMonoid (Hamming β)

full_name: Hamming.instAddCommMonoid
code: instance [∀ i, AddCommMonoid (β i)] : AddCommMonoid (Hamming β) 
goal: AddCommMonoid (Hamming β)

full_name: Hamming.instAddCommGroup
code: instance [∀ i, AddCommGroup (β i)] : AddCommGroup (Hamming β) 
goal: AddCommGroup (Hamming β)

full_name: Hamming.instModule
code: instance (α) [Semiring α] (β : ι → Type*) [∀ i, AddCommMonoid (β i)] [∀ i, Module α (β i)] :
    Module α (Hamming β) 
goal: Module α (Hamming β)

full_name: Hamming.toHamming
code: /-- `Hamming.toHamming` is the identity function to the `Hamming` of a type.  -/
@[match_pattern]
def toHamming : (∀ i, β i) ≃ Hamming β 
goal: ((i : ι) → β i) ≃ Hamming β

full_name: Hamming.ofHamming
code: /-- `Hamming.ofHamming` is the identity function from the `Hamming` of a type.  -/
@[match_pattern]
def ofHamming : Hamming β ≃ ∀ i, β i 
goal: Hamming β ≃ ((i : ι) → β i)

full_name: Hamming.toHamming_symm_eq
code: @[simp]
theorem toHamming_symm_eq : (@toHamming _ β).symm = ofHamming 
goal: Hamming.toHamming.symm = Hamming.ofHamming

full_name: Hamming.ofHamming_symm_eq
code: @[simp]
theorem ofHamming_symm_eq : (@ofHamming _ β).symm = toHamming 
goal: Hamming.ofHamming.symm = Hamming.toHamming

full_name: Hamming.toHamming_ofHamming
code: @[simp]
theorem toHamming_ofHamming (x : Hamming β) : toHamming (ofHamming x) = x 
goal: Hamming.toHamming (Hamming.ofHamming x) = x

full_name: Hamming.ofHamming_toHamming
code: @[simp]
theorem ofHamming_toHamming (x : ∀ i, β i) : ofHamming (toHamming x) = x 
goal: Hamming.ofHamming (Hamming.toHamming x) = x

full_name: Hamming.toHamming_inj
code: theorem toHamming_inj {x y : ∀ i, β i} : toHamming x = toHamming y ↔ x = y 
goal: Hamming.toHamming x = Hamming.toHamming y ↔ x = y

full_name: Hamming.ofHamming_inj
code: theorem ofHamming_inj {x y : Hamming β} : ofHamming x = ofHamming y ↔ x = y 
goal: Hamming.ofHamming x = Hamming.ofHamming y ↔ x = y

full_name: Hamming.toHamming_zero
code: @[simp]
theorem toHamming_zero [∀ i, Zero (β i)] : toHamming (0 : ∀ i, β i) = 0 
goal: Hamming.toHamming 0 = 0

full_name: Hamming.ofHamming_zero
code: @[simp]
theorem ofHamming_zero [∀ i, Zero (β i)] : ofHamming (0 : Hamming β) = 0 
goal: Hamming.ofHamming 0 = 0

full_name: Hamming.toHamming_neg
code: @[simp]
theorem toHamming_neg [∀ i, Neg (β i)] {x : ∀ i, β i} : toHamming (-x) = -toHamming x 
goal: Hamming.toHamming (-x) = -Hamming.toHamming x

full_name: Hamming.ofHamming_neg
code: @[simp]
theorem ofHamming_neg [∀ i, Neg (β i)] {x : Hamming β} : ofHamming (-x) = -ofHamming x 
goal: Hamming.ofHamming (-x) = -Hamming.ofHamming x

full_name: Hamming.toHamming_add
code: @[simp]
theorem toHamming_add [∀ i, Add (β i)] {x y : ∀ i, β i} :
    toHamming (x + y) = toHamming x + toHamming y 
goal: Hamming.toHamming (x + y) = Hamming.toHamming x + Hamming.toHamming y

full_name: Hamming.ofHamming_add
code: @[simp]
theorem ofHamming_add [∀ i, Add (β i)] {x y : Hamming β} :
    ofHamming (x + y) = ofHamming x + ofHamming y 
goal: Hamming.ofHamming (x + y) = Hamming.ofHamming x + Hamming.ofHamming y

full_name: Hamming.toHamming_sub
code: @[simp]
theorem toHamming_sub [∀ i, Sub (β i)] {x y : ∀ i, β i} :
    toHamming (x - y) = toHamming x - toHamming y 
goal: Hamming.toHamming (x - y) = Hamming.toHamming x - Hamming.toHamming y

full_name: Hamming.ofHamming_sub
code: @[simp]
theorem ofHamming_sub [∀ i, Sub (β i)] {x y : Hamming β} :
    ofHamming (x - y) = ofHamming x - ofHamming y 
goal: Hamming.ofHamming (x - y) = Hamming.ofHamming x - Hamming.ofHamming y

full_name: Hamming.toHamming_smul
code: @[simp]
theorem toHamming_smul [∀ i, SMul α (β i)] {r : α} {x : ∀ i, β i} :
    toHamming (r • x) = r • toHamming x 
goal: Hamming.toHamming (r • x) = r • Hamming.toHamming x

full_name: Hamming.ofHamming_smul
code: @[simp]
theorem ofHamming_smul [∀ i, SMul α (β i)] {r : α} {x : Hamming β} :
    ofHamming (r • x) = r • ofHamming x 
goal: Hamming.ofHamming (r • x) = r • Hamming.ofHamming x

full_name: Hamming.instDist
code: instance : Dist (Hamming β) 
goal: Dist (Hamming β)

full_name: Hamming.dist_eq_hammingDist
code: @[simp, push_cast]
theorem dist_eq_hammingDist (x y : Hamming β) :
    dist x y = hammingDist (ofHamming x) (ofHamming y) 
goal: dist x y = ↑(hammingDist (Hamming.ofHamming x) (Hamming.ofHamming y))

full_name: Hamming.instPseudoMetricSpace
code: instance : PseudoMetricSpace (Hamming β) 
goal: PseudoMetricSpace (Hamming β)

full_name: Hamming.nndist_eq_hammingDist
code: @[simp, push_cast]
theorem nndist_eq_hammingDist (x y : Hamming β) :
    nndist x y = hammingDist (ofHamming x) (ofHamming y) 
goal: nndist x y = ↑(hammingDist (Hamming.ofHamming x) (Hamming.ofHamming y))

full_name: Hamming.instDiscreteTopology
code: instance : DiscreteTopology (Hamming β) 
goal: DiscreteTopology (Hamming β)

full_name: Hamming.instMetricSpace
code: instance : MetricSpace (Hamming β) 
goal: MetricSpace (Hamming β)

full_name: Hamming.instNormOfZero
code: instance [∀ i, Zero (β i)] : Norm (Hamming β) 
goal: Norm (Hamming β)

full_name: Hamming.norm_eq_hammingNorm
code: @[simp, push_cast]
theorem norm_eq_hammingNorm [∀ i, Zero (β i)] (x : Hamming β) : ‖x‖ = hammingNorm (ofHamming x) 
goal: ‖x‖ = ↑(hammingNorm (Hamming.ofHamming x))

full_name: Hamming.instNormedAddCommGroupOfAddCommGroup
code: instance [∀ i, AddCommGroup (β i)] : NormedAddCommGroup (Hamming β) 
goal: NormedAddCommGroup (Hamming β)

full_name: Hamming.nnnorm_eq_hammingNorm
code: @[simp, push_cast]
theorem nnnorm_eq_hammingNorm [∀ i, AddCommGroup (β i)] (x : Hamming β) :
    ‖x‖₊ = hammingNorm (ofHamming x) 
goal: ‖x‖₊ = ↑(hammingNorm (Hamming.ofHamming x))