Is there a way to express the inverse of any function in Scala?

For example if I have a function `f` like this:

```
(x: Int) => x + 1

```

I would like to be able write an inverse function `g` like:

```
(f(x): Int) => x // not a valid scala syntax

```

or 

```
(x: Int) => inverse(f(x)) // inverse would return (x => x -1)

```

Do you know a way to do this kind of thing in Scala? 

N.B: `x => x+1` is just for the example. I'm looking for a generic way to solve this kind of task.