News for hackers. Stuff that matters.
Re:A Modern Compiler for the French Tax Code by nayuki on Monday January 30, 2023 @12:06PM (#34582794)
I wish the state officially makes their income tax calculation available as machine-executable open-source software. For example, a Python function that takes a dictionary of inputs (gross income, number of dependents, capital gains, etc.) and produces a dictionary of outputs (federal tax, state tax, rebates, contribution limits, etc.).

This would solve many problems: The verbosity and ambiguity of human language (tax laws, tax calculation forms in English), the ability to inspect and independently verify calculations done by the state, the rent-seeking tax preparation software companies.

Here is my own feeble concept at demonstrating the idea: https://www.nayuki.io/page/a-math-programming-view-of-canada...

Even if the state has its own online portal for you to review and adjust your tax return, I still want to see the full tax code be open source and runnable by the user.

Re:A Modern Compiler for the French Tax Code by el_nahual on Monday January 30, 2023 @01:19PM (#34584045)
I would accept just the test suite! For a given set of inputs here is your tax owed.
Re:A Modern Compiler for the French Tax Code by masklinn on Monday January 30, 2023 @01:30PM (#34584215)
> This would solve many problems: The verbosity and ambiguity of human language (tax laws, tax calculation forms in English)

1. It would not, the tax law remains the spec.

2. France does provide an executable encoding of the tax code, TFA is literally a compiler for that.

3. France started to do so circa 2016 (https://joinup.ec.europa.eu/collection/egovernment/document/...) after losing a FOIA-type case, though feelers had already been sent as a governmental agency (CAS) is at the root of OpenFisca (https://openfisca.org/), and by then the prime minister's data sharing and coordination office (etalab) had started using and contributing to it (https://openfisca.org/doc/manifest-history.html)

4. You can use OpenFisca to encode your own country's tax law, or lobby for your country to encode its tax law there (https://openfisca.org/en/packages/).

Re:A Modern Compiler for the French Tax Code by addcommitpush on Monday January 30, 2023 @01:38PM (#34584354)
Openfisca started a bit earlier, in 2011.
Re:A Modern Compiler for the French Tax Code by masklinn on Monday January 30, 2023 @01:40PM (#34584394)
Yep, I fixed the timeline a bit after checking out the history page, as my original memories were incorrect. I guess because I'd first heard of openfisca around the time of the lawsuit.
Re:A Modern Compiler for the French Tax Code by addcommitpush on Monday January 30, 2023 @02:28PM (#34585098)
It is my understanding that before it became an Etalab project, it was quite obscure.
Re:A Modern Compiler for the French Tax Code by nextaccountic on Monday January 30, 2023 @03:48PM (#34586161)
> 1. It would not, the tax law remains the spec.

Unless you rewrite the law to make the code the spec. Indeed, code is probably a better medium for unambiguously communicating calculations.

> 2. France does provide an executable encoding of the tax code, TFA is literally a compiler for that.

But other countries might not do so.

> 4. You can use OpenFisca to encode your own country's tax law, or lobby for your country to encode its tax law there (https://openfisca.org/en/packages/).

This would be amazing!

Re:A Modern Compiler for the French Tax Code by noughtme on Monday January 30, 2023 @04:42PM (#34586840)
> Indeed, code is probably a better medium for unambiguously communicating calculations.

Ambiguity and obfuscation are usually intentional. Legislators and individual citizens do not necessarily have the same interests. This is why omnibus bills exist.

Re:A Modern Compiler for the French Tax Code by astrange on Monday January 30, 2023 @08:44PM (#34589735)
Laws (in the US anyway) are "ambiguous" because they can't be changed very often, so implementing regulations are left to the executive branch, and the judicial branch can edit either one however they feel like anyway and aren't programmers.
Re:A Modern Compiler for the French Tax Code by quartesixte on Monday January 30, 2023 @09:15PM (#34590024)
Yeah I think the slight nuance that some people miss is that many of the regulations in place are interpretations and implementations of more ambiguous laws.

And they are updated quite frequently and implemented quite programmatically!

But the laws also remain ambiguous because the world is an ambiguous place with a lot of edge and corner cases with unforeseen knock on effects.

Re:A Modern Compiler for the French Tax Code by bee_rider on Monday January 30, 2023 @11:17PM (#34590995)
Definitely agree. Having lawmakers micromanage everything would be a pain.

That said, one would hope

1) the tax code would be one of the least open-to-creative-interpretation parts of the system

2) the IRS equivalent could actually produce this code, rather than legislators

Re:A Modern Compiler for the French Tax Code by astrange on Tuesday January 31, 2023 @06:51AM (#34593963)
I think the US actually has the preferable solution, which is that it's not a crime to do your taxes wrong. (Most people think it is.)
Re:A Modern Compiler for the French Tax Code by addcommitpush on Monday January 30, 2023 @01:35PM (#34584299)
The French "income tax" (which, confusingly, is only one of the several taxes on income in France, and not the largest) is open source (https://gitlab.adullact.net/dgfip/ir-calcul).

There's also the OpenFisca project (https://openfisca.org/en/) which is a Python framework for coding tax and benefit system - France being the most complete - which is used in many things, like a web app to see which benefits you might be eligible to (https://www.mesdroitssociaux.gouv.fr/accueil/) or the French National Assembly tool to compute the effects of changing tax law (https://socio-fiscal.leximpact.an.fr/).

Re:A Modern Compiler for the French Tax Code by andylynch on Monday January 30, 2023 @01:44PM (#34584456)
While this could help with the mechanical calculations and preparation of returns, the wider point about ‘verbosity and ambiguity of human language’ can’t be nearly so easily dealt with outside the simplest cases, and would likely make the tax code /harder/ for people concerned to interpret and reason about, which is probably the opposite of the desired result.

Firstly the actual text of the law must be as legislated.

Secondly, law and most certainly tax law is necessarily nuanced in interpretation and the consequences for taxpayers and the government are material (to use a relatively simple and well-known British case, a machine-executable model would be unhelpful in determining whether Jaffa Cakes should be taxed for VAT as biscuits, or exempt as cakes. Then ask about chocolate chip cookies (zero rated) vs chocolate digestives (taxed!)). Stuff like this and more is argued about all the time.

Re:A Modern Compiler for the French Tax Code by mytailorisrich on Monday January 30, 2023 @02:18PM (#34584979)
That's why you should keep things as simple as possible and avoid exceptions and special cases, which legislators are experts at creating in tax codes.

In your example this is because someone argued that staple food should not be taxed. Right, what is staple food? Obviously they decided that biscuits were but not cake. Pandora box is opened as soon as you allow any special cases.

Re:A Modern Compiler for the French Tax Code by MichaelZuo on Monday January 30, 2023 @05:01PM (#34587065)
How would you encode trillions of possible permutations of special cases?
Re:A Modern Compiler for the French Tax Code by BlueTemplar on Monday January 30, 2023 @04:11PM (#34586448)
Well, there's also that law which mandates that any algorithm used in an administrative decision must be explained in simple language upon request... but I am not certain that "administrative decisions" also covers the tax code ? (Though frankly, it should.)
Re:A Modern Compiler for the French Tax Code by klabb3 on Monday January 30, 2023 @05:03PM (#34587094)
> a machine-executable model would be unhelpful in determining whether Jaffa Cakes should be taxed for VAT as biscuits, or exempt as cakes.

You can have these definitions remain vague and still have an algorithm that is well defined over pre-labeled data. The purely mechanical steps based on arithmetic could (and should!) be defined as machine-parseable code or formulas.

Re:A Modern Compiler for the French Tax Code by hugh-avherald on Monday January 30, 2023 @09:04PM (#34589927)
There's considerable complexity in working out, for example, Australian personal income tax given a person's tax return (and assuming no dishonesty or error in it). I've seen mere approximations reach thousands of lines of C.
Re:A Modern Compiler for the French Tax Code by nicbou on Monday January 30, 2023 @02:04PM (#34584804)
Germany kind of does.

They publish all the diagrams for income tax calculation, if you can decipher them. It takes a while but you get it right eventually.

This is how I built my income tax calculator and keep it updated.

Re:A Modern Compiler for the French Tax Code by retrac on Monday January 30, 2023 @02:20PM (#34585013)
I imagine any country where taxation isn't roaming gangs, has a public description of how the tax system works, allowing you to calculate. But as you suggest, it is often hard to decipher. Canada's is supposedly relatively simple. If you request a paper kit, the whole thing is given as a step-by-step algorithm with lots of tables.

I did my taxes by hand until quite recently and it strained my working memory to the limit. Too many things to keep track of. Most people just copy over the requested fields and pray, I think.

Re:A Modern Compiler for the French Tax Code by sohnakukkar on Tuesday January 31, 2023 @02:57AM (#34592535)
Where one can find these diagrams?
Re:A Modern Compiler for the French Tax Code by nicbou on Tuesday January 31, 2023 @03:04AM (#34592570)
Re:A Modern Compiler for the French Tax Code by krackers on Monday January 30, 2023 @04:18PM (#34586511)
It would also allow people to re-use ML optimizers to get the highest tax returns!
Re:A Modern Compiler for the French Tax Code by concordDance on Monday January 30, 2023 @06:03PM (#34587915)
Does Excel count as open source and industry standard? Because if so, the UK has a giant tax spreadsheet you can put your data in and get tax owed: https://assets.publishing.service.gov.uk/government/uploads/...

This document is the source of truth for tax calculations so it'll always give you the right answer.

Re:A Modern Compiler for the French Tax Code by maelito on Tuesday January 31, 2023 @02:52AM (#34592505)
What a nightmare. Makes my i7 smoke with LibreOffice.

Better than nothing though.

Re:A Modern Compiler for the French Tax Code by gnad_sucks on Tuesday January 31, 2023 @12:39PM (#34598466)
Too good to be true.