When a child reads ‘the pupils sent comments to each other’, ask who sent a comment to whom. The Reciprocal Relation Checker makes that question explicit. It compares three declared patterns: every person directly connected to every other person, every person able to reach every other person by following directed arrows, or every person involved in at least one connection.
This is an experimental vocabulary and reasoning guide for parents, students and educators. It connects primary-school relationship words with secondary explanations and precise technical language. Its code checks a small graph entered by a person; it does not decide what every English sentence containing each other must mean or turn missing observations into invented events.
- Draw a directed arrow for a specific recorded relation, such as Ada sent Ben a comment.
- A direct arrow, a path through other people and simple participation are different conditions.
- The relation and context must be understood before choosing the condition to check.
- An unrecorded arrow stays unknown unless its absence was actually established.
- Use the paper activity first; the tested code is a bounded research example, not an automatic English assessor.
In an invented activity, Ada comments on Ben’s work, Ben comments on Chen’s work, and Chen comments on Ada’s work. All three participate in a directed cycle. That does not establish that Ada directly commented on Chen’s work. A path from Ada through Ben to Chen is a different fact from a direct comment.
A parent can make the distinction visible with three name cards and arrows. There is no need to begin with graph terminology. Ask the learner to describe the record in a sentence that says exactly what happened. The formal labels become useful later, when the learner wants to compare several patterns without changing their meaning.
Find the part you need
Choose a route, or open the full chapter index below. The teaching chapters remain expanded; the complete runnable source is optional.
Full chapter index
Chapters 1–4
Chapters 5–8
Chapters 9–10
A relation needs people or objects in specified roles. ‘Ada sent Ben a comment’ places Ada in the sending role and Ben in the receiving role. Reversing the arrow changes the claim. It would take another observation to establish that Ben sent Ada a comment.
Before drawing arrows, name the activity and its time window. A comment sent on Monday should not quietly become evidence for a task restricted to Wednesday. Agree whether repeated comments count as one connection and whether a message sent to a group establishes a separate direct connection to each recipient. Those decisions belong in the event definition; this prototype does not make them for the reader.
The question is especially useful when an answer uses each other, one another, exchanged, shared or connected. Those words can hide different requirements. Rather than telling a child that the phrase always means every pair, ask for the specific events the passage supports.
| What a child says | Question to ask | Useful next step |
|---|---|---|
| They all helped each other | Who helped whom in the passage? | Draw only the supported help events |
| Ada is connected to Chen through Ben | Was there a direct event between Ada and Chen? | Keep direct connection and a path separate |
| Everyone took part | Did each person send, receive, or do both? | State the participation rule explicitly |
| No arrow means nothing happened | Was the absence checked, or is the record incomplete? | Use unknown for an unobserved relation |
| The AI says the sentence is wrong | Which interpretation and evidence did it use? | Review the actual task before accepting the label |
For this invented complete record, Ada sent Ben a comment, Ben sent Chen a comment, and Chen sent Ada a comment. No other direct comments occurred during the stated activity. The final sentence matters: it lets the example mark the other directed pairs false. Without it, those pairs would be unknown.
The record supports a directed path from every pupil to every other pupil. It also supports each pupil’s participation in at least one relation. It refutes the stronger requirement that every distinct ordered pair has a direct comment. In particular, Ada-to-Chen, Ben-to-Ada and Chen-to-Ben are missing from the complete event record.
Now consider a new, completely checked activity in which only Ada-to-Ben and Ben-to-Chen occurred. Every other distinct-pair relation, including Chen-to-Ada, is recorded false. This leaves a directed chain. Everyone still participates in some relation, because receiving counts for this local condition. However, Chen cannot reach Ada by following the arrows. Finally, consider two disconnected mutual pairs among four people. Everyone participates, but there is no directed path from either pair to the other.
| Recorded true arrows | Every direct ordered pair | Every ordered pair reachable | Everyone involved |
|---|---|---|---|
| Ada→Ben; Ben→Chen; Chen→Ada | Refuted | Supported | Supported |
| Ada→Ben; Ben→Chen | Refuted | Refuted | Supported |
| Ada↔Ben; Chen↔Devi | Refuted | Refuted | Supported |
| All six directed arrows among three people | Supported | Supported | Supported |
The checker asks the reader to choose a mode. Complete-directed-pairs requires every ordered pair of distinct members to have a true edge. Strongly-connected requires a directed path between every ordered pair. Non-isolated requires every member to have a true incoming or outgoing edge involving another member.
Keep the relation definition, event, time window and observation notes alongside the input. The checker accepts only members, edges and mode, so it does not store or verify those contextual details.
These definitions answer different formal questions. A path does not manufacture a direct relation: if Ada comments on Ben’s work and Ben comments on Chen’s work, the program does not conclude that Ada commented on Chen’s work. Likewise, a recipient with no outgoing edge can satisfy non-isolated. That mode checks involvement in either role.
Dalrymple, Kanazawa, Mchombo and Peters examine how reciprocal expressions receive different contextual interpretations and organise candidate conditions by logical strength. Their research supports caution about translating every occurrence of each other into one fixed all-pairs rule. The demonstration here uses three explicit finite graph conditions; it does not reproduce their entire interpretation theory. Read What Do Reciprocals Mean?
A sentence’s intended interpretation still depends on its relation, context and wording. Choosing a weaker mode simply to obtain a supported result would change the question. Record the chosen mode before checking the data, then justify that choice separately.
Paths here describe graph structure, not the forwarding of comment content or the chronological order of events.
An entered true edge means the record supports that directed relation. An entered false edge means the relation was checked and recorded as absent under the stated event definition. Null, or an omitted edge, means unknown. The program evaluates only those supplied annotations; it cannot verify who observed the activity.
For these three conditions, adding true edges cannot turn a supported graph into a refuted one. The checker can therefore evaluate a lower graph containing only known true edges and an upper graph containing known true plus unknown edges. If the lower graph already satisfies the condition, the result is supported. If even the upper graph cannot satisfy it, the result is refuted. Otherwise it is unknown.
That technique depends on the chosen conditions being monotone in added edges. It would not automatically work for a new condition such as ‘exactly two comments’. A future extension needs its own reasoning and tests. Missing evidence is also not a probability: unknown does not mean a fifty-fifty chance.
Each unknown directed pair may become true or false independently. The model imposes no symmetry, transitivity, time ordering, exclusivity or other constraint belonging to a particular real-world relation. A completion is a graph permitted by this code contract, not a claim that every such graph could occur in the activity. Additional relation constraints would need a separate model and check.
| Result | What it establishes | Next move |
|---|---|---|
| supported | Known true edges already satisfy the chosen condition | Explain the relevant edges or paths |
| refuted | No completion of the unknown edges can satisfy it | Inspect the blocked requirement and the recorded false edges |
| unknown | Different completions can produce different answers | Find a relevant missing observation |
| hold | The input is malformed or the group is empty | Correct identities, edge records or the mode before evaluating |
Use fictional names rather than a real friendship network. Put three cards on a table. Describe one event at a time and invite the learner to place an arrow from the sender to the recipient. With a younger child, use a familiar action such as passing a card; with an older child, use feedback on a short explanation.
First ask a direct question: ‘Did Ada send Chen a comment?’ Next ask a path question: ‘Could we follow the arrows from Ada to Chen?’ Finally ask a participation question: ‘Is anyone left out of every connection?’ Keep the wording steady while changing one arrow. Let the child explain what changed.
The original relation need not be transitive. Passing through Ben does not prove a direct message from Ada to Chen. If the child notices that point, record the explanation, including any help given. A correct response after copying your arrows differs from drawing and explaining a fresh case independently.
End with one honest uncertainty: leave an edge unobserved and ask what you would need to know. On another day, change the names and task. A brief independent explanation is more informative than asking the child to repeat a technical label. Ten minutes is a suggested activity format, not a tested learning prescription.
The primary-to-secondary connection is the growing precision of the question. A child first notices who acts and who receives an action. Later, the same learner can distinguish direct and indirect relations, explain a counterexample and write a rule that another person can apply.
The eduKate Vocabulary Learning Ladder has L0 Attend plus L1–L15, making sixteen positions. It is a proposed teaching architecture, not an official proficiency scale or a validated sequence of developmental milestones. A learner’s evidence belongs to the word, sense, task and support used on that occasion.
At L1 Identify, the learner selects the sender and recipient. At L3 Explain, the learner explains who did what to whom. L8 Disambiguate distinguishes the selected relation patterns. L9 Transfer applies the distinction in a new text. L11 Formalise expresses the chosen graph rule, and L13 Critique asks whether that rule fits the intended sentence. These are useful routes, not a requirement that every child must study graph algorithms.
| Learning operations | Possible task |
|---|---|
| L0 Attend; L1 Identify; L2 Name | Notice the sentence, select its people or objects and name the relevant relation. |
| L3 Explain; L4 Recall; L5 Read and encode | Explain the claim, revisit its meaning later and read or write it accurately. |
| L6 Relate; L7 Combine; L8 Disambiguate | Compare related expressions, form a natural sentence and separate the possible readings. |
| L9 Transfer; L10 Interpret; L11 Formalise | Apply the distinction in a new task, examine its effect and state a precise rule when useful. |
| L12 Trace over time; L13 Critique | Check whether wording or conventions changed and challenge conclusions that exceed the evidence. |
| L14 Govern; L15 Pioneer | Maintain a shared definition or propose and test a clearer distinction as an optional extension. |
The Fencing Method builds a correct sentence through controlled additions: base, concrete detail, tone or intention, reason or consequence, and a new context. The word exchanged is useful because the writer must keep track of both participants and the objects exchanged.
For this invented two-person story, Ada and Ben agreed to help each other clarify their drafts. They willingly exchanged exactly one constructive written comment each for that stated purpose, and each used the received comment to revise an explanation. These facts are supplied for practice; they must not be added to another passage without evidence.
| Step | Sentence or task | Check |
|---|---|---|
| 1. Correct base | Ada and Ben exchanged comments. | The two-way event is established in the invented record |
| 2. Concrete detail | Ada and Ben exchanged one written comment each about their drafts. | The objects and counts remain clear |
| 3. Tone or intention | They willingly exchanged constructive comments, as they had agreed. | The intention comes from the supplied story |
| 4. Reason or consequence | They exchanged comments so that each could clarify an explanation in the draft. | The stated purpose is supported by the invented facts |
| 5. New context | Two collectors exchanged postcards. | Explain what moved in each direction before adding details |
The function accepts at most six unique trimmed members and thirty supplied edge records. Each record contains from, to and value. Values are true, false or null; an omitted pair remains unknown. Self-edges, dangling endpoints and conflicting records produce a hold. Identical repeated records are coalesced, but they still count towards the thirty supplied-record limit.
A null and a known value for the same pair are treated as conflicting records. Replace the earlier record explicitly before checking. The output contains status, reason, mode and the lower/upper graph results; it does not return a discovered English interpretation or a list of explanatory paths. Save the full input with the chosen condition when recording the result.
| Check | Observed count | Coverage |
|---|---|---|
| Authored semantic fixtures | 31 | Cycles, separate pairs, direct versus path, unknowns, singleton conventions and frozen input |
| Malformed-input fixtures | 33 | Conflicts, duplicate members, self-edges, dangling endpoints and bounds |
| Empty-group checks | 3 | One hold for each mode |
| Exhaustive ternary graphs | 739 | All true/false/unknown directed graphs on 1–3 members |
| Exhaustive Boolean graphs | 4,096 | All fully observed directed graphs on four members |
| Structured larger graphs | 32 | Selected five- and six-member cases; not exhaustive |
| Oracle comparisons generated | 16,914 | The graph cases above evaluated under the selected modes and variants |
| Order-invariance checks | 2,313 | Reordering members and supplied edges preserves the semantic result |
The separately written oracle enumerates finite completions and checks directed connectivity using cut conditions instead of the production traversal. The larger cases do not exhaust all six-member graphs. Oracle completion work is not counted as extra independent tests, and no interpretation accuracy or learning outcome was measured.
The complete file below was executed with Node.js v24.22.3. All listed checks passed. These are synthetic software checks from the article-production environment, not independent empirical validation or evidence of improved learning. The functions are separate demonstrations; an integrated application and real-data validation remain unimplemented.
To reproduce the run, save the complete code block as reciprocal.js, then run node reciprocal.js. The assertions stop on a mismatch. No package installation or external service is needed; some tests use Node’s built-in assertion module.
Complete runnable reciprocal.js source and checks
'use strict';
/**
* Reciprocal Relation Checker
*
* Reader-selected finite graph contracts, not automatic interpretations of
* English "each other", and not an exhaustive theory of reciprocal meaning.
*
* reciprocalChecker({
* members: ['A', 'B', 'C'],
* edges: [{ from: 'A', to: 'B', value: true }],
* mode: 'strongly-connected'
* })
*
* Modes:
* complete-directed-pairs: every ordered pair of distinct members has an edge;
* strongly-connected: every ordered pair is joined by a directed path;
* non-isolated: every member has a true incoming OR outgoing edge.
*
* Edge values are true | false | null. Omitted pairs are unknown, not false.
* Each unknown pair may independently be true or false. No symmetry,
* transitivity, time ordering or other higher-order constraints are assumed.
* Reachability in one selected mode does not turn a path into a direct edge.
*
* At most 6 members and 30 supplied edge records. Duplicate member labels,
* dangling endpoints, self-edges and conflicting records for a directed pair
* are invalid. Identical repeated records are harmless and coalesced. A null
* record plus a known record for the same pair is conflicting input: replace
* the old record explicitly rather than silently resolving the conflict.
*
* Supported = every completion satisfies the selected contract.
* Refuted = no completion satisfies it. Unknown = both kinds are possible.
* Empty groups are held. A singleton supports the first two formal contracts
* vacuously; it refutes non-isolation because self-edges are excluded.
* Invalid input returns a separate hold result.
*
* No external dependencies. Node's built-in assert is loaded only by runTests.
*/
const MAX_MEMBERS = 6;
const MAX_EDGE_RECORDS = MAX_MEMBERS * (MAX_MEMBERS - 1);
const MODES = Object.freeze([
'complete-directed-pairs', 'strongly-connected', 'non-isolated'
]);
class InputError extends Error {}
function fail(message) {
throw new InputError(message);
}
function plainRecord(value, label) {
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
fail(`${label} must be a plain object.`);
}
const prototype = Object.getPrototypeOf(value);
if (prototype !== Object.prototype && prototype !== null) {
fail(`${label} must have a plain or null prototype.`);
}
for (const key of Reflect.ownKeys(value)) {
if (typeof key !== 'string') fail(`${label} cannot contain symbol keys.`);
const descriptor = Object.getOwnPropertyDescriptor(value, key);
if (!descriptor.enumerable || !Object.hasOwn(descriptor, 'value')) {
fail(`${label} must contain enumerable data properties only.`);
}
}
}
function exactKeys(value, expected, label) {
const keys = Object.keys(value);
if (keys.length !== expected.length ||
expected.some(key => !Object.hasOwn(value, key))) {
fail(`${label} must contain exactly: ${expected.join(', ')}.`);
}
}
function validate(input) {
plainRecord(input, 'input');
exactKeys(input, ['members', 'edges', 'mode'], 'input');
if (!Array.isArray(input.members)) fail('members must be an array.');
if (input.members.length > MAX_MEMBERS) {
fail(`At most ${MAX_MEMBERS} members are supported by this small model.`);
}
const members = input.members.slice();
const index = new Map();
members.forEach((member, position) => {
if (typeof member !== 'string' || member.length === 0 || member !== member.trim()) {
fail('Each member must be a nonempty, trimmed string label.');
}
if (index.has(member)) fail('Duplicate member labels are invalid.');
index.set(member, position);
});
// Array holes must not be silently skipped by forEach.
if (index.size !== members.length) fail('members cannot contain missing entries.');
if (!MODES.includes(input.mode)) {
fail(`mode must be one of: ${MODES.join(', ')}.`);
}
if (!Array.isArray(input.edges)) fail('edges must be an array.');
if (input.edges.length > MAX_EDGE_RECORDS) {
fail(`At most ${MAX_EDGE_RECORDS} edge records are supported.`);
}
const size = members.length;
const observations = new Map();
for (const edge of input.edges) {
plainRecord(edge, 'edge');
exactKeys(edge, ['from', 'to', 'value'], 'edge');
if (!index.has(edge.from) || !index.has(edge.to)) {
fail('Every edge endpoint must be an explicitly listed member.');
}
if (edge.from === edge.to) fail('Self-edges are excluded from this contract.');
if (edge.value !== true && edge.value !== false && edge.value !== null) {
fail('Each edge value must be true, false or null; null means unknown.');
}
const key = index.get(edge.from) * size + index.get(edge.to);
if (observations.has(key) && observations.get(key) !== edge.value) {
fail('Conflicting records for a directed pair must be resolved explicitly.');
}
observations.set(key, edge.value);
}
const lower = Array.from({ length: size }, () => Array(size).fill(false));
const upper = Array.from({ length: size }, () => Array(size).fill(false));
for (let from = 0; from < size; from++) {
for (let to = 0; to < size; to++) {
if (from === to) continue;
const key = from * size + to;
const value = observations.has(key) ? observations.get(key) : null;
lower[from][to] = value === true;
upper[from][to] = value !== false;
}
}
return { size, mode: input.mode, lower, upper };
}
function reachesAll(graph, reversed) {
const seen = Array(graph.length).fill(false);
const queue = [0];
seen[0] = true;
for (let cursor = 0; cursor < queue.length; cursor++) {
const current = queue[cursor];
for (let next = 0; next < graph.length; next++) {
const edge = reversed ? graph[next][current] : graph[current][next];
if (edge && !seen[next]) {
seen[next] = true;
queue.push(next);
}
}
}
return seen.every(Boolean);
}
function satisfies(graph, mode) {
const size = graph.length;
if (mode === 'complete-directed-pairs') {
return graph.every(row => row.filter(Boolean).length === size - 1);
}
if (mode === 'non-isolated') {
return graph.every((row, member) =>
row.some(Boolean) || graph.some(otherRow => otherRow[member]));
}
return reachesAll(graph, false) && reachesAll(graph, true);
}
function reciprocalChecker(input) {
let data;
try {
data = validate(input);
} catch (error) {
if (!(error instanceof InputError)) throw error;
return { status: 'hold', reason: 'invalid-input', detail: error.message };
}
const { size, mode, lower, upper } = data;
if (size === 0) return { status: 'hold', reason: 'empty-group', mode };
// All three contracts are monotone under adding true edges. The lower graph
// contains only known-true edges; the upper graph includes all unknown edges.
// Those two extreme completions therefore classify all possible completions.
const lowerSatisfies = satisfies(lower, mode);
const upperSatisfies = satisfies(upper, mode);
return {
status: lowerSatisfies ? 'supported' : !upperSatisfies ? 'refuted' : 'unknown',
reason: lowerSatisfies ? 'known-edges-satisfy-contract'
: !upperSatisfies ? 'possible-edges-cannot-satisfy-contract'
: 'unknown-edges-can-change-result',
mode,
lowerSatisfies,
upperSatisfies
};
}
function runTests() {
const assert = require('node:assert/strict');
const counts = {
tool: 'reciprocal-checker',
authoredFixtures: 0,
validationFixtures: 0,
emptyGroupChecks: 0,
exhaustiveTernaryGraphs: 0,
exhaustiveBooleanGraphs: 0,
structuredLargerGraphs: 0,
oracleComparisons: 0,
orderInvarianceChecks: 0,
oracleCompletionEvaluations: 0
};
const pairKey = (from, to) => JSON.stringify([from, to]);
const pairsOf = members => members.flatMap(from =>
members.filter(to => to !== from).map(to => [from, to]));
const input = (members, mode, edges = []) => ({ members, mode, edges });
const closedEdges = (members, truePairs) => {
const positives = new Set(truePairs.map(([from, to]) => pairKey(from, to)));
return pairsOf(members).map(([from, to]) =>
({ from, to, value: positives.has(pairKey(from, to)) }));
};
const check = (name, data, expected) => {
const result = reciprocalChecker(data);
assert.equal(result.status, expected, name);
counts.authoredFixtures++;
return result;
};
const two = ['A', 'B'];
const three = ['A', 'B', 'C'];
const four = ['A', 'B', 'C', 'D'];
const cycle = closedEdges(three, [['A', 'B'], ['B', 'C'], ['C', 'A']]);
check('a directed cycle is strongly connected', input(three, 'strongly-connected', cycle), 'supported');
check('a path is not a direct edge', input(three, 'complete-directed-pairs', cycle), 'refuted');
check('cycle members are non-isolated', input(three, 'non-isolated', cycle), 'supported');
const outwardStar = closedEdges(three, [['A', 'B'], ['A', 'C']]);
check('incoming edges count for non-isolation', input(three, 'non-isolated', outwardStar), 'supported');
check('an outward star is not strongly connected', input(three, 'strongly-connected', outwardStar), 'refuted');
check('a star is not all directed pairs', input(three, 'complete-directed-pairs', outwardStar), 'refuted');
const twoComponents = closedEdges(four, [['A', 'B'], ['B', 'A'], ['C', 'D'], ['D', 'C']]);
check('non-isolated does not mean connected', input(four, 'non-isolated', twoComponents), 'supported');
check('two mutual pairs are not strongly connected', input(four, 'strongly-connected', twoComponents), 'refuted');
for (const mode of MODES) {
check(`absent edges remain unknown: ${mode}`, input(two, mode), 'unknown');
check(`complete true graph: ${mode}`,
input(three, mode, closedEdges(three, pairsOf(three))), 'supported');
check(`complete false graph: ${mode}`, input(three, mode, closedEdges(three, [])), 'refuted');
}
const oneDirection = [{ from: 'A', to: 'B', value: true }];
check('one edge supports non-isolation for two members', input(two, 'non-isolated', oneDirection), 'supported');
check('one edge does not establish a return path', input(two, 'strongly-connected', oneDirection), 'unknown');
check('one edge does not establish the reverse direct edge', input(two, 'complete-directed-pairs', oneDirection), 'unknown');
const blockedReturn = [...oneDirection, { from: 'B', to: 'A', value: false }];
check('known false return refutes two-member strong connection',
input(two, 'strongly-connected', blockedReturn), 'refuted');
check('known false return does not refute non-isolation', input(two, 'non-isolated', blockedReturn), 'supported');
const openPath = [{ from: 'A', to: 'B', value: true }, { from: 'B', to: 'C', value: true }];
check('open path has no isolated member', input(three, 'non-isolated', openPath), 'supported');
check('open path with missing return is undetermined', input(three, 'strongly-connected', openPath), 'unknown');
check('explicit null equals absence', input(two, 'strongly-connected', [
...oneDirection, { from: 'B', to: 'A', value: null }
]), 'unknown');
check('identical repeated records are idempotent',
input(two, 'non-isolated', [...oneDirection, ...oneDirection]), 'supported');
check('singleton complete-pair contract is vacuous', input(['A'], 'complete-directed-pairs'), 'supported');
check('singleton is strongly connected by zero-length paths', input(['A'], 'strongly-connected'), 'supported');
check('singleton cannot have a permitted incident edge', input(['A'], 'non-isolated'), 'refuted');
const unusual = ['__proto__', 'constructor', 'A->B'];
check('labels are identities, not object property paths', input(unusual, 'strongly-connected', [
{ from: '__proto__', to: 'constructor', value: true },
{ from: 'constructor', to: 'A->B', value: true },
{ from: 'A->B', to: '__proto__', value: true }
]), 'supported');
const frozen = Object.freeze({
members: Object.freeze(two.slice()), mode: 'non-isolated',
edges: Object.freeze([Object.freeze({ from: 'A', to: 'B', value: true })])
});
check('frozen input is not mutated', frozen, 'supported');
for (const mode of MODES) {
const result = reciprocalChecker(input([], mode));
assert.equal(result.status, 'hold');
assert.equal(result.reason, 'empty-group');
counts.emptyGroupChecks++;
}
const valid = input(two, 'strongly-connected');
const accessorEdge = { from: 'A', to: 'B' };
Object.defineProperty(accessorEdge, 'value', { enumerable: true, get() {
throw new Error('The validator must not execute accessors.');
}});
const invalid = [
null, undefined, false, [], 'input', {},
{ ...valid, members: 'A' },
{ ...valid, members: ['A', 'A'] },
{ ...valid, members: [''] },
{ ...valid, members: [' B'] },
{ ...valid, members: [1] },
{ ...valid, members: Array(2) },
{ ...valid, members: ['A', 'B', 'C', 'D', 'E', 'F', 'G'] },
{ ...valid, mode: 'every-member-outgoing' },
{ ...valid, mode: 'weak-connected' },
{ ...valid, edges: null },
{ ...valid, edges: {} },
{ ...valid, edges: Array(1) },
{ ...valid, edges: [null] },
{ ...valid, edges: [{ from: 'A', to: 'C', value: true }] },
{ ...valid, edges: [{ from: 'A', to: 'A', value: null }] },
{ ...valid, edges: [{ from: 'A', to: 'B' }] },
{ ...valid, edges: [{ from: 'A', to: 'B', value: undefined }] },
{ ...valid, edges: [{ from: 'A', to: 'B', value: 'false' }] },
{ ...valid, edges: [{ from: 'A', to: 'B', value: true, weight: 1 }] },
{ ...valid, edges: [accessorEdge] },
{ ...valid, edges: [Object.assign(Object.create({ hidden: true }),
{ from: 'A', to: 'B', value: true })] },
{ ...valid, edges: [{ from: 'A', to: 'B', value: true, [Symbol('x')]: 1 }] },
{ ...valid, edges: [{ from: 'A', to: 'B', value: true },
{ from: 'A', to: 'B', value: false }] },
{ ...valid, edges: [{ from: 'A', to: 'B', value: null },
{ from: 'A', to: 'B', value: true }] },
{ ...valid, edges: Array.from({ length: 31 }, () =>
({ from: 'A', to: 'B', value: true })) },
{ ...valid, unexpected: true },
{ ...valid, members: [], edges: oneDirection }
];
for (const data of invalid) {
const result = reciprocalChecker(data);
assert.equal(result.status, 'hold');
assert.equal(result.reason, 'invalid-input');
assert.equal(typeof result.detail, 'string');
counts.validationFixtures++;
}
// Independent oracle: enumerate every completion, then inspect the complete
// edge set. Strong connectivity is checked by every nontrivial directed cut
// having an outgoing edge, not by the implementation's two traversals.
function oracle(data) {
const pairs = pairsOf(data.members);
const records = new Map(data.edges.map(edge => [pairKey(edge.from, edge.to), edge.value]));
const knownTrue = new Set();
const unknown = [];
for (const [from, to] of pairs) {
const key = pairKey(from, to);
if (records.get(key) === true) knownTrue.add(key);
else if (!records.has(key) || records.get(key) === null) unknown.push(key);
}
if (unknown.length > 12) throw new Error('Oracle fixtures must bound unknown pairs.');
function concreteTruth(truePairs) {
if (data.mode === 'complete-directed-pairs') return truePairs.size === pairs.length;
if (data.mode === 'non-isolated') {
const incident = new Set();
for (const [from, to] of pairs) {
if (truePairs.has(pairKey(from, to))) {
incident.add(from);
incident.add(to);
}
}
return incident.size === data.members.length;
}
const size = data.members.length;
for (let mask = 1; mask < (1 << size) - 1; mask++) {
const inside = new Set(data.members.filter((member, bit) => mask & (1 << bit)));
const crossesOut = pairs.some(([from, to]) =>
inside.has(from) && !inside.has(to) && truePairs.has(pairKey(from, to)));
if (!crossesOut) return false;
}
return true;
}
let foundTrue = false;
let foundFalse = false;
for (let mask = 0; mask < 2 ** unknown.length; mask++) {
const truePairs = new Set(knownTrue);
unknown.forEach((key, bit) => { if (mask & (1 << bit)) truePairs.add(key); });
const truth = concreteTruth(truePairs);
counts.oracleCompletionEvaluations++;
foundTrue ||= truth;
foundFalse ||= !truth;
if (foundTrue && foundFalse) return 'unknown';
}
return foundTrue ? 'supported' : 'refuted';
}
function compareWithOracle(members, edges, checkOmissions, checkOrder) {
for (const mode of MODES) {
const data = input(members, mode, edges);
const expected = oracle(data);
assert.equal(reciprocalChecker(data).status, expected);
counts.oracleComparisons++;
if (checkOmissions) {
const sparse = edges.filter(edge => edge.value !== null);
assert.equal(reciprocalChecker(input(members, mode, sparse)).status, expected);
counts.oracleComparisons++;
}
if (checkOrder) {
assert.equal(reciprocalChecker(input(members.slice().reverse(), mode,
edges.slice().reverse())).status, expected);
counts.orderInvarianceChecks++;
}
}
}
// Exhaust all three-valued directed graphs for 1, 2 and 3 members.
for (let size = 1; size <= 3; size++) {
const members = Array.from({ length: size }, (_, index) => `M${index}`);
const pairs = pairsOf(members);
for (let code = 0; code < 3 ** pairs.length; code++) {
let remainder = code;
const edges = pairs.map(([from, to]) => {
const value = [false, true, null][remainder % 3];
remainder = Math.floor(remainder / 3);
return { from, to, value };
});
compareWithOracle(members, edges, true, true);
counts.exhaustiveTernaryGraphs++;
}
}
// Independently exhaust all 2^12 fully observed directed graphs on 4 members.
const fourPairs = pairsOf(four);
for (let mask = 0; mask < 2 ** fourPairs.length; mask++) {
const edges = fourPairs.map(([from, to], bit) =>
({ from, to, value: Boolean(mask & (1 << bit)) }));
compareWithOracle(four, edges, false, false);
counts.exhaustiveBooleanGraphs++;
}
// Structured five- and six-member cases: varied positive/negative edges and
// up to six independently unknown pairs. This exercises the size boundary
// without falsely claiming exhaustive enumeration of all six-member graphs.
for (const size of [5, 6]) {
const members = Array.from({ length: size }, (_, index) => `M${index}`);
const pairs = pairsOf(members);
for (let variant = 0; variant < 16; variant++) {
const edges = pairs.map(([from, to], edgeIndex) => ({
from, to,
value: edgeIndex % 5 === variant % 5 ? null
: ((edgeIndex * 7 + variant) % 4 === 0)
}));
compareWithOracle(members, edges, true, true);
counts.structuredLargerGraphs++;
}
}
return { ...counts, maxMembers: MAX_MEMBERS, maxEdgeRecords: MAX_EDGE_RECORDS, passed: true };
}
module.exports = { reciprocalChecker, runTests, MAX_MEMBERS, MAX_EDGE_RECORDS, MODES };
if (require.main === module) {
process.stdout.write(`${JSON.stringify(runTests())}\n`);
}
Recorded run output
{
"tool": "reciprocal-checker",
"authoredFixtures": 31,
"validationFixtures": 33,
"emptyGroupChecks": 3,
"exhaustiveTernaryGraphs": 739,
"exhaustiveBooleanGraphs": 4096,
"structuredLargerGraphs": 32,
"oracleComparisons": 16914,
"orderInvarianceChecks": 2313,
"oracleCompletionEvaluations": 24895,
"maxMembers": 6,
"maxEdgeRecords": 30,
"passed": true
}
Does each other always mean every possible pair?
The appropriate interpretation depends on the relation and context. Use the actual sentence and evidence. The checker tests the condition selected by a reader; it does not choose the interpretation automatically.
Can a path stand in for a direct comment?
A path is a sequence of recorded edges. It does not create a direct event between its endpoints. Only the strongly-connected mode uses paths as its stated condition.
What happens with one member?
Under the formal definitions, every distinct ordered pair and reachability have no missing distinct-pair requirement for a singleton. Non-isolated fails because self-edges are excluded. These are conventions of the mathematical model, not advice to use each other with one person. Use at least two people for the language activity.
Can we use this to assess friendships?
This article uses fictional task events. Its Boolean graph does not measure the quality of relationships, kindness, belonging or social competence. Keep the activity about language and the explicitly recorded action.
Dalrymple, Kanazawa, Mchombo and Peters: What Do Reciprocals Mean?. Primary research on contextual reciprocal interpretations. The code checks three selected graph conditions without choosing an English interpretation.
The examples, code and teaching activities on this page are bounded demonstrations. The cited researchers did not validate this prototype. The displayed source is not installed as an interactive VocabularyOS service on this page.
For the previous correction cycle, read Semantic Recovery Verification. For the shared teaching framework, use the complete vocabulary ladder and Fencing Method for Vocabulary.
Continue this batch: The Comparison-Class Audit: Above Average Compared With Which Group?; Collective–Distributive Reading Guard: Did the Group Do It, or Did Each Person?; The Aggregation Reversal Witness: Can the Overall Percentage Reverse Every Group Comparison?.
Contents · Previous chapter · Continue with the Fencing Method
