upvote
How do you know the published code matches the authoritative law?
reply
First of all, tax forms themselves might be primary sources. It's not clear to me that tax forms are an unambiguous translation of prosaic tax law into mechanical steps that a human can follow. (For example, if the law calls for "progressive taxation" but doesn't specify the brackets, then it requires extra information to turn it into a calculation procedure.)

Otherwise, if tax forms are translations of underlying laws, then how do you know the forms are themselves correct? It's the exact same problem that you're positing about whether code matches law.

Since the whole point of tax forms is to perform a calculation - and preferably perform it correctly and deterministically - it's much better to leave that task to a computer than to a human.

To give a concrete example of how tax forms could benefit from code, take the 2025 Canadian federal personal income tax form (T1), and I'll comment on some features. https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5006...

> Employment income (box 14 of all T4 slips)

This references another data structure (T4 slip) and asks you to sum all of them (implied by the word "all"). But it's ambiguous because in some programming contexts, "all" means returning a list of numbers or items.

> Elected split-pension amount (complete Form T1032)

This basically asks you to jump into a subroutine, do some calculations, and return the result here.

> Amount of dividends (eligible and other than eligible)

This is a filter operation followed by a sum.

> if negative, enter "0"

In math notation, this is x = max(y, 0).

> Use the amount from line 26000 to complete the appropriate column below.

This repeats something a few lines down and is only useful for clarifying for humans.

> Line 70 minus line 71 (cannot be negative)

This is a sanity check like assert(x >= 0).

> Enter whichever is less: $1,471 or line 1 plus line 2.

There are actually two line numbering systems happening simultaneously, one on the left of the money box and one on the right.

> Amount from line 42000

Some instructions merely copy numbers from other sections in order to get the data more local to the current problem being handled. Computers don't care about locality in this sense.

reply