Search in sources :

Example 21 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL6Test method variable_elimination_sim_pred.

@Test
public void variable_elimination_sim_pred() {
    TestNAR tester = test;
    tester.believe("((bird --> $x) <-> (swimmer --> $x))");
    tester.believe("(bird --> swan)", 0.90f, 0.9f);
    tester.mustBelieve(cycles, "(swimmer --> swan)", 0.90f, 0.81f);
// 0.43f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 22 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL6Test method variable_unification4.

@Test
public void variable_unification4() {
    TestNAR tester = test;
    // en("What can be said about bird can also be said about robin.");
    tester.believe("<<bird --> $x> ==> <robin --> $x>>");
    // en("What can be said about swimmer usually can also be said about robin.");
    tester.believe("<<swimmer --> $y> ==> <robin --> $y>>", 0.70f, 0.90f);
    // en("What can be said about bird and swimmer can also be said about robin.");
    tester.mustBelieve(cycles, "<(&&,<bird --> $1>,<swimmer --> $1>) ==> <robin --> $1>>", 0.7f, /*1f? */
    0.81f);
    // tester.mustBelieve(cycles, "<(||,<bird --> $1>,<swimmer --> $1>) ==> <robin --> $1>>", 0.70f, 0.81f); //en("What can be said about bird or swimmer can also be said about robin.");
    // en("I guess what can be said about bird can also be said about swimmer.");
    tester.mustBelieve(cycles, "<<bird --> $1> ==> <swimmer --> $1>>", 1f, 0.36F);
    // en("I guess what can be said about swimmer can also be said about bird.");
    tester.mustBelieve(cycles, "<<swimmer --> $1> ==> <bird --> $1>>", 0.7f, 0.45f);
// tester.mustBelieve(cycles, "<<bird --> $1> <=> <swimmer --> $1>>", 0.7f, 0.45f); //en("I guess bird and swimmer share most properties.");
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 23 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL6Test method second_level_variable_unification_neg.

@Test
public void second_level_variable_unification_neg() {
    TestNAR tester = test;
    tester.believe("(((#1 --> lock) && --($2 --> key)) ==> open($2, #1))");
    tester.believe("--({key1} --> key)");
    tester.mustBelieve(cycles, "((#1 --> lock) && open({key1}, #1))", 1.00f, 0.81f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 24 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL6Test method strong_elimination.

// see discussion on https://groups.google.com/forum/#!topic/open-nars/1TmvmQx2hMk
@Test
public void strong_elimination() {
    TestNAR tester = test;
    tester.believe("((test($a,is,cat) && sentence($a,is,$b)) ==> ($a --> $b))");
    tester.believe("test(tim,is,cat)");
    tester.mustBelieve(cycles, "(sentence(tim,is,$1) ==> (tim --> $1))", 1.00f, // en("there is a lock which is opened by key1");
    0.73f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 25 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL6Test method variable_unification6.

@Test
public void variable_unification6() {
    TestNAR tester = test;
    // en("If something can fly, chirp, and eats worms, then it is a bird.");
    tester.believe("<(&&,<$x --> flyer>,<$x --> [chirping]>, <($x, worms) --> food>) ==> <$x --> bird>>");
    // en("If something can chirp and has wings, then it is a bird.");
    tester.believe("<(&&,<$y --> [chirping]>,<$y --> [withWings]>) ==> <$y --> bird>>");
    tester.mustBelieve(cycles, "<(&&,<$1 --> flyer>,<($1,worms) --> food>) ==> <$1 --> [withWings]>>", 1.00f, 0.45f);
    tester.mustBelieve(cycles, "<<$1 --> [withWings]> ==> (&&,<$1 --> flyer>,<($1,worms) --> food>)>", 1.00f, 0.45f);
/*
        <patham9> 
        first result:
            (&&,<$1 --> flyer>,<($1,worms) --> food>) ==> <$1 --> [withWings]>>
        it comes from the rule
            ((&&,C,A_1..n) ==> Z), ((&&,C,B_1..m) ==> Z) |- ((&&,A_1..n) ==> (&&,B_1..m)), (Truth:Induction)
        which basically says: if two different precondition conjunctions, with a common element lead to the same conclusion,
        it might be that these different preconditions in the specific conjunctions imply each other
        (each other because the premises can be swapped for this rule and it is still valid)

        second result:
            <<$1 --> [withWings]> ==> (&&,<$1 --> flyer>,<($1,worms) --> food>)>
        by the same rule:
            ((&&,C,A_1..n) ==> Z), ((&&,C,B_1..m) ==> Z) |- ((&&,B_1..m) ==> (&&,A_1..n)), (Truth:Induction)
        where this time the diffierent preconditions of the second conjunction imply the different preconditions of the first
        no, no additionally info needed
        now I will show you what I think went wrong in your system:
        you got:
            ((&&,(($1,worms)-->food),($1-->flyer),($1-->[chirping]))==>(($1-->[withWings])&&($1-->[chirping]))).
        abduction in progress ^^
        your result is coming from the induction rule
            (P ==> M), (S ==> M), not_equal(S,P) |- (S ==> P), (Truth:Induction, Derive:AllowBackward)
        there are two possibilities, either restrict not_equal further to no_common_subter,
        or make the constructor of ==> make sure that the elements which occur in predicate and subject as well are removed
        its less fatal than in the inheritance composition, the derivation isnt wrong fundamentally, but if you can do so efficiently, let it avoid it
        additionally make sure that the two
            ((&&,C,A_1..n) ==> Z), ((&&,C,B_1..m) ==> Z) |- ((&&,A_1..n) ==> (&&,B_1..m)), (Truth:Induction)
        rules work, they are demanded by this reasoning about preconditions
        *hypothetical reasoning about preconditions to be exact
         */
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Aggregations

TestNAR (nars.test.TestNAR)178 Test (org.junit.jupiter.api.Test)169 NALTest (nars.util.NALTest)162 NAL7Test (nars.nal.nal7.NAL7Test)18 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)11 Disabled (org.junit.jupiter.api.Disabled)5 NAR (nars.NAR)2 Concept (nars.concept.Concept)2 DoubleSummaryStatistics (java.util.DoubleSummaryStatistics)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 BiFunction (java.util.function.BiFunction)1 IntFunction (java.util.function.IntFunction)1 nars (nars)1 NARS (nars.NARS)1 TaskStatistics (nars.task.util.TaskStatistics)1 Term (nars.term.Term)1 DeductiveMeshTest (nars.test.DeductiveMeshTest)1 ETERNAL (nars.time.Tense.ETERNAL)1 NotNull (org.jetbrains.annotations.NotNull)1 Assertions.assertNotEquals (org.junit.jupiter.api.Assertions.assertNotEquals)1