2015-04-10 02:59:26 +00:00
|
|
|
|
/-
|
|
|
|
|
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
|
|
2015-05-08 04:00:55 +00:00
|
|
|
|
Big operator for finite sets.
|
2015-04-10 02:59:26 +00:00
|
|
|
|
-/
|
2015-04-10 13:13:32 +00:00
|
|
|
|
import algebra.group data.finset.basic data.list.bigop
|
|
|
|
|
open algebra finset function binary quot subtype
|
2015-04-10 02:59:26 +00:00
|
|
|
|
|
|
|
|
|
namespace finset
|
|
|
|
|
variables {A B : Type}
|
2015-05-08 04:00:55 +00:00
|
|
|
|
variable [g : comm_monoid B]
|
2015-04-10 02:59:26 +00:00
|
|
|
|
include g
|
|
|
|
|
|
2015-04-10 13:13:32 +00:00
|
|
|
|
definition bigop (s : finset A) (f : A → B) : B :=
|
|
|
|
|
quot.lift_on s
|
|
|
|
|
(λ l, list.bigop (elt_of l) f)
|
|
|
|
|
(λ l₁ l₂ p, list.bigop_of_perm f p)
|
2015-04-10 02:59:26 +00:00
|
|
|
|
|
2015-04-10 13:13:32 +00:00
|
|
|
|
theorem bigop_empty (f : A → B) : bigop ∅ f = 1 :=
|
|
|
|
|
list.bigop_nil f
|
2015-04-10 02:59:26 +00:00
|
|
|
|
|
2015-04-10 13:13:32 +00:00
|
|
|
|
variable [H : decidable_eq A]
|
|
|
|
|
include H
|
|
|
|
|
|
|
|
|
|
theorem bigop_insert_of_mem (f : A → B) {a : A} {s : finset A} : a ∈ s → bigop (insert a s) f = bigop s f :=
|
|
|
|
|
quot.induction_on s
|
|
|
|
|
(λ l ainl, list.bigop_insert_of_mem f ainl)
|
|
|
|
|
|
|
|
|
|
theorem bigop_insert_of_not_mem (f : A → B) {a : A} {s : finset A} : a ∉ s → bigop (insert a s) f = f a * bigop s f :=
|
|
|
|
|
quot.induction_on s
|
|
|
|
|
(λ l nainl, list.bigop_insert_of_not_mem f nainl)
|
|
|
|
|
|
2015-05-08 10:06:21 +00:00
|
|
|
|
theorem bigop_union (f : A → B) {s₁ s₂ : finset A} (disj : s₁ ∩ s₂ = ∅) :
|
|
|
|
|
bigop (s₁ ∪ s₂) f = bigop s₁ f * bigop s₂ f :=
|
|
|
|
|
have H1 : disjoint s₁ s₂ → bigop (s₁ ∪ s₂) f = bigop s₁ f * bigop s₂ f, from
|
|
|
|
|
quot.induction_on₂ s₁ s₂
|
|
|
|
|
(λ l₁ l₂ d, list.bigop_union f d),
|
|
|
|
|
H1 (disjoint_of_inter_empty disj)
|
2015-04-10 02:59:26 +00:00
|
|
|
|
end finset
|