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
| Name | Type | Range | Notes |
|---|---|---|---|
| income | money[GBP] | 0GBP to 10_000_000GBP |
Outputs
| Name | Type | Rounding | Notes |
|---|---|---|---|
| allowance | money[GBP] | down(1GBP) (rounded down to 1GBP) | |
| in_band | band (4 values) | ||
| rate | rate | down(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.
- band (4 values) — personal_allowance, basic, higher, additional
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.
| Name | Kind | Expression | Range | Notes |
|---|---|---|---|---|
| above_100k | Derived value | income − 100000GBP | -100_000GBP to 9_900_000GBP | |
| tapered | Derived value | 12570GBP − 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)
| Column | Source |
|---|---|
| income | Input |
| → allowance | Output 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
- Every combination of inputs matches some row (E101 completeness)
- There is no row that can never match (E102 unreachable row)
- No input matches two or more rows at once (E105 overlap). Reordering the rows does not change the meaning
Table band_of (policy unique)
Source: gov table1 (sources/uk-income-tax.md, sha256:8aa392743f75ce6f)
Band Taxable income Tax rate Personal Allowance Up to £12,570 0% Basic rate £12,571 to £50,270 20% Higher rate £50,271 to £125,140 40% Additional rate over £125,140 45%
| Column | Source |
|---|---|
| income | Input |
| → in_band | Output of this rule |
| → rate | Output of this rule |
| # | income | → in_band (band) | → rate (rate / down(1%)) |
|---|---|---|---|
| 1 | <=12570GBP (12570GBP or less) | personal_allowance | 0% |
| 2 | >12570GBP <=50270GBP (more than 12570GBP and 50270GBP or less) | basic | 20% |
| 3 | >50270GBP <=125140GBP (more than 50270GBP and 125140GBP or less) | higher | 40% |
| 4 | >125140GBP (more than 125140GBP) | additional | 45% |
What rulec check verified
- Every combination of inputs matches some row (E101 completeness)
- There is no row that can never match (E102 unreachable row)
- Every amount in this table is a value the copy it cites (gov table1) shows (E116)
- 2 of this table's boundaries fall on the side the copy puts them on (E119)
- No input matches two or more rows at once (E105 overlap). Reordering the rows does not change the meaning
Examples (verified)
| income | → allowance | in_band | rate |
|---|---|---|---|
| 10000GBP | 12570GBP | personal_allowance | 0% |
| 30000GBP | 12570GBP | basic | 20% |
| 100000GBP | 12570GBP | higher | 40% |
| 110000GBP | 7570GBP | higher | 40% |
| 125140GBP | 0GBP | higher | 40% |
| 200000GBP | 0GBP | additional | 45% |
rulec check ran these 6 examples through the reference evaluator, and every one produced the declared values (E107). The examples are an executable specification.