Live data from Hacker News

A Modern Compiler for the French Tax Code

arxiv.org

51–60 of 136 posts

Re: A Modern Compiler for the French Tax Code

#51

Earlier quoted context omitted.

There is no floating point representation for 'gross', 'egregious', or 'blatant'. At least not one that will be suitable in all cases.

Right on. Consider whether forcing someone to unlock their smartphone should constitute compelled self-incrimination. This is a problem that US courts have flip-flopped on. [0] How would an SMT solver derive answer? It can't. You'd need a general AI. Even ignoring the subtleties of the real world that the ̶l̶a̶w̶ edit legal system must cope with, nuts-and-bolts legal concepts like mens rea can't be mapped to algebrai…

but the law is not the judge

Re: A Modern Compiler for the French Tax Code

#52
post #36

Earlier quoted context omitted.

Cool - which country? Could you link to the Github repo?

I’m guessing it’s Estonia. It’s really ahead with digital governance.

Estonian here - no it is not Estonia.

Here our income tax declaration is very simple, the tax office already knows how much salary we have earned, and there aren't many deductions, so most people either don't have to file taxes at all, or just click next a few times and get their tax returns after a week or so. For 90% of people it takes less than 5 minutes.

Re: A Modern Compiler for the French Tax Code

#53
post #27

Earlier quoted context omitted.

I was rather thinking about fuzzying it to find gaps in tax laws.

In a previous job we built an advisor for banking and pensions using a mathematical optimiser solving over a model of the Danish tax rules. It would normally find enough tax savings to retire about a year earlier by finding the best savings strategies (e.g exploiting dynamic and temporal effects between taxation on spouses retiring at different times, using the house mortgage as a savings buffer to shift pension payo…

You should write a blog post or a HN story about that!

Re: A Modern Compiler for the French Tax Code

#54
post #35

If tax codes are so complex that authorities struggle to maintain the code that implements them, how are humans supposed to understand them well enough to follow the incentives they are designed to create?

Most of the time you only need a small subset which is manageable. I once tried to increase my deductions as a normal citizen but this went nowhere quickly as you need to create giant loopholes to get it done as a person. Businesses on the other hand are the ones using the complex stuff and they can hire an expert (in this case expensive doctors in the case of the body metaphor of the other poster) at quite some cost.

Re: A Modern Compiler for the French Tax Code

#55

Earlier quoted context omitted.

Could you clear something up for me, do you mean DSLs generally, or DSLs for tax codes specifically? TIA

DSLs in general, say in banking system, e commerce apps etc.

Well, this is (one of my) areas so here goes. DSLs are a concept, not an implementation. As implemented they can vary from chained procedure calls to actual sub languages with lexers and parsers (and I tend to consider the latter to be 'proper' DSLs, but that's just my view).

To have a 'proper' DSL I reckon you need two things, and understanding that a thing can and should be broken out into its own sublanguage, and the ability to do so. The first takes a certain kind of nouse, or common sense. The latter requires knowing how to construct a parser properly and some knowledge of language design.

Knowing how to write a parser is not particularly complex but as the industry is driven by requirements more of knowing 'big data' frameworks rather than stuff that is often more useful, well, that's what you get, and that includes people who try to parse XML with regular expressions (check out this classic answer https://stackoverflow.com/questions/1732348/regex-match-open...> Edit: if you haven't seen this check it out cos it's brilliant).

I think this reflects the fundamental problem in software development of the market's not knowing what's actually needed to solve real business problems.

++++

Edit, some reading material

https://www.amazon.co.uk/Language-Implementation-Patterns-Do...

https://www.amazon.co.uk/Definitive-ANTLR-Reference-Domain-S...

https://www.amazon.co.uk/yacc-Nutshell-Handbook-Doug-Brown/d...

They're all worth investing the time in.

Re: A Modern Compiler for the French Tax Code

#56

I've been asked to write parser of _my_country_law_ and something that's capable of doing diffs and putting it together (diff+original=>newest version) docs without knowledge in that domain after seeing sample doc I've estimated it on something like 1 week of work (XD) month later I've been crying and having like 20-30% done this shit has been so sensitive (insanely error prone) and debugging was time costly. I think…

I feel like legislation is a field that would benefit a great deal from the progress that software engineering has made in a number of fields.

It's already evolved somewhat into a DSL. With some nudging and technical leadership, I suspect that we could move it over entirely into a format that can be readily parsed, tested, and version control. The tax code is especially well-suited to this, because it's a lot of rules and math formulas.

In fact, I bet most tax software probably does something very similar to this.

Re: A Modern Compiler for the French Tax Code

#57
post #35

If tax codes are so complex that authorities struggle to maintain the code that implements them, how are humans supposed to understand them well enough to follow the incentives they are designed to create?

Most people don't know about the muscles or bone structures in their hands, but most people seem to know how to use their hands anyway, despite the gross complexity involved.

Most people aren’t at a gross disadvantage to those who know how to game the system or bribe authorities to make their hands work far better than others.

Re: A Modern Compiler for the French Tax Code

#58
post #46

During one of those rabbit hole journeys I discovered that Dutch Tax authorities use MPS, a DSL creation language/tool by JetBrains [1] It makes me wonder, why haven't DSLs caught up? Their claim that it allows developers spend more time implementing the business logic makes sense. But somehow that promise hasn't been realised. I'm curious to know from those who tried DSLs. [1] https://www.jetbrains.com/mps/documenta…

Modern computer languages are DSLs for writing DSLs, which you do by defining public domain specific classes, methods, modules, etc. A library for computing PI is a PI DSL. At least, that's the right way to name things in code.

That's really stretching the concept of a DSL, but at an extreme it can be seen that way. What you're really describing is hierarchical structure.

Re: A Modern Compiler for the French Tax Code

#59
post #30
post #20

Earlier quoted context omitted.

The languages breakdown is interesting. It seems GitHub refuses to admit defeat and categorises the .m files into various other languages which use the extension (M, MATLAB, Objective-C, Mathematica and Mercury). I wonder if they use some sort of fuzzy ML solution for categorising them rather than conventional parsing.

Wonder no more! https://github.com/github/linguist/blob/7c2adbdb15d4efd25d92... As most AI, it's regex and ifs all the way down.

> As most AI, it's regex and ifs all the way down.

This made me laugh way more than expected, mostly because of how true it is.

Post reply on HN