Field nitrogen balance in Logical English

field-nitrogen-balance-le.le · output · proof · check · playground


The question

Four illustrative fields start with different soil nitrogen, fertilizer inputs, loss rates and crop demand. Which fields end up within 10% of demand, and which has the highest modeled leaching index?

What we tell eyemind

Add the soil nitrogen and fertilizer, then apply the loss fraction to get available nitrogen. The deficit is the amount by which demand exceeds availability, with a minimum of zero. The surplus goes the other way. The model calls a field balanced when availability is between 90% and 110% of demand, including both endpoints. It uses the actual demand to compute deficits and surpluses within that band too.

The illustrative leaching index multiplies the surplus by the loss fraction. The model keeps integer hundredths for the balances and ten thousandths for the index, then converts to kilograms of nitrogen per hectare for display.

What eyemind concludes

Field Available Deficit Surplus Leaching index Status
Dry 85 45 0 0 Under supplied
Loam 119 11 0 0 Balanced
High input 180 0 20 5 Over supplied
Sandy 168 0 18 7.2 Over supplied

The sandy field’s higher loss fraction gives it the largest leaching index, even though the high-input field has the largest surplus.

struct('le:answer', 'highest', 'field budgets', 'sandy field')

What the proof establishes

The saved proof is checked for the balances, the comparisons with the target band, and the maximum index across all four fields.

Try it

node bin/eyemind.js examples/field-nitrogen-balance-le.le
node bin/eyemind.js --check-proof examples/proof/field-nitrogen-balance-le.js examples/field-nitrogen-balance-le.le

Change the sandy field’s assumed loss from 40% to 50%. Its available nitrogen falls to 140 and the surplus disappears, so the high-input field now has the largest index.