Consider a matching problem, with a set of people, a set of jobs, and a set consisting of pairs where person is qualified for job .
We say that the matching problem is solvable if there exists a full matching. This means that it is possible to allocate every job to a qualified person, in such a way that no one has more than one job.
Suppose we want to decide whether a given matching problem is solvable. One approach would be to use the methods that we have already seen to count or tabulate the full matchings; that will in particular tell us whether there are any full matchings. However, if we are only interested in the existence question, then some different methods become available, as we will describe in this section.
Recall that in Remark 6.5, we defined
We will refer to this as the candidate set for . More generally, if is some subset of the jobs, we put
We again call this the candidate set for . We say that
is implausible if .
is barely plausible if .
is very plausible if .
is plausible if (so is either barely plausible or very plausible).
We also say that the whole matching problem is plausible if every subset is plausible.
We always have so so is barely plausible.
Suppose we have a set of people, and a set of jobs, with qualifications as follows:
We then have
Proceeding in the same way, we see that
, so , so is very plausible.
, so , so is very plausible.
, so , so is barely plausible.
, so , so is implausible.
This last example is a problem. We need to assign jobs , and , and we can ignore people , and , because none of them can do any of these jobs. This just leaves two people and who need to cover three jobs, which is not possible. Thus, our allocation problem is not solvable. The next lemma will generalise this line of argument.
If the problem is solvable, then it is plausible. Thus, by the contrapositive, if the problem is not plausible then it has no solution.
If the problem is solvable, then we can choose a full matching . Consider a subset . Then must allocate each job to some person . As is a matching, we know that the people are all different, and that is qualified for job , so . We thus have distinct elements , so , so the set is plausible. This holds for all , so the whole matching problem is plausible. ∎
The main result of this section is the converse to the above lemma.
If a matching problem is plausible, then it is solvable.
Hall first formulated this result in the context of assigning romantic partners rather than jobs, hence the name.
We will give two different proofs of Hall’s theorem. The first proof will rely on the following construction.
Suppose we have a matching problem as above, and a partial matching that assigns some subset of the jobs to some subset of the people. (Note that gives a bijection from to , so we automatically have .) There is then an obvious way to set up a new matching problem for the assignment of the remaining jobs. In more detail, we take (the set of people who have not already been given a job), and (the set of jobs that still need to be assigned) and . This gives a new matching problem, with candidate sets for all . We call this the completion problem for . If we can find a solution for the completion problem, then we can combine it with to get a solution for the original problem.
If there are no jobs, then there is nothing to do, and the problem is vacuously solved.
Suppose instead that there is only one job, say . By hypothesis, the set is plausible, which means that , so , so we can choose . This means that person is qualified to do job , so we can just allocate to , and there is nothing more to do.
Now suppose that . We can assume by induction that any plausible problem with at most jobs can be solved. By an intermediate set we mean a set with and . Note that one of the following two cases must hold:
Every intermediate set is very plausible.
There is an intermediate set such that is barely plausible.
First consider the easy case. Choose any job , and put and . As is plausible, we have , so we can choose and put and . Let be the partial matching that assigns to . We claim that the corresponding completion problem is plausible. In other words, for all , we claim that . If is empty, this holds by Remark 11.3. Suppose instead that . As , we also have . As we are in the easy case, it follows that is very plausible, so , or equivalently . We also have , so is either (if ) or (if ). Either way, we have , as required. As is a plausible problem with jobs, our induction hypothesis guarantees that it has a solution, say . We can combine this with to get a solution for the original problem.
Now suppose instead that we are in the hard case. We can therefore choose an intermediate set (so with ) such that is barely plausible. Put . Note that and , so our induction hypothesis guarantees that any plausible allocation problem for or for is solvable. In particular, we can restrict our original allocation problem to , and there must exist a solution for this, say . This assigns the jobs in to some set of people , which must have . We again claim that the completion problem for is plausible. However, the proof is a little more complicated than in the easy case. The first point to note is that . To see this, note that each person in has been assigned a job in , and is assumed to be a valid partial matching so they must be qualified for the job that they have been assigned, so . On the other hand, we have already remarked that , and because is assumed to be barely plausible, so . As with , we see that as claimed. Now consider a subset . Recall that , essentially by definition. As , this can be rewritten as . It is also easy to see that and so
This gives
As the original problem is assumed to be plausible, we have . Here , so and are disjoint, so . Putting this together, we get
This shows that the completion problem is plausible, as claimed. We also know that , so we can use our induction hypothesis to show that the completion problem has a solution. Just as in the easy case, we can choose a solution to the completion problem and combine it with to get a solution for the original problem, as required. ∎
The above proof is theoretically satisfying, but does not really provide much guidance about how to find a solution. We will therefore give a second proof which is a bit more complicated, but also more constructive. In this second proof, we try to allocate the jobs one by one. Suppose we have already allocated a subset of the jobs, and we are trying to allocate one more job, say . It might happen that we get stuck: all the people who are qualified to do have already been given one of the jobs in . To fix this, we need to change the allocation of the jobs in in order to free up someone who is qualified to do , and the main problem is to analyse the possibilities for making this kind of adjustment.
Suppose we have a matching problem as before, and a partial matching , which assigns some subset of the jobs. Let be an element of , so job is not assigned by . By an open zigzag for , we mean a pattern like this:
In more detail, an open zigzag is a sequence with properties as follows (the picture above shows ).
The people are all different, and the jobs are all different.
For , job is assigned by to person (so , and is qualified for ). This is indicated by the solid arrows in the picture.
For , person is qualified for job . This is indicated by the dotted arrows in the picture.
Person is not assigned a job by .
Given such an open zigzag, we define a new matching for the jobs in as follows:
assigns to for
For , the matching assigns in the same way that does.
This can be illustrated as follows:
The process that constructs from is called flipping.
The easiest case is the case , where is qualified for and has not already been assigned a job by , so does not change any of the assignments made by but simply adds an assignment of to .
Suppose we can prove that for every and as above, there always exists an open zigzag. We can then flip the zigzag to get a new matching that includes . After doing this repeatedly, we will eventually get a full matching. Thus, the key problem is to prove the existence of open zigzags.
Consider an allocation problem with people and jobs and qualifications as follows:
We have a partial matching assigning the first three jobs to the first three people in the obvious way: and and . Now we seem to be stuck: the only person who can do is , but is already doing . We therefore remove from and give them instead, leaving unfilled. This creates another problem: the only remaining person qualified for is , but is already doing . We therefore remove from and give them instead, leaving unfilled. This creates another problem: the only remaining person qualified for is , but is already doing . We therefore remove from and give them instead, leaving unfilled. Now we are OK because person is free and is qualified for , so we can assign to and we have filled all jobs. What we have effectively done is to flip the following zigzag:
We could also illustrate and using rook placements, as follows:
By an closed zigzag for , we mean a sequence such that
The people are all different, and the jobs are all different.
For , job is assigned by to person (so , and is qualified for ).
For , person is qualified for job .
In other words, a closed zigzag is like an open zigzag, except that the person is not provided. We say that is openable if there exists another person who is qualified for and is not assigned any job by , so that the sequence is an open zigzag. We say that is extendable if there exists another person and another job such that assigns to , but is also qualified for , so that the sequence is a closed zigzag.
We define to be the set of jobs that occur in some closed zigzag.
If a job occurs in some closed zigzag, then we can discard everything after , and that gives a closed zigzag that ends with . Thus, we can also say that is the set of jobs that appear at the end of some closed zigzag.
Suppose that , so there exists a closed zigzag with . This usually means that assigns to person , so in particular . The only exception is the case where . The sequence counts as a closed zigzag, showing that , but . We thus have , where .
As before, we argue by induction on . We choose any job and put . The matching problem is still plausible when restricted to , so the induction hypothesis gives us a partial matching that assigns all the jobs in . We just need to assign as well, which may involve changing some of the assignments for . We then define and as in Definition 11.13 and Remark 11.15. Put and note that . Recall that , so assigns all the jobs in to a set of people . Because is a legitimate matching, it assigns different jobs to different people, so . Moreover, the people in are qualified for the jobs that they have been assigned, so . However, our matching problem is plausible by assumption, so . As , we can choose such that . Because , we can choose a job such that is qualified for . Because , we can choose a closed zigzag such that . Note that for , and assigns to , so . As , we see that is different from . Now suppose for a contradiction that assigns some job to . Note that does not assign , and assigns to , which is different from ; so must be different from all of . It now follows that the sequence
is again a closed zigzag. As and appears in a closed zigzag, we have . As assigns to , it follows that , which contradicts our initial assumption about . It follows that does not in fact assign any job to , so that the sequence
is an open zigzag. We can thus flip this zigzag to obtain a new matching that assigns as well as all of . In other words, assigns all the jobs. ∎