The matching number of a relation between two lists #
A matching of R : α → β → Prop between lists l and m pairs members of l with distinct
members of m related to them: a sublist of l related pointwise by List.Forall₂ R to a
subpermutation of m. List.matchingNumber R l m is the size of a largest matching.
Main definitions #
List.matchingNumber: the size of a largest matching ofRbetween two lists.
Main results #
List.le_matchingNumber_iff:Rhas a matching of sizekiffk ≤ matchingNumber R l m.List.countP_le_matchingNumber: the members of a duplicate-free list bearing a relation contained inR, and injective, to members ofmare pairable.
The matching number of R between l and m, the most members of l that can be paired
along R with distinct members of m. The head of l is either unpaired or paired with a member
of m, which is then no longer available.
Equations
- List.matchingNumber R [] x✝ = 0
- List.matchingNumber R (a :: l) x✝ = max (List.matchingNumber R l x✝) ({b ∈ x✝.toFinset | R a b}.sup fun (b : β) => List.matchingNumber R l (x✝.erase b) + 1)
Instances For
R has a matching of size k between l and m, a sublist of l of length k related by
Forall₂ R to a subpermutation of m, exactly when k is at most the matching number.
The members of a duplicate-free list bearing S to some member of m are pairable along R,
where S is contained in R and no two members bear S to one member of m.