If $a$ is a positive element in a unital C*-algebra $\mathcal{A}$, with norm $\|a\|=1$. Let $P$ be a non-zero positive projection in $\mathcal{A}$. How to prove: $$P\leq a \Longleftrightarrow aP=P ?$$ Also, if for any pure state $f$ such that $f(P)=1$, we always have $f(a)=1$, then it implies $P\leq a$.
I'm thinking of the hereditary C*-subalgebra, the closure of $a\mathcal{A}a$. But can't see how to proceed.
If $ap=p$, taking adjoints you get $pa=p$. Then $ap=pa$ and $$ p=a^{1/2}pa^{1/2}\leq a^{1/2}1a^{1/2}=a. $$ Conversely, if $p\leq a$ then $1-a\leq 1-p$. So $$ 0\leq p(1-a)p\leq p(1-p)p=0. $$ Thus $p(1-a)p=0$. We can write this as $[(1-a)^{1/2}p]^*(1-a)^{1/2}p=0$, and so $(1-a)^{1/2}p=0$, from where we get $(1-a)p=0$. That is $ap=p$.
As for your other question, suppose that $f(a)=1$ whenever $f$ is a pure state with $f(p)=1$. For such a state we have by Cauchy-Schwarz $$\tag1 |f(a(1-p))|≤f(aa^*)^{1/2}\,f(1-p)^{1/2}=0. $$ Therefore $f(a(1-p))=0$. Then $1=f(p)=f(ap)=f(pa)$.
Let $g$ be a pure state of the subalgebra $pAp$. We can extend $g$ to a state of $A$ by $\tilde g(x)=g(pxp)$. Suppose that $\tilde g=th+(1-t)k$ for states $h,k$ and $t\in[0,1]$. Since $th\leq\tilde g$ and $\tilde g(1-p)=0$, we get that $h(1-p)=0$. Using Cauchy-Schwarz as above we get $h((1-p)x)=0$ for all $x$. It follows that $h(x)=h(pxp)$ for all $x$ and similarly for $k$. Then $h,k$ can be seen as states on $pAp$ and by the purity of $g$ we get that $h=k=g $. So $\tilde g$ is pure.
As we just showed, any pure state $f$ of $pAp$ can be seen as a pure state of $A$ with $f(p)=1$. Then $f(a)=1$; we have from $(1)$ (note that the positivity of $a$ was not used there) that $$ f(a(1-p))=f((1-p)ap)=0. $$ Then $$ 1=f(a)=f(ap+a(1-p))=f(ap)=f(pap). $$ This can be done for any pure state of $pAp$ and pure states separate points, so we have $pap=p$. This we can write as $p(1-a)p=0$. As we showed before, this gives us $ap=p$ and thus $p\leq a$.