Are conjunctions commutative?

32 views
Skip to first unread message

Mark Schenk

unread,
Mar 25, 2025, 5:31:20 AMMar 25
to open-nars
Dear members,

I just started looking at the implementation of OpenNars and trying to understand the logic and was wondering whether NAL conjunctions should be commutative.

I was trying to simulate the following  

.       
        


by doing the following unit test:

@Test
public void testCommutativety() {
    Term termA = new Term("A");
    Term termB = new Term("B");

    Conjunction conjunctionOne = new Conjunction(new Term[]{termA, termB}, TemporalRules.ORDER_NONE, false, false);
    Conjunction conjunctionTwo = new Conjunction(new Term[]{termB, termA}, TemporalRules.ORDER_NONE, false, false);

    assertTrue(conjunctionTwo.equals(conjunctionOne));
}

The test fails because eventually the names of the conjunctions are compared instead of the terms in the Conjunction. Is that the expected behaviour and if so why are conjunctions not commutative.

With kind regards,
Mark Schenk

Patrick Hammer

unread,
Mar 25, 2025, 8:36:56 AMMar 25
to open...@googlegroups.com
Hi Mark!

In an implementation (a && b) and (b && a) either are different terms with transformation rules that allow deriving one from the other,
or alternatively conjunctions automatically get flattened and the terms sorted such that both lead to the same term.

Which version of OpenNARS are you considering?

Best regards,
Patrick

--
You received this message because you are subscribed to the Google Groups "open-nars" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-nars+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/open-nars/8dedd0b2-5978-4d46-839d-26af6dc3ff7dn%40googlegroups.com.

Pei Wang

unread,
Mar 25, 2025, 8:41:58 AMMar 25
to open-nars
Hi Mark,

Not sure which version you tested, but in  OpenNARS 1.5.8 (which I'm using in https://cis.temple.edu/~pwang/5590-AGI/5590-index.htm), when the following input is provided:
  (&&, A, B).
  (&&, B, A).
The following is displayed:
  IN: (&&,A,B). %1.00;0.90% {0 : 1}
  IN: (&&,A,B). %1.00;0.90% {0 : 2}
1
 OUT: (&&,A,B). %1.00;0.95% {1 : 1;2}

All commutative compounds (including conjunctions) are standardized in constructors with the components sorted.

Regards,

Pei
  

Mark Schenk

unread,
Mar 25, 2025, 8:58:24 AMMar 25
to open-nars
Hi Patrick/Pei,

I was using this version of OpenNARS: https://github.com/opennars/opennars/blob/master/pom.xml (3.0.4-SNAPSHOT).

Cheers,
Mark

Op dinsdag 25 maart 2025 om 13:41:58 UTC+1 schreef Pei Wang:

Mark Schenk

unread,
Mar 25, 2025, 4:22:21 PMMar 25
to open...@googlegroups.com
Hi Patrick,

I was wondering why you stated that (a && b) and (b && a) are different terms. I was under the impression that they would be same.

Cheers,
Mark

Op di 25 mrt 2025 om 13:58 schreef 'Mark Schenk' via open-nars <open...@googlegroups.com>:
--
You received this message because you are subscribed to a topic in the Google Groups "open-nars" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/open-nars/_sRbVP48W0w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to open-nars+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/open-nars/cc863860-7f66-4e46-b25e-5597d36c5f15n%40googlegroups.com.

Patrick Hammer

unread,
Mar 26, 2025, 6:39:31 AMMar 26
to open...@googlegroups.com
Hi Mark!

Depends on what you are referring to:
- Conceptually the terms (A && B) and (B && A) are logically identical.
- In the Java implementation Term is a class. Now, depending on the two possible design decisions I mentioned, (A && B) and (B && A) are represented by equal instances of Term or not.

Best regards,
Patrick

You received this message because you are subscribed to the Google Groups "open-nars" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-nars+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/open-nars/CACD36jwx%3DEvNekYXZzB2doT8w3Sw7jm-mVhiizhLRZKX%3Dat-7g%40mail.gmail.com.

Mark Schenk

unread,
Mar 27, 2025, 2:35:51 AMMar 27
to open...@googlegroups.com
Thanks Patrick,

That clarifies it a lot. I was indeed mixing logical/functional with implementation. 



Op wo 26 mrt 2025 om 11:39 schreef Patrick Hammer <pat...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages