Question: Something like this:

```
decr(X, X) :-
    X is X-1.

```

I want to use it for decrement a number in the parent rule , if this number equal 0 for example, the parent rule return `false.`

Answer: 
Prolog is *declarative*: one of the properties of a declarative language is that **once you set a variable, you cannot give it another value anymore**. In Prolog backtracking can of course "unground" a variable and furthermore you can assign a partially grounded expression to a variable (like `X=f(1,_)`), but when you move deeper into the call stack, each expression can *only be grounded further*.

As a result: you have to use another variable. Like:

```
decr(X,NX) :-
    NX is X-1.

```

This is also logical: here you defined `decr(X,X)` and since **the argument of predicates in Prolog have no input/output direction**, it is unclear whether you want to call it like `decr(4,3)`, `decr(X,3)`, `decr(4,X)` or `decr(X,Y)`. So how can Prolog "*know*" that your second `X` is supposed to be the "new `X`"? It is thus a "fundamental property" of Prolog you cannot use `X`, call a predicate, and all of a sudden `X` has a different value (it can however - as said before - be grounded further, but an integer cannot be grounded further).

The reason why it will **always error or fail** is because, either `X` is not instantiated: (like `decr(_,_)`) in which case Prolog cannot calculate `X is _-1`, or you have given one of the argument a number (`decr(X,3)`, `decr(4,X)` or `decr(3,3)`), but in that case you ask that both operands can unify (since they are both `X`) and are off by one at the same time, which is a contradiction.
As already mentioned, you can't reassign variables in Prolog, but the closest thing available out-of-box to what you apparently want is succ/2 predicate:

```
?- succ(1, X).
X = 2.

?- succ(X, 5).
X = 4.

```

The next closest is probably plus/3:

```
?- plus(1, 2, X).
X = 3.

?- plus(1, X, 3).
X = 2.

?- plus(X, 2, 3).
X = 1.

```