r/AskComputerScience • u/StudyNeat8656 • Sep 22 '25
Question: Is there a inverse function z to take functions' inverse?
For example, I have a function f
```scheme
(define (f input) (+ 1 input))
```
Its inverse is
```scheme
(define (f- input (- input 1))
```
I mean, is there a function z, have (z f)==f-
Of course this question has practical means: if I have a program zip, then I can directly have unzip program with z(zip). Non coding work need to be done.
1
Upvotes
View all comments
Show parent comment
3
u/tavianator Sep 23 '25
There's no uncountable inputs in CS :)
You can use that dovetailing trick to make it work in an output-sensitive way. So if there is a solution of length n, it will find it in exponential time in n