# Prolog directives aren't consistent with logic and very misleading... right?

**URL:** <https://swi-prolog.discourse.group/t/prolog-directives-arent-consistent-with-logic-and-very-misleading-right/8924>\
**Category:** General\
**Created:** [April 2, 2025, 9:09am UTC](https://swi-prolog.discourse.group/t/prolog-directives-arent-consistent-with-logic-and-very-misleading-right/8924 "2025-04-02T09:09:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![iaroslav\_baranov](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/iaroslav_baranov/32/7850_2.png) [@iaroslav\_baranov](https://swi-prolog.discourse.group/u/iaroslav_baranov)\
**Post date:** [April 2, 2025, 9:09am UTC](https://swi-prolog.discourse.group/t/prolog-directives-arent-consistent-with-logic-and-very-misleading-right/8924/1 "2025-04-02T09:09:21Z")

</div>

When we write  
`A :- B, C, D`  
We mean in logic  
`(B and C and D) -> A`

What does this mean then?  
`:- B, C, D`

I’ve spend 5 hours pondering the logical meaning and how to fit it all together. This is how the directives work in Prolog:

```prolog
:- true. %no error
:- false. %Warning: Goal (directive) failed: user:false

```

Let’s assume we imagine “false” into the left side:

```prolog
false :- true % true->false, no error BUT it makes our kb logically inconsistent
false :- false % false->false, OK but error

```

If we put true:

```prolog
true:- true %true -> true, OK
true:- false %false -> true, OK but error

```

In this case, nothing needs to be checked, but Prolog still checks the right part

There is [a table on wiki](https://en.wikipedia.org/wiki/Horn_clause?utm_source=chatgpt.com), but I still can’t fit it all together.

Can you confirm the prolog directives syntax is wrong and misleading, so they should have used different format and symbols for procedural directives?

---

<div class="post-metadata">

**Author:** ![brebs](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@brebs](https://swi-prolog.discourse.group/u/brebs)\
**Post date:** [April 2, 2025, 2:00pm UTC](https://swi-prolog.discourse.group/t/prolog-directives-arent-consistent-with-logic-and-very-misleading-right/8924/2 "2025-04-02T14:00:28Z")

</div>

Directives are defined at [SWI-Prolog -- Loading Prolog source files](https://www.swi-prolog.org/pldoc/man?section=consulting) - here’s a snippet:

A _directive_ is an instruction to the compiler. Directives are used to set (predicate) properties (see [section 4.15](https://www.swi-prolog.org/pldoc/man?section=declare)), set flags (see [set\_prolog\_flag/2](https://www.swi-prolog.org/pldoc/man?predicate=set_prolog_flag/2)) and load files (this section). Directives are terms of the form `:-` . .

It’s probably confusing to be attempting to redefine the **built-in** true/0 and false/0.

The built-in definitions can be seen (although `true` is implemented in C for performance, so no Prolog code is available):

```prolog
?- listing(false).
system:false :-
    fail.

?- listing(true).
% Foreign: system:true/0

```

As an example with non-conflicting names:

```prolog
mytrue :- true.
mytrue :- false.

```

The `mytrue :- false.` declaration is of course useless, because it will never succeed.

The output will be:

```prolog
?- mytrue.
true ;
false.

```

… which means that the `true` predicate succeeds, with a choicepoint to try the 2nd line, and the 2nd line (`false`) fails.

This is better illustrated with an argument (e.g. `yes`):

```prolog
mytrue(yes) :- true.
mytrue(yes) :- false.

```

… which results in:

```prolog
?- mytrue(Y).
Y = yes ;
false.

```
