@@ -268,3 +268,62 @@ set_fintype _
268268
269269instance set.fintype [fintype α] [decidable_eq α] : fintype (set α) :=
270270pi.fintype
271+
272+ def quotient.fin_choice_aux {ι : Type *} [decidable_eq ι]
273+ {α : ι → Type *} [S : ∀ i, setoid (α i)] :
274+ ∀ (l : list ι), (∀ i ∈ l, quotient (S i)) → @quotient (Π i ∈ l, α i) (by apply_instance)
275+ | [] f := ⟦λ i, false.elim⟧
276+ | (i::l) f := begin
277+ refine quotient.lift_on₂ (f i (list.mem_cons_self _ _))
278+ (quotient.fin_choice_aux l (λ j h, f j (list.mem_cons_of_mem _ h)))
279+ _ _,
280+ exact λ a l, ⟦λ j h,
281+ if e : j = i then by rw e; exact a else
282+ l _ (h.resolve_left e)⟧,
283+ refine λ a₁ l₁ a₂ l₂ h₁ h₂, quotient.sound (λ j h, _),
284+ by_cases e : j = i; simp [e],
285+ { subst j, exact h₁ },
286+ { exact h₂ _ _ }
287+ end
288+
289+ theorem quotient.fin_choice_aux_eq {ι : Type *} [decidable_eq ι]
290+ {α : ι → Type *} [S : ∀ i, setoid (α i)] :
291+ ∀ (l : list ι) (f : ∀ i ∈ l, α i), quotient.fin_choice_aux l (λ i h, ⟦f i h⟧) = ⟦f⟧
292+ | [] f := quotient.sound (λ i h, h.elim)
293+ | (i::l) f := begin
294+ simp [quotient.fin_choice_aux, quotient.fin_choice_aux_eq l],
295+ refine quotient.sound (λ j h, _),
296+ by_cases e : j = i; simp [e],
297+ subst j, refl
298+ end
299+
300+ def quotient.fin_choice {ι : Type *} [fintype ι] [decidable_eq ι]
301+ {α : ι → Type *} [S : ∀ i, setoid (α i)]
302+ (f : ∀ i, quotient (S i)) : @quotient (Π i, α i) (by apply_instance) :=
303+ quotient.lift_on (@quotient.rec_on _ _ (λ l : multiset ι,
304+ @quotient (Π i ∈ l, α i) (by apply_instance))
305+ finset.univ.1
306+ (λ l, quotient.fin_choice_aux l (λ i _, f i))
307+ (λ a b h, begin
308+ have := λ a, quotient.fin_choice_aux_eq a (λ i h, quotient.out (f i)),
309+ simp [quotient.out_eq] at this ,
310+ simp [this ],
311+ let g := λ a:multiset ι, ⟦λ (i : ι) (h : i ∈ a), quotient.out (f i)⟧,
312+ refine eq_of_heq ((eq_rec_heq _ _).trans (_ : g a == g b)),
313+ congr' 1 , exact quotient.sound h,
314+ end ))
315+ (λ f, ⟦λ i, f i (finset.mem_univ _)⟧)
316+ (λ a b h, quotient.sound $ λ i, h _ _)
317+
318+
319+ theorem quotient.fin_choice_eq {ι : Type *} [fintype ι] [decidable_eq ι]
320+ {α : ι → Type *} [∀ i, setoid (α i)]
321+ (f : ∀ i, α i) : quotient.fin_choice (λ i, ⟦f i⟧) = ⟦f⟧ :=
322+ begin
323+ let q, swap, change quotient.lift_on q _ _ = _,
324+ have : q = ⟦λ i h, f i⟧,
325+ { dsimp [q],
326+ exact quotient.induction_on
327+ (@finset.univ ι _).1 (λ l, quotient.fin_choice_aux_eq _ _) },
328+ simp [this ], exact setoid.refl _
329+ end
0 commit comments