Rule uk_income_tax v1

The UK Personal Allowance and the Income Tax band an income falls in, for England, Wales and Northern Ireland. Transcribed from GOV.UK

Try a case

Enter the inputs: the rows that match light up and the outputs appear. What runs is the generated code itself, and the line it would write to a log is shown as it is.


Inputs

NameTypeRangeNotes
incomemoney[GBP]0GBP to 10_000_000GBP

Outputs

NameTypeRoundingNotes
allowancemoney[GBP]down(1GBP) (rounded down to 1GBP)
in_bandband (4 values)
rateratedown(1%) (rounded down to 1%)

Types

An enum is a closed finite set. Add a value, and every table that does not look at it fails the completeness check.

Derived Values and Definitions

Intermediate values that can be placed in a table column. The expressions are as written in the source file, and the ranges are the declared ones.

NameKindExpressionRangeNotes
above_100kDerived valueincome − 100000GBP-100_000GBP to 9_900_000GBP
taperedDerived value12570GBP − above_100k × 50%-4_937_430GBP to 62_570GBP

That the declared range of every derived value contains all the values actually reachable from the input ranges was verified by rulec check (E112).

Table allowance_of (policy unique)

ColumnSource
incomeInput
→ allowanceOutput of this rule
#income→ allowance (money[GBP] / down(1GBP))
1<=100000GBP (100000GBP or less)12570GBP
2>100000GBP <125140GBP (more than 100000GBP and less than 125140GBP)tapered
3>=125140GBP (125140GBP or more)0GBP

What rulec check verified

Table band_of (policy unique)

Source: gov table1 (sources/uk-income-tax.md, sha256:8aa392743f75ce6f)

BandTaxable incomeTax rate
Personal AllowanceUp to £12,5700%
Basic rate£12,571 to £50,27020%
Higher rate£50,271 to £125,14040%
Additional rateover £125,14045%
ColumnSource
incomeInput
→ in_bandOutput of this rule
→ rateOutput of this rule
#income→ in_band (band)→ rate (rate / down(1%))
1<=12570GBP (12570GBP or less)personal_allowance0%
2>12570GBP <=50270GBP (more than 12570GBP and 50270GBP or less)basic20%
3>50270GBP <=125140GBP (more than 50270GBP and 125140GBP or less)higher40%
4>125140GBP (more than 125140GBP)additional45%

What rulec check verified

Examples (verified)

income→ allowancein_bandrate
10000GBP12570GBPpersonal_allowance0%
30000GBP12570GBPbasic20%
100000GBP12570GBPhigher40%
110000GBP7570GBPhigher40%
125140GBP0GBPhigher40%
200000GBP0GBPadditional45%

rulec check ran these 6 examples through the reference evaluator, and every one produced the declared values (E107). The examples are an executable specification.