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 α × α
.
Equations
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)
.
Equations
Instances For
Pretty printer defined by notation3
command.
Equations
Instances For
Dependent recursion principal for Sym2
when the target is a Subsingleton
type.
See Quot.recOnSubsingleton
.
Equations
Instances For
mk a
as an embedding. This is the symmetric version of Function.Embedding.sectL
.
Equations
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.
Equations
Instances For
Equations
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
.
Equations
Instances For
Diagonal #
Equations
Declarations about symmetric relations #
Equations
The inverse to Sym2.fromRel
. Given a set on Sym2 α
, give a symmetric relation on α
(see Sym2.toRel_symmetric
).
Equations
Instances For
Map an unordered pair to an unordered list.
Equations
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.
Equations
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
.
Equivalence to the second symmetric power #
Given [DecidableEq α]
and [Fintype α]
, the following instance gives Fintype (Sym2 α)
.
Equations
Equations
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
.