I'm a bit confused on how to use homomorphims to prove irregularity or to prove that a language is not context free. This is what I'm currently thinking:
Example 1:
Let $L = \{ a^{i}b^{j}c^{k} : i = j = k \}$ and
$h: \{a, b, c\} \rightarrow \{a, b, \epsilon\}$ be defined as follows:
$$h(x) = \begin{cases} \epsilon & x = c\\ x & o.w.\end{cases}$$
Then it follows that
$h(L) = \{a^ib^j: i=j \} = \{a^{n}b^{n}: n \ge 0 \}$.
Now because $\{a^nb^n: n \ge 0 \}$ is known to be irregular,
then so is $L$.
Example 2:
We know that $P = \{0^p : p \text{ is a primes}\}$ is irregular
(by the pumping lemma).
Defined $h: \{0\} \to \{1\}$ as $h(1)=0$.
It follows that $h(P) = ${1^p : p \text{ is a primes}}$ and therefore is irregular.
I wrote these as answers to an exercise but I've been told that they are incorrect. I don't understand why?