An agent acts on what it knows. In a distributed system it knows almost nothing: its own state, and whatever arrived in a message. This class makes “agent X knows P” precise, for a predicate P about the rest of the system, and then proves four things about it. Every proof is the same proof — a consistent cut, from the previous class, and the dataflow graph from the one before that.
Fix an agent X. We ask what X knows about the network of other agents and the channels between them. P is a predicate on that network, and on nothing else: not on X, and not on the channels incident on X.
P can be “agents U, V and Z are deadlocked”, or “every agent is waiting for a message and every channel is empty”, or “W solved its problem”. Each is a statement about the region inside the oval in the figure below, and each is something X may or may not be in a position to assert.
Figure 1 said what P is about. It said nothing about how X could ever be in a position to assert it. X is not next to W; the two are not even joined by a channel. So if X knows that W solved its problem, something must have carried the news, agent by agent, until it reached X.
A controller C sends control messages to a furnace F, and F replies with the action it took. The furnace is also called the plant. Four steps take the system from one state in which C knows the furnace is on to the next; in asynchronous VLSI this is the four-phase handshake.
turn off and turned off are green,
turn on and turned on are red.
Four steps, one per message, each of them a flight and an arrival.
C sends turn off and goes grey at once, before anything has
happened to F. F goes green the instant that message lands — but C
stays grey, because nothing has told it. F sends turned off
and no colour changes at all while it travels, because a message in
transit tells nobody anything. C goes green the instant it arrives. Then
the same two steps
run again with turn on and turned on, and the
ninth step is the first one over again.
Two things are worth noticing. C loses its knowledge the instant it
sends, and regains it only when it receives. And the state
of F that C knows is always a state F was in, never necessarily
the one it is in now.
The figure above shows states one at a time. Draw the whole computation instead, with a line for C and a line for F, and the intervals in which C knows something become segments of C's line. This is the dataflow graph of the previous classes: the nodes are steps, and an edge carries a state.
A smaller example, with nothing in it but counting. Two agents, X and Y, pass two indivisible tokens back and forth. What does X know about Y?
Now the definition. Consider a point on X's line: an edge of the dataflow graph between two consecutive steps of X, labelled with X's state there. Call that state s.
Knowledge at a point X knows P when X's state is s means: P holds in every global state in which X's state is s.
That definition is about global states, and the previous class gave us the global states that matter: the consistent cuts. Many different cuts pass through one point on X's line, and they describe different global states — but X's own state is s in all of them, because they all cut the same edge of X's line. So the definition has a consequence we can draw:
Knowledge and consistent cuts If X knows P at a point on X's line, then P holds in the global state of every consistent cut through that point.
2 and 5, carrying state s. Press
Next cut to step through the consistent cuts that pass through
that segment. Each one is a different global state — the sets of
completed steps differ, and so do the messages in the channels —
and in every one of them x's own state is the same s.
That is the whole content of the definition. x cannot distinguish these
global states from one another, so for x to know P at this point, P has
to hold in all of them. Knowledge is not a property of one state; it is a
property of a set of states that look alike from where the agent
is standing.
With the definition in hand the theorems are short, and they are all proved the same way: take two consistent cuts that are identical everywhere except at the agent in question, and notice that a predicate about the rest of the system cannot tell them apart.
Theorem An agent does not lose knowledge when it takes a step in which it sends no messages to other agents.
Theorem An agent does not gain knowledge when it takes a step in which it receives no messages from other agents.
8, drawn as an arc over C's own line. The
theorem allows it. Its hypothesis is that the step sends nothing to
another agent, and an alarm tells U and V nothing — it never
leaves C. Watch it as the cut moves: before the move the alarm is in
transit, after it the alarm has not been sent, and either way U, V and
the channels between them are untouched.
That is the theorem in one move. C sends nothing to another agent at
step 5, so the cut can always be walked back across it, and the part of
the picture P talks about does not move at all.
And now the same picture with one thing changed: at step 5, C
sends a message to U. The alarm it sends itself at 2 is still
there and still harmless. What matters is the message that leaves C.
2, taken
at 5 — harmless, as before. But at step 5
C also sends a message to U, which U takes at 7.
Events 8 and 9 lie to the right of
after, so they stay in the future throughout, and the two
messages aimed at them are in flight the whole time.
The cut starts as a single vertical through after, and it is a
consistent cut: every message received in the past was sent in the past.
Now press the button. The cut moves at C alone, back to before
step 5 — and the picture breaks. Step 5 is now in the
future and step 7 is still in the past, so
5→7 runs from the future to the past. No state
of the system looks like that, so this is not a consistent cut.
The message turns red and is
crossed.
That is why the theorem says sends no messages to other agents.
When the step sends nothing outward, the cut can always be walked back
across it and C keeps what it knew. When it sends, the walk is blocked,
and C can lose knowledge at exactly that step — which is what
Figure 3's controller does every time it says turn off.
And the dual. Keep the same computation, but ask the opposite question: can
the cut be walked forward across step 5? Step 5 receives
only the alarm C sent itself, and nothing from another agent — which is
the hypothesis of the second theorem.
5
and 6. This time the cut starts as a single vertical through
before, and the move takes C's crossing forward past step
5 rather than back.
It works. Step 5 takes the alarm C sent itself at 2, and
2 is already in the past, so putting step 5 into the past
adds a received message whose send was there all along. Nothing is
received that was not sent, and the moved cut is a consistent cut too:
every consistent cut through “before” is a consistent cut
through “after”. Since P is a predicate on U, V and the
channels between them — and none of that moved — anything C
knows after step 5 it already knew before. That is the second theorem:
an agent gains no knowledge at a step in which it receives nothing from
another agent.
Watch the alarm as the cut passes it: in transit before the move,
delivered after. And compare with the figure above, where the same step
blocked the walk in the other direction. One step, two theorems, and the
difference is whether the message crosses the boundary of C.
The next theorem is the one with teeth. If something becomes true somewhere in the system, and later an agent knows it, then there is a chain of messages from the one event to the other. Nothing is learned out of thin air.
Theorem If NOT Q holds before a step e, and C knows Q after a step e′, then there is a path in the dataflow graph from e to e′.
4. What
matters is not whether anything leaves 4 — a message
may well leave it — but whether any sequence of messages
leads from 4 to step 6. Here none does: C acts
at 2 and 6, and what reaches C comes from
5, which happened before 4 had anything to
say.
Suppose, then, that C does know Q after step 6
— that is the claim written on C's line at the start.
Press Draw the cut. A single straight line passes through V's edge
from 1 to 4, where NOT Q holds, and
through C's edge after 6, where C is supposed to know Q. It
is a consistent cut: its past is 1, 2, 3, 5, 6, its future
is 4, 7, and every message received in its past was sent in
its past — so it is one state the system could have been in.
And in that one state, Q is false at V while C knows Q. Both at once,
which cannot be. The supposition is what has to go: with no message
sequence from 4 to 6, C cannot know Q there.
This is the previous theorem read backwards — no path from where
the news was made to where it would be known, and the knowledge cannot
be there.
The same argument, run in the other direction, gives the mirror theorem: if C knows Q before a step e and NOT Q holds after a step e′, then there is a path in the dataflow graph from e to e′. Figure 3 is an instance — C knows the furnace is on, and the furnace is off only after the message C sent has arrived.
And one consequence worth stating on its own, because it is the shape of Figure 4:
Theorem If C knows Q before a step, and NOT Q holds after some later step, then there is a point in between at which C is uncertain about Q.
C cannot pass directly from knowing Q to knowing NOT Q. Something must happen, a message must travel, and while it travels C knows neither.
Finally, a distinction that is easy to lose. NOT (C knows Q) is not C knows NOT Q. The first is much weaker: it is satisfied either by C knowing NOT Q, or by C having no idea. That second case is what we have been calling uncertainty:
Uncertainty C is uncertain about Q means NOT (C knows Q) and NOT (C knows NOT Q).
Every “C uncertain” label in Figures 3 and 4 is that conjunction, and every one of them is produced by the same thing: a message that C has sent, or is waiting for, and cannot see.