Skip to content

Duplicated instances in sets - inconsistency with set theory? #422

@ConstantinVasilev

Description

@ConstantinVasilev

When I noticed this initially, I thought it might be a bug but then I saw that it is also included in the documentation under Multiset-semantincs

%%logica Fruit

@Engine("duckdb");

Fruit("apple");
Fruit("apple");
Fruit("orange");

The result of the above code is table with values ["apple", "apple", "orange"]

If Fruit is a predicate defined by 1 arg and we have 2 instances with the same value of this arg, then why these instances aren't considered the same thing and should be duplicated? From predicate point of view these instances are completely undistinguishable.

The set method in Python confirms this:
set({"apple", "apple", "orange"}) -> {'apple', 'orange'}

I guess the goal is to allow for the multiset generalisation but is there an option to revert to standard sets, if someone doesn't want this behaviour?

When working predicate logic it is useful to know that accidental data duplications are not possible since there should be at least one predicate argument which differs between any two instances, and this value explains the difference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions