You can define such a type of function with Reduce.jl symbolic package:
julia> using Reduce
julia> finv(f::Function) = collect(Algebra.solve(:($f(x) == y),:x))
finv (generic function with 1 method)
julia> finv(cos)
2-element Array{Expr,1}:
:(x = acos(y) + 2 * arbint(5) * π)
:(x = -((acos(y) - 2 * arbint(5) * π)))
Also, to select the principal branch, set allbranch
to off
julia> allbranch(false)
false
julia> finv(cos)
1-element Array{Expr,1}:
:(x = acos(y))