# Constructive negation in regular prolog-is it possible?

**URL:** <https://swi-prolog.discourse.group/t/constructive-negation-in-regular-prolog-is-it-possible/6603>\
**Category:** Help!\
**Created:** [June 2, 2023, 1:40pm UTC](https://swi-prolog.discourse.group/t/constructive-negation-in-regular-prolog-is-it-possible/6603 "2023-06-02T13:40:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lug](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/lug/32/3876_2.png) [@lug](https://swi-prolog.discourse.group/u/lug)\
**Post date:** [June 2, 2023, 1:40pm UTC](https://swi-prolog.discourse.group/t/constructive-negation-in-regular-prolog-is-it-possible/6603/1 "2023-06-02T13:40:28Z")

</div>

I’m curious because I’ve seen a kanren implementation.

> **[Screenshot](https://prnt.sc/BhTvDm1kZhpT)**
>
> Captured with Lightshot

Can you make such an operator in Prolog? I’m aware there’s an implementation of it,

- That requires the goal to be tabled.
- casp seems to require a dialect(?) to be loaded and I’m not sure you can even use it in regular Prolog since the interpreter would complain about _not_ being overwritten.

```prolog
cnot(G) :- G =.. [Name|Args],
	bagof(Args, G, L),
	process_list(L, Args).
	
process_list(...) :- ... %applies diff on list

```

It’s easy to collect the answers to a predicate with bagof and then to apply _dif_. This almost works up to step 3, and then I’d need a bagof that displays inequality?
