# What guarantees simplify()?

How to convert (n!/k!)*binomial(k,n-k) to factorials? From an answer of tmonteil in question 30394:

```
var('k,n')
expr = n.factorial()/k.factorial()*binomial(k,n-k)
expr.factorial_simplify()
factorial(n)/(factorial(2*k - n)*factorial(-k + n))
```

The new question is: what is the contract of simplify() (or factorial_simplify())?

I think a simplification is only useful if it returns an equivalent expression. Is this is guaranteed?

In our example: Take n=1 and k=0. expr is 0 in this case but expr.factorial_simplify() is not defined (or gives an ValueError if executed) because factorial(2*k-n) = factorial(-1).

So my question might be rephrased: Is this an accidental bug or a systematic unreliability which renders simplify() essentially useless?

Peter

Simplification is simpler and hence presumably not always exactly the same. In fact, even

`x/x`

isn't really`1`

. I think one should expect measure zero differences in such situations.