Predicate that always returns true

This seems a bit clearer (I’ve never liked negative conditions in if-then-else, regardless of the programming language):

    ( network(Network, Subnet, _)
    -> true
    ;  % some_other_operation_with(Network)
    )

(\+)/1 can be tricky to get right if all the arguments aren’t ground. In your case, you seem to have two uninstantiated variables, Subnet and the anonymous _. Presumably you’re planning to use Subnet later in the predicate (otherwise you’d be getting a warning about Subnet being a singleton variable)? - but the (\+)/1 will undo any bindings, so the use of “not” seems wrong.

You might also want to try defining

network(Network, Subnet) :-
    network(Network, Subnet, _).

to get rid of the uninstantiated variable in your “not”. Or

network(Network) :-
    network(Network, _, _).

Another thing that’s worth considering:

    (    once(network(Network, Subnet, _))
    ;    % some_other_operation_with(Network)
    )
1 Like