Skip to content

Incorrect neutral element for missing values #65

@mantkiew

Description

@mantkiew

Currently (0.3.9), Clafer assumes 0 as a value for missing values, which is ok when doing addition (sum) but not multiplication (product).

For example,

a -> integer ? = 2
b -> integer ? = 3
c -> integer ? = a + b     // possible values are 0, 2, 3, or 5
d -> integer ? = a * b     // possible values are 0, 0, 0, or 6

That is because when a and b are not present, their values are assumed to be 0, which makes the result of multiplication 0 as well.

What should be the correct possible values for d: 1, 2, 3, 6 or 0, 2, 3, 6?

In general, instead of assuming a neutral element, the missing clafer should not be omitted in the formula as follows:

  1. one a && one b then a + b remains as is
  2. one a && no b then a + b is simplified to a
  3. no a && one b then a + b is simplified to b
  4. no a && no b then ?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions