finset

finset α is the type of finite sets of elements of α. It is implemented as a multiset (a list up to permutation) which has no duplicate elements.

finset.to_set

Convert a finset to a set in the natural way.

finset.singleton

singleton a is the set {a} containing a and nothing else.

finset.has_insert

insert a s is the set {a} ∪ s containing a and the elements of s.

finset.induction_on

To prove a proposition about an arbitrary finset α, it suffices to prove it for the empty finset, and to show that if it holds for some finset α, then it holds for the finset obtained by inserting a new element.

finset.has_union

s ∪ t is the set such that a ∈ s ∪ t iff a ∈ s or a ∈ t.

finset.has_inter

s ∩ t is the set such that a ∈ s ∩ t iff a ∈ s and a ∈ t.

finset.erase

erase s a is the set s - {a}, that is, the elements of s which are not equal to a.

finset.has_sdiff

s \ t is the set consisting of the elements of s that are not in t.

finset.attach

attach s takes the elements of s and forms a new set of elements of the subtype {x // x ∈ s}.

finset.decidable_eq_pi_finset

decidable equality for functions whose domain is bounded by finsets

finset.filter

filter p s is the set of elements of s that satisfy p.

finset.has_sep

The following instance allows us to write { x ∈ s | p x } for finset.filter s p. Since the former notation requires us to define this for all propositions p, and finset.filter only works for decidable propositions, the notation { x ∈ s | p x } is only compatible with classical logic because it uses classical.prop_decidable. We don't want to redo all lemmas of finset.filter for has_sep.sep, so we make sure that simp unfolds the notation { x ∈ s | p x } to finset.filter s p. If p happens to be decidable, the simp-lemma filter_congr_decidable will make sure that finset.filter uses the right instance for decidability.

finset.range

range n is the set of natural numbers less than n.

option.to_finset

Construct an empty or singleton finset from an option

multiset.to_finset

to_finset s removes duplicates from the multiset s to produce a finset.

list.to_finset

to_finset l removes duplicates from the list l to produce a finset.

finset.image

image f s is the forward image of s under f.

finset.card

card s is the cardinality (number of elements) of s.

finset.bind

bind s t is the union of t x over x ∈ s

finset.product

product s t is the set of pairs (a, b) such that a ∈ s and b ∈ t.

finset.sigma

sigma s t is the set of dependent pairs ⟨a, b⟩ such that a ∈ s and b ∈ t a.

finset.fold

fold op b f s folds the commutative associative operation op over the f-image of s, i.e. fold (+) b f {1,2,3} = f 1 + f 2 + f 3 + b`.

finset.sup

Supremum of a finite set: sup {a, b, c} f = f a ⊔ f b ⊔ f c

finset.inf

Infimum of a finite set: inf {a, b, c} f = f a ⊓ f b ⊓ f c

finset.sort

sort s constructs a sorted list from the unordered set s. (Uses merge sort algorithm.)

finset.Ico

Ico n m is the set of natural numbers n k < m.

finset.Ico_ℤ

Ico_ℤ l u is the set of integers l k < u.

finset.nat.antidiagonal

The antidiagonal of a natural number n is the finset of pairs (i,j) such that i+j = n.

finset.nat.mem_antidiagonal

A pair (i,j) is contained in the antidiagonal of n if and only if i+j=n.

finset.nat.card_antidiagonal

The cardinality of the antidiagonal of n is n+1.

finset.nat.antidiagonal_zero

The antidiagonal of 0 is the list [(0,0)]