Advertisement
Data Processing

The Subtractive Pair: Why IIII and IV Are the Same Number and Different Strings

An exact string match reunites only 111 of 300 identical values. That measured result is the data hook for this article, not a story about bad data: e...

An exact string match reunites only 111 of 300 identical values. That measured result is the data hook for this article, not a story about bad data: every value in the second inventory is a correct spelling of what it names. The reunions fail because Roman numerals contain a notation rule, the subtractive pair, that gives some values two legitimate spellings.

What The Subtractive Pair means

The Subtractive Pair means the finding that canonical Roman numerals write 4, 9, 40, 90, 400 and 900 by subtraction, as IV, IX, XL, XC, CD and CM, so any value containing one of those pairs has two legitimate spellings, while a value without one has only one. Its nearest prior concept is The Base Sixteen, which covers counting and writing values in base sixteen. The difference is that The Base Sixteen changes the base of the numeral system itself, while The Subtractive Pair keeps base ten and changes only the notation rule inside the Roman system.

The 3 requirements for a stored numeral among 300 values

A tool selection starts with requirements, and a stored numeral here must survive three of them. The first is exact matching: two copies of the same value must be reunited by the cheapest comparison, a plain string match. The second is case handling: the stored form must state what happens when the same numeral arrives in lowercase. The third is parsing: a parser must recover the integer value, including any subtractive pairs, so values can be sorted and summed where string matching fails. The test set holds 300 distinct integers from 1 to 3,999. Inventory A stores all 300 as canonical subtractive Roman numerals in uppercase. Inventory B stores the same 300 in four blocks of 75: canonical uppercase, canonical lowercase, additive-only Roman, in which 4 is IIII, 9 is VIIII, 40 is XXXX, 90 is LXXXX, 400 is CCCC and 900 is DCCCC, and Arabic decimal.

The 4 candidates measured on 300 values

The stage table records what three reading strategies achieve across all four blocks: exact matching is the floor, casefolding the cheapest repair, the full parse the ceiling.

Reading stageMatched of 300False merges
Exact match1110
Casefold1860
Full parse3000

The exact-match total of 111 breaks down by Inventory B block: canonical uppercase contributes 75, canonical lowercase 0, additive-only 36, and Arabic decimal 0. The additive figure of 36 is the most instructive number in the table: those 36 rows are additive spellings whose values contain no subtractive component, so their additive and canonical spellings happen to be the same string. The other 39 additive rows contain at least one subtractive component in canonical form, so their spellings differ and exact matching loses them. Casefolding lifts the total to 186 of 300 by reuniting the 75 lowercase rows, and the full parse reaches 300 of 300 with 0 false merges.

Candidate 1: canonical uppercase for 75 exact rows

Canonical uppercase is the form Inventory A already uses, and its strength is exact matching: its own block of 75 rows in Inventory B reunites completely at the cheapest stage. It is also the shortest Roman spelling for any value containing a subtractive component, because a pair such as CM carries 900 in two characters. Its weakness is brittleness: the moment the same value arrives in lowercase, additive form, or Arabic decimal, the string no longer matches, and 225 of the 300 rows in Inventory B are written in one of those other forms.

Candidate 2: canonical lowercase for 75 casefold rows

Canonical lowercase carries the same values and the same subtractive pairs as the uppercase candidate; only the letter case changes. Measured against Inventory A, its block of 75 rows contributes 0 exact matches, the worst possible score on the first requirement. Its strength appears at the second stage: casefolding reunites all 75 of its rows, lifting the total from 111 to 186 of 300, still with 0 false merges. The weakness is that the repair sits in the reader, not the stored form, so a tool that compares before it casefolds splits every lowercase value from its uppercase twin.

Candidate 3: additive-only Roman and the 1994 worked example

Additive-only Roman removes the subtractive rule entirely: every value is written by adding symbols only, so 4 is IIII and 900 is DCCCC. Its strength is regularity: a reader never has to decide whether a smaller symbol before a larger one subtracts. Its measured weakness is exact matching: only 36 of its 75 rows reunite with canonical Inventory A, namely those whose values contain no subtractive component. The worked example is the year 1994. Canonically it is MCMXCIV, summing as 1000 plus 900 plus 90 plus 4, giving 1994 in 7 characters. Additively it is MDCCCCLXXXXIIII, summing as 1000 plus 500 plus 400 plus 50 plus 40 plus 4, also giving 1994, but in 15 characters. The two strings name the same value and still fail an exact match, because the difference sits in the subtractive pairs CM, XC and IV, which the additive spelling writes out in full.

Candidate 4: Arabic decimal for 75 parsed rows

Arabic decimal writes each value in familiar base-ten digits. Its strength is parsing: every one of its 75 rows is read directly as an integer, with no notation rule left to misunderstand. Its weakness, against a Roman Inventory A, is total string separation: its block contributes 0 exact matches and 0 casefold matches, because a digit string never equals a letter string. It joins the reunion only at the full parse stage, where a reader converts both sides to integers.

The exclusion reasons for 2 rejected forms

Two candidates are excluded on the measured evidence. Canonical lowercase is excluded because it scores 0 of 75 on exact matching against the canonical inventory and survives only through a reader-side repair. Additive-only Roman is excluded because it scores 36 of 75 on exact matching, loses precisely on values containing a subtractive component, and is the longest spelling for those values, 15 characters against 7 in the 1994 example. Neither form is wrong; both are excluded because exact matching is the one requirement the stored form itself must carry.

The recommendation of canonical uppercase within the 3,999 boundary

The recommendation is to store canonical subtractive Roman in uppercase, paired with a reader that casefolds and parses both additive and subtractive forms plus Arabic decimal at import time. Storage and reading go to the layers that measured best at each job: the stored form maximises exact matching, 75 of 75 for its own block and 111 of 300 across the mixed inventory before any reader runs, while the reader supplies the remaining reunions up to 300 of 300 with 0 false merges. The applicability boundary is explicit: it holds for values from 1 to 3,999, the range measured here, and says nothing about systems whose readers cannot be changed, where the Arabic candidate deserves a fresh selection run.

How the 300 integers were measured in batch 23

The counts here were produced by a purpose-built synthetic measurement for this batch; no commercial product was tested. A deterministic script, working from seed 42 and relying solely on the standard library, selected 300 integers whose values were known before any spelling was generated. It rendered each integer twice, once in canonical uppercase and once in one of four alternative spellings in equal blocks, then applied the matching strategies in stages: exact comparison, casefolding, and a full parse. The script and its result JSON are included in the batch evidence, so the whole run can be repeated and audited.

The Subtractive Pair: Why IIII and IV Are the Same Number and Different Strings

Questions on the subtractive pair, answered

Question 1: Why does exact matching reach 111 rather than 75? Because 36 additive-only rows hold values with no subtractive component, so their additive and canonical spellings are the same string. The 75 canonical uppercase rows plus those 36 give 111 of 300.

Question 2: What does casefolding add, and what does it still miss? Casefolding adds the 75 canonical lowercase rows, reaching 186 of 300 with 0 false merges. It still misses the additive rows whose spellings differ and every Arabic decimal row.

Question 3: How is the 300-value set checked as a whole? By its checksum: the sum of all 300 values is 571,655, and any reading of the set that changes a value changes that total.

The 1-sentence conclusion and its 2 conditions for 300 values

Store canonical uppercase and let the reader, not the stored string, absorb every other spelling. That conclusion holds under two conditions: the values stay within 1 to 3,999, the range actually measured, and the reader is allowed to casefold and parse additive, subtractive and Arabic forms at import. Outside those conditions the selection must be run again, because IIII will keep being IV long after the strings have stopped agreeing about it.

Sources

> Source: SmartDataAI batch 23 measurement, group AN5 (evidence/sd_batch23_measurements.py and evidence/sd_batch23_results.json, run 2026-11-26).

Know someone who needs this? Share it.

Advertisement