Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error messages on simple backward chainer variation #219

Open
ngeiswei opened this issue Dec 11, 2024 · 0 comments
Open

Error messages on simple backward chainer variation #219

ngeiswei opened this issue Dec 11, 2024 · 0 comments
Assignees
Labels
bug Issues that represent errors in the code

Comments

@ngeiswei
Copy link
Contributor

What is your problem?

MeTTaLog generates tons of error messages on a simple backward chainer variation.

How to reproduce your problem?

Run the following metta code

;; Knowledge base
!(bind! &kb (new-space))
!(add-atom &kb (: AND (-> Boolean Boolean Boolean)))
!(add-atom &kb (: X Boolean))

;; Backward chainer
;; Base case
(= (bc $kb $_ (: $prg $type)) (match $kb (: $prg $type) (: $prg $type)))
;; Recursive steps
;; Unary operators
(= (bc $kb (S $k) (: ($fun $arg) $type))
   (let* (((: $fun (-> $prms $type)) (bc $kb $k (: $fun (-> $prms $type))))
          ((: $arg $prms) (bc $kb $k (: $arg $prms))))
     (: ($fun $arg) $type)))
;; Binary operators
(= (bc $kb (S $k) (: ($fun $arg1 $arg2) $type))
   (let* (((: $fun (-> $prms1 $prms2 $type))
           (bc $kb $k (: $fun (-> $prms1 $prms2 $type))))
          ((: $arg1 $prms1) (bc $kb $k (: $arg1 $prms1)))
          ((: $arg2 $prms2) (bc $kb $k (: $arg2 $prms2))))
     (: ($fun $arg1 $arg2) $type)))

;; Test bc
!(bc &kb (S (S Z)) (: $prg Boolean))

What do you get?

At some point the MeTTaLog interpreter outputs

#(failed #( : user once ) #( : user #(if_or_else #(eval = $10000 494 &self (return X) $10001) #(call eval (return X) $10001)) ))


#(on_mettalog_error #(failed #( : user once ) #( : user #(if_or_else #(eval = $10000 494 &self (return X) $10001) #(call eval (return X) $10001)) )))

^  Call: (283) [user] call(user:once, user:if_or_else(eval(=, _954712, 494, '&self', [return, 'X'], _955146), call(eval, [return, 'X'], _955146)))
...

What should you expect instead?

[(: X Boolean), (: (AND X X) Boolean), (: (AND X (AND X X)) Boolean), (: (AND (AND X X) X) Boolean), (: (AND (AND X X) (AND X X)) Boolean)]

What else do you have to say?

Tested on revision 5241cf1.

@ngeiswei ngeiswei added the bug Issues that represent errors in the code label Dec 11, 2024
@TeamSPoon TeamSPoon self-assigned this Dec 13, 2024
TeamSPoon added a commit to logicmoo/metta-testsuite that referenced this issue Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that represent errors in the code
Projects
None yet
Development

No branches or pull requests

2 participants