Synthesize a logic circuit that will control the interior lighting of a building. The building contains four rooms separated by removable partitions. There is one switch in each room which, in conjunction with the other switches, provides the following methods of control:
(a) All partitions are closed forming four separate rooms. Each switch controls only the lights in its respective room.
(b) All partitions are open forming one large room. Each switch controls all the lights in the building; that is, when the lights are on, they can be turned off by any switch. Conversely, when the lights are off, they can be turned on by any switch.
(c) Two of the partitions are closed forming three rooms. The middle partition is open, so that the middle room is larger than the other two rooms. Each switch controls the lights in its room only.
(d) The middle partition is closed forming two rooms. Each switch controls the lights in its room only.
The switch method outlined above is referred to as four-way switching. This technique provides control of one set of lights by one or more switches. Implement the circuit using 4:1 multiplexers and additional logic functions. The output of the multiplexers connect to the lights. The partitions are labeled $\mathrm{P} 1, \mathrm{P} 2$, and $\mathrm{P} 3$; the lights are labeled $\mathrm{L} 1, \mathrm{~L} 2, \mathrm{~L} 3$, and L4; the switches are labeled $\mathrm{S} 1, \mathrm{~S} 2, \mathrm{~S} 3$, and $\mathrm{S} 4$.