Numerical Constraints

In Blawx, the value of a number in an answer can be a specific value, or it can be a range of values. These ranges of values can be logically combined to generate new ranges of values. The method used for doing this is called numerical constraints.

The Numerical Constraint Block

The numerical constraint block allows you to impose, as a requirement, that a variable is constrained to be greater than, greater than or equal to, less than, or less than or equal to, equal to, or not equal to another numerical value.

This block works on integers and real numbers.

Taxation Without Representation

To show how numerical constraints can be used, we will create a codebase to find out whether people are ever subject to taxation without representation. We will start with an ontology in which there are people, and a person has four attributes:

  • age, which is a number
  • can vote, which is true or false
  • must pay tax, which is true or false
  • taxation without representation age, which is a number

The ontology looks like this:

Tax Without Rep Ontology

Now we will create rules using the numerical constraints block. The first will indicate that a person can vote if their age is at least 18.

Voting Age Rule

Next we will indicate that a person must pay tax if they are at least 16.

Must Pay Tax Rule

Lastly, we will say that a persons is a sucker if they are required to pay taxes and not able to vote.

TWR Rule

Now, we will tell Blawx to assume that there are people, that they have ages, and ask Blawx whether anyone might be a sucker.

TWR Query

The answer, we know, is the person must pay taxes and may not vote when they are at least 16 and not yet 18. The "not yet 18" comes from the negation of "can vote", and the "at least 16" comes from the "must pay taxes". Blawx can combine those two ranges of values into a new range, "at least 16 and less than 18".

And that is the answer that Blawx provides, indicating that a person is a sucker if their age is at least 16 and less than 18.

TWR Answer