In the category Sets consider the object (i.e., set) $A$ defined as the positive real numbers, another object (set) $B$ defined as the negative reals, and a function $f$ defined as the negative square root. So, $f(25)=-5$ and $f(9)=-3$ , etc.
Now define a functor $F$ from Sets to Sets such that $F(A)=-A$, $F(B)=-B$, and $F(f)=f$.
Strangely, we now we have a "function" that takes the negative square root of a negative number and gives a positive real number. This is clearly impossible in any normal sense of sets and functions.
As stated in Wikipedia, "the category Set is the category whose objects are Sets. The arrows or morphisms between sets $A$ and $B$ are all triples $(f,A,B) $ where $f$ is a function from $A$ to $B$."
Here is my problem: The functor above from Sets to Sets shows that f need NOT be a function from one set to another set (because the negative square root function cannot map a negative number to the positive reals). All this violates the definition of the category Sets, and/or the definition of a function, and/or the definition of a set (of numbers).
What am I doing wrong? Is $F$ not a functor? (And if not, how would I be able to tell it's not a valid functor?)
EDIT: Let me restate the second part of my question (in parentheses above), since it has not been answered so far: Suppose we have a given category $D$ and we are given a pair of functions (f,g) where the domain of f is the objects of $D$ and the domain of g is the arrows of $D$. This pair may, or may not, constitute a functor from $D$ to some other (unspecified) category.
My question concerns what methods/tests/procedures one can use to determine whether such a pair of functions constitutes a functor, or not. (Perhaps no general methods exist, or perhaps the question is too broad, but if that is the case, then that should be the answer to my question.)