\(P=\dfrac{abc+a+b+c-\left(ab+bc+ca+1\right)}{a^2b+1-\left(a^2+b\right)}\)
\(=\dfrac{abc+a+b+c-ab-bc-ca-1}{a^2b+1-a^2-b}\)
\(=\dfrac{\left(a-1\right)+\left(abc-bc\right)-\left(ab-b\right)-\left(ca-c\right)}{\left(a^2b-a^2\right)-\left(b-1\right)}\)
\(=\dfrac{\left(a-1\right)+bc\left(a-1\right)-b\left(a-1\right)-c\left(a-1\right)}{a^2\left(b-1\right)-\left(b-1\right)}\)
\(=\dfrac{\left(a-1\right)\left(1+bc-b-c\right)}{\left(b-1\right)\left(a^2-1\right)}\)
\(=\dfrac{\left(a-1\right)\left[b\left(c-1\right)-\left(c-1\right)\right]}{\left(b-1\right)\left(a-1\right)\left(a+1\right)}\)
\(=\dfrac{\left(b-1\right)\left(c-1\right)}{\left(b-1\right)\left(a+1\right)}=\dfrac{c-1}{a+1}\)
\(\text{#}Toru\)