1)For your 1st example,look at https://stackoverflow.com/questions/9875760/sum-of-elements-in-list-in-prolog#:~:text=The%20answer%20is%20simple%3A,lists%20with%20that%20specific%20sum.
"it does not allow you to generate lists with that specific sum"
2)For your 1st example, if you look at the signature, 2nd argument is - i.e. only output, so a result!
3)If you want a bidirectional workaround, think about member(+,+)
for example