You can indeed formally define a function in terms of Cartesian products:
A subset $f$ of the Cartesian product $A\times B$ is said to be function mapping the elements of $A$ to to the elements $B$ if and only if for all $x\in A$ there exists a unique $y\in B$ such that $(x,y)\in f$.
You might also formally define functions as a certain kind of relation, but then you would you would probably have to define relations in terms of Cartesian products or some equivalent, e.g. arrow diagrams or graphs.
If you simply want to formally state that $f$ is a function mapping the elements of set $A$ to the elements of set $B$, I have found it very useful to write:
For all $x\in A$, we have $f(x)\in B$.
So, to answer your questions:
- Why the definition of function using concepts such as "rule" isn't rigorous?
Edit: Unlike the notions of Cartesian products and subsets, the notion of a "rule" is not formally defined in set theory and logic. There are no axioms about "rules". The closest you come is the selection criterion for a subset, but you only need to specify one if you are talking about a particular subset.
- Is there really any example which doesn't obey the definition but still is a function in the Cartesian Product sense?
No, but perhaps your friend is thinking of the notion of a partial function that is similar.
9 years later...
From Terence Tao's, "Analysis I," p. 49, we have the definition:
Definition 3.3.1 (Functions). Let $X$, $Y$ be sets, and let $P(x,y)$ be a property pertaining to an object $x \in X$ and an object $y \in Y$, such that for every $x \in X$, there is exactly one $y \in Y$ for which $P(x,y)$ is true (this is sometimes known as the vertical line test). Then we define the function $f : X \to Y$ defined by $P$ on the domain $X$ and range $Y$ to be the object which, given any input $x \in X$, assigns a output $f(x) \in Y$, defined to be the unique object $f(x)$ for which $P(x, f(x))$ is true. Thus, for any $x \in X$ and $y \in Y$, $$y = f(x) \iff P(x,y)\,\text{is true.}$$
Here, the "rule" is given by the binary predicate $P$