Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
letI := Classical.decEq Γ
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
let n := Fintype.card Γ
case mk
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
x✝ : Trunc (Γ ≃ Fin (Fintype.card Γ))
F : Γ ≃ Fin (Fintype.card Γ)
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
obtain ⟨F⟩ := Fintype.truncEquivFin Γ
case mk
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
x✝ : Trunc (Γ ≃ Fin (Fintype.card Γ))
F : Γ ≃ Fin (Fintype.card Γ)
G : Fin n ↪ Fin n → Bool :=
  { toFun := fun a b => decide (a = b),
    inj' := (_ : ∀ (a b : Fin n), (fun a b => decide (a = b)) a = (fun a b => decide (a = b)) b → a = b) }
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
case mk
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
x✝ : Trunc (Γ ≃ Fin (Fintype.card Γ))
F : Γ ≃ Fin (Fintype.card Γ)
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
let G : Fin n ↪ Fin n → Bool :=
  ⟨fun a b ↦ a = b, fun a b h ↦
    Bool.of_decide_true <| (congr_fun h b).trans <| Bool.decide_true rfl⟩
case mk
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
x✝ : Trunc (Γ ≃ Fin (Fintype.card Γ))
F : Γ ≃ Fin (Fintype.card Γ)
G : Fin n ↪ Fin n → Bool :=
  { toFun := fun a b => decide (a = b),
    inj' := (_ : ∀ (a b : Fin n), (fun a b => decide (a = b)) a = (fun a b => decide (a = b)) b → a = b) }
H : Γ ↪ Vector Bool n :=
  Function.Embedding.trans (Function.Embedding.trans (Equiv.toEmbedding F) G)
    (Equiv.toEmbedding (Equiv.vectorEquivFin Bool n).symm)
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
case mk
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
x✝ : Trunc (Γ ≃ Fin (Fintype.card Γ))
F : Γ ≃ Fin (Fintype.card Γ)
G : Fin n ↪ Fin n → Bool :=
  { toFun := fun a b => decide (a = b),
    inj' := (_ : ∀ (a b : Fin n), (fun a b => decide (a = b)) a = (fun a b => decide (a = b)) b → a = b) }
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
let H := (F.toEmbedding.trans G).trans (Equiv.vectorEquivFin _ _).symm.toEmbedding
no goals
case mk
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
x✝ : Trunc (Γ ≃ Fin (Fintype.card Γ))
F : Γ ≃ Fin (Fintype.card Γ)
G : Fin n ↪ Fin n → Bool :=
  { toFun := fun a b => decide (a = b),
    inj' := (_ : ∀ (a b : Fin n), (fun a b => decide (a = b)) a = (fun a b => decide (a = b)) b → a = b) }
H : Γ ↪ Vector Bool n :=
  Function.Embedding.trans (Function.Embedding.trans (Equiv.toEmbedding F) G)
    (Equiv.toEmbedding (Equiv.vectorEquivFin Bool n).symm)
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
classical
  let enc := H.setValue default (Vector.replicate n false)
  exact ⟨_, enc, Function.invFun enc, H.setValue_eq _ _, Function.leftInverse_invFun enc.2⟩
case mk
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
x✝ : Trunc (Γ ≃ Fin (Fintype.card Γ))
F : Γ ≃ Fin (Fintype.card Γ)
G : Fin n ↪ Fin n → Bool :=
  { toFun := fun a b => decide (a = b),
    inj' := (_ : ∀ (a b : Fin n), (fun a b => decide (a = b)) a = (fun a b => decide (a = b)) b → a = b) }
H : Γ ↪ Vector Bool n :=
  Function.Embedding.trans (Function.Embedding.trans (Equiv.toEmbedding F) G)
    (Equiv.toEmbedding (Equiv.vectorEquivFin Bool n).symm)
enc : Γ ↪ Vector Bool n := Function.Embedding.setValue H default (Vector.replicate n false)
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
case mk
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
x✝ : Trunc (Γ ≃ Fin (Fintype.card Γ))
F : Γ ≃ Fin (Fintype.card Γ)
G : Fin n ↪ Fin n → Bool :=
  { toFun := fun a b => decide (a = b),
    inj' := (_ : ∀ (a b : Fin n), (fun a b => decide (a = b)) a = (fun a b => decide (a = b)) b → a = b) }
H : Γ ↪ Vector Bool n :=
  Function.Embedding.trans (Function.Embedding.trans (Equiv.toEmbedding F) G)
    (Equiv.toEmbedding (Equiv.vectorEquivFin Bool n).symm)
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
let enc := H.setValue default (Vector.replicate n false)
no goals
case mk
Γ : Type u_1
inst✝¹ : Inhabited Γ
inst✝ : Fintype Γ
this : DecidableEq Γ := Classical.decEq Γ
n : ℕ := Fintype.card Γ
x✝ : Trunc (Γ ≃ Fin (Fintype.card Γ))
F : Γ ≃ Fin (Fintype.card Γ)
G : Fin n ↪ Fin n → Bool :=
  { toFun := fun a b => decide (a = b),
    inj' := (_ : ∀ (a b : Fin n), (fun a b => decide (a = b)) a = (fun a b => decide (a = b)) b → a = b) }
H : Γ ↪ Vector Bool n :=
  Function.Embedding.trans (Function.Embedding.trans (Equiv.toEmbedding F) G)
    (Equiv.toEmbedding (Equiv.vectorEquivFin Bool n).symm)
enc : Γ ↪ Vector Bool n := Function.Embedding.setValue H default (Vector.replicate n false)
⊢ ∃ n enc dec, enc default = Vector.replicate n false ∧ ∀ (a : Γ), dec (enc a) = a
exact ⟨_, enc, Function.invFun enc, H.setValue_eq _ _, Function.leftInverse_invFun enc.2⟩