The symmetric square #
This file defines the symmetric square, which is α × α modulo
swapping. This is also known as the type of unordered pairs.
More generally, the symmetric square is the second symmetric power
(see Data.Sym.Basic). The equivalence is Sym2.equivSym.
From the point of view that an unordered pair is equivalent to a
multiset of cardinality two (see Sym2.equivMultiset), there is a
Mem instance Sym2.Mem, which is a Prop-valued membership
test. Given h : a ∈ z for z : Sym2 α, then Mem.other h is the other
element of the pair, defined using Classical.choice. If α has
decidable equality, then h.other' computably gives the other element.
The universal property of Sym2 is provided as Sym2.lift, which
states that functions from Sym2 α are equivalent to symmetric
two-argument functions from α.
Recall that an undirected graph (allowing self loops, but no multiple
edges) is equivalent to a symmetric relation on the vertex type α.
Given a symmetric relation on α, the corresponding edge set is
constructed by Sym2.fromRel which is a special case of Sym2.lift.
Notation #
The element Sym2.mk (a, b) can be written as s(a, b) for short.
Tags #
symmetric square, unordered pairs, symmetric powers
One can use attribute [local instance] Sym2.Rel.setoid to temporarily
make Quotient functionality work for α × α.
Instances For
Sym2 α is the symmetric square of α, which, in other words, is the
type of unordered pairs.
It is equivalent in a natural way to multisets of cardinality 2 (see
Sym2.equivMultiset).
Instances For
s(x, y) is an unordered pair,
which is to say a pair modulo the action of the symmetric group.
It is equal to Sym2.mk (x, y).
Instances For
Dependent recursion principal for Sym2 when the target is a Subsingleton type.
See Quot.recOnSubsingleton.
Instances For
Alias of Sym2.eq_swap.
A two-argument version of Sym2.lift.
Instances For
Alias of Sym2.map_mk.
mk a as an embedding. This is the symmetric version of Function.Embedding.sectL.
Instances For
Sym2.map as an embedding.
Instances For
Membership and set coercion #
Given an element of the unordered pair, give the other element using Classical.choose.
See also Mem.other' for the computable version.
Instances For
Note: Sym2.map_id will not simplify Sym2.map id z due to Sym2.map_congr.
Partial map. If f : ∀ a, p a → β is a partial function defined on a : α satisfying p,
then pmap f s h is essentially the same as map f s but is defined only when all members of s
satisfy p, using the proof to apply f.
Instances For
"Attach" a proof P a that holds for all the elements of s to produce a new Sym2 object
with the same elements but in the type {x // P x}.
Instances For
Diagonal #
A predicate for testing whether an element of Sym2 α is on the diagonal.
Instances For
Alias of Sym2.mk_isDiag_iff.
The set of all Sym2 α elements on the diagonal.
Instances For
Alias of the reverse direction of Sym2.mem_diagSet_iff_isDiag.
Declarations about symmetric relations #
Symmetric relations define a set on Sym2 α by taking all those pairs
of elements that are related.
Instances For
Alias of Sym2.fromRel_prop.
Alias of the reverse direction of Sym2.fromRel_mono_iff.
Alias of Sym2.fromRel_irrefl.
The inverse to Sym2.fromRel. Given a set on Sym2 α, give a symmetric relation on α
(see Sym2.toRel_symmetric).
Instances For
Alias of the reverse direction of Sym2.toRel_mono_iff.
Alias of Sym2.fromRel_eq_fromRel_iff_eq.
Map an unordered pair to an unordered list.
Instances For
Mapping an unordered pair to an unordered list produces a multiset of size 2.
The members of an unordered pair are members of the corresponding unordered list.
Map an unordered pair to a finite set.
Instances For
The members of an unordered pair are members of the corresponding finite set.
Mapping an unordered pair on the diagonal to a finite set produces a finset of size 1.
Mapping an unordered pair off the diagonal to a finite set produces a finset of size 2.
Mapping an unordered pair to a finite set produces a finset of size 1 if the pair is on the
diagonal, else of size 2 if the pair is off the diagonal.
Equivalence to the second symmetric power #
The symmetric square is equivalent to length-2 vectors up to permutations.
Instances For
The symmetric square is equivalent to the second symmetric power.
Instances For
Given [DecidableEq α] and [Fintype α], the following instance gives Fintype (Sym2 α).
The other element of an element of the symmetric square #
Get the other element of the unordered pair using the decidable equality.
This is the computable version of Mem.other.
Instances For
Addition as a function from Sym2.
Instances For
Alias of Set.mk_mem_sym2_iff.