Property Provider

LogicC#

Pedro Sobota
March/2024


Last time I had written here, I wrote a group of articles going about Mathematical topics under a computational light, and I've taken them off for revision. I'll probably not put them up again, in revised form, any soon, but one of the topics I went over were initial impressions over trying to exhaust combinations of properties of certain abstract structures, considered physical structures in programming and completely abstract structures in Mathematics: for example, sets, tuples, lists, and so on. (Well, it just so happens I don't believe a lot in this distinction, but I won't go into it here.) I'll just mention this topic provoked an advancement where I actually mapped a complete small set of combinations of properties of collections, and in the process, I realized I could now objectively rank them according to said set of properties, and discover new objects.

Concept

In a relation where objects are related to properties, we implemented scoring algorithms which ordered the objects with respect to a single object of the set and supplied a 'distance' measure between two objects. We now knew the most similar and dissimilar objects with respect to an object. We could, given a set of objects related to properties, check for holes and define missing combinations of properties as new, previously unknown, objects.

In the program I'll present in this article, these facets are present minimally in a convenient and self-contained form that contains concise and robust code, can be compiled easily using an open source compiler, run cross-platform, and carry no external dependencies, while providing functional usability. This is the beginning of a set of tools which progressively expand on the operations available while following the same minimal and canonical focus. More tools with specific applications in mind will also be implemented as needed, to give different forms to access the same functionality, or test applied concepts.

The strength of this approach is that the meaning of properties themselves is left for interpretation; the tool is mostly concerned with semantics and knowledge mapping. Variations of property sets or the meaning of properties can be stipulated; each combination is a project. The tool might be useful in occasions where a sizeable number of concepts are discussed, and, while the subject matter of the discussion is open for interpretation and philosophical, a semantic tool helps onboarding new participants into the discussion, or finding edge cases for practitioners, or controlling scopes of discourse; or keeping structure for documentation of complexity.

Demonstration

The following technical display should give a better illustration than any explanation.

Given the following input file:

Collections, Multiset
Collections, Tuple
Collections, Struct
Collections, ElementNamedTuple
Collections, Set
Collections, Track
Collections, Array
Collections, String
Collections, Column

Properties, NaturalOrdering
Properties, ElementNaming
Properties, Uniqueness
Properties, Typing
Properties, Naming

// Multiset has no properties

Collections.Tuple , Properties.NaturalOrdering
Collections.Struct, Properties.ElementNaming
Collections.Set   , Properties.Uniqueness
Collections.Track , Properties.Typing
Collections.String, Properties.Naming

Collections.ElementNamedTuple, Properties.ElementNaming
Collections.ElementNamedTuple, Properties.NaturalOrdering
Collections.Array            , Properties.NaturalOrdering
Collections.Array            , Properties.Typing
Collections.Column           , Properties.Naming
Collections.Column           , Properties.NaturalOrdering
Collections.Column           , Properties.Typing

The following results could follow:

PropertyProvider v0.1

PP> load D:\PropertyProviderConsoleSample.txt
2 classes constructed
14 class elements added
2 relations defined
24 relation elements defined

PP> help
exit, outfile, classes, relations, [className],
[className] v [className]
[className] v [className] (!|!!|?|??) [classElement]

PP> classes
Collections, Properties

PP> relations
(Collections, Properties), (Properties, Collections)

PP> Collections
Collections.Multiset, Collections.Tuple, Collections.Struct, Collections.ElementNamedTuple, Collections.Set, Collections.Track, Collections.Array, Collections.String, Collections.Column

PP> Properties
Properties.NaturalOrdering, Properties.ElementNaming, Properties.Uniqueness, Properties.Typing, Properties.Naming

PP> Collections v Properties
> 
+---------------------------+-----------------+
| (Collections, Properties) | 1/5             |
+---------------------------+-----------------+
| Multiset                  |                 |
| Tuple                     |                 |
| Struct                    | ElementNaming   |
| ElementNamedTuple         | ElementNaming   |
| Set                       |                 |
| Track                     |                 |
| Array                     |                 |
| String                    |                 |
| Column                    |                 |
+---------------------------+-----------------+
                           < >

> help
b|break, c|clear, pp, pn, pf, pl, p[pageNumber]

> pn
+---------------------------+-----------------+
| (Collections, Properties) | 2/5             |
+---------------------------+-----------------+
| Multiset                  |                 |
| Tuple                     |                 |
| Struct                    |                 |
| ElementNamedTuple         |                 |
| Set                       |                 |
| Track                     |                 |
| Array                     |                 |
| String                    | Naming          |
| Column                    | Naming          |
+---------------------------+-----------------+
                           < >

PP> Properties v Collections
> 
+---------------------------+-------------------+
| (Properties, Collections) | 1/9               |
+---------------------------+-------------------+
| NaturalOrdering           | Array             |
| ElementNaming             |                   |
| Uniqueness                |                   |
| Typing                    | Array             |
| Naming                    |                   |
+---------------------------+-------------------+
                           < >

PP> Properties v Collections
> pn
+---------------------------+-------------------+
| (Properties, Collections) | 2/9               |
+---------------------------+-------------------+
| NaturalOrdering           | Column            |
| ElementNaming             |                   |
| Uniqueness                |                   |
| Typing                    | Column            |
| Naming                    | Column            |
+---------------------------+-------------------+
                           < >

PP> Collections v Properties ! Set
> s
+---------------------------+-----------------+
| (Collections, Properties) | 1/5             |
+---------------------------+-----------------+
| (5) Set                   | ElementNaming   |
| (4) Multiset              | ElementNaming   |
| (3) Tuple                 | ElementNaming   |
| (3) Struct                |                 |
| (3) Track                 | ElementNaming   |
| (3) String                | ElementNaming   |
| (2) ElementNamedTuple     |                 |
| (2) Array                 | ElementNaming   |
| (1) Column                | ElementNaming   |
+---------------------------+-----------------+
                           < >

> pn
+---------------------------+-----------------+
| (Collections, Properties) | 2/5             |
+---------------------------+-----------------+
| (5) Set                   | Naming          |
| (4) Multiset              | Naming          |
| (3) Tuple                 | Naming          |
| (3) Struct                | Naming          |
| (3) Track                 | Naming          |
| (3) String                |                 |
| (2) ElementNamedTuple     | Naming          |
| (2) Array                 | Naming          |
| (1) Column                |                 |
+---------------------------+-----------------+
                           < >

PP> Properties v Collections !! Uniqueness
> s
+---------------------------+-------------------+
| (Properties, Collections) | 1/9               |
+---------------------------+-------------------+
| (9) Uniqueness            |                   |
| (6) ElementNaming         |                   |
| (6) Naming                |                   |
| (5) Typing                | Array             |
| (4) NaturalOrdering       | Array             |
+---------------------------+-------------------+
                           < >

PP> Properties v Collections ! Uniqueness
> s
+---------------------------+-------------------+
| (Properties, Collections) | 1/9               |
+---------------------------+-------------------+
| (9) Uniqueness            | Array             |
| (6) ElementNaming         | Array             |
| (6) Naming                | Array             |
| (5) Typing                |                   |
| (4) NaturalOrdering       |                   |
+---------------------------+-------------------+
                           < >

PP> Collections v Properties ? Array
> s
+---------------------------+-----------------+
| (Collections, Properties) | 1/5             |
+---------------------------+-----------------+
| (3) Struct                |                 |
| (3) Set                   | ElementNaming   |
| (3) String                | ElementNaming   |
| (2) Multiset              | ElementNaming   |
| (2) ElementNamedTuple     |                 |
| (1) Tuple                 | ElementNaming   |
| (1) Track                 | ElementNaming   |
| (1) Column                | ElementNaming   |
| (0) Array                 | ElementNaming   |
+---------------------------+-----------------+
                           < >
                           
> save
%LOCALAPPDATA%\PropertyProvider\PropertyProviderOut.txt

+---------------------------+-----------------+-----------------+-----------------+-----------------+-----------------+
| (Collections, Properties) | 1/5             | 2/5             | 3/5             | 4/5             | 5/5             |
+---------------------------+-----------------+-----------------+-----------------+-----------------+-----------------+
| (3) Struct                |                 | Naming          |                 |                 | Uniqueness      | 
| (3) Set                   | ElementNaming   | Naming          |                 |                 |                 | 
| (3) String                | ElementNaming   |                 |                 |                 | Uniqueness      | 
| (2) Multiset              | ElementNaming   | Naming          |                 |                 | Uniqueness      | 
| (2) ElementNamedTuple     |                 | Naming          | NaturalOrdering |                 | Uniqueness      | 
| (1) Tuple                 | ElementNaming   | Naming          | NaturalOrdering |                 | Uniqueness      | 
| (1) Track                 | ElementNaming   | Naming          |                 | Typing          | Uniqueness      | 
| (1) Column                | ElementNaming   |                 | NaturalOrdering | Typing          | Uniqueness      | 
| (0) Array                 | ElementNaming   | Naming          | NaturalOrdering | Typing          | Uniqueness      | 
+---------------------------+-----------------+-----------------+-----------------+-----------------+-----------------+

Observations

  • A project can contain any number of classes and relations. The "Properties" classes is not hardcoded and is just a "default" class name for properties of objects. Any classes of objects could be related
  • Tables are paged to allow a constant width for inspection. Full tables can be printed to files with save
  • Reverse relations are automatically created from any relation
  • The A v B ! C syntax, where A is the "key" class and B is the "value" class, performs similarity scoring (non-unique) in the relation with respect to element C of the key class. The descending similarity score is shown in parenthesis on the key cell
  • Dissimilarity scoring is also available with the ? operator
  • The double operators !! and ?? for scoring shows true or false values (which we call "characteristics"), as opposed to equal or distinct values (for similarity or dissimilarity respectively), for each key class
  • The project abstracts class element names as Symbols, which allows to:
    • Enforce uniqueness of Symbols on a class
    • Implement integer representation of Symbols on a powers-of-two scale: because 1) combination of elements on a Set is expressible as a sum, 2) powers-of-two sums are unique, and 3) classes are Sets, then element combinations, and thus Objects in a class, are expressible as unique integers

Implementation

The operations have been implemented in a command line program written in C# 11 and released under the AGPL-3.0.