(4) (Total 20 points) In the right triangle $\triangle ABC$, $\angle ACB=90^{\circ}$, $M$ is a point on $AB$, and $AM^2 + BM^2 + CM^2 = 2AM + 2BM + 2CM - 3$. If $P$ is a moving point on the segment $AC$, and $\odot O$ is the circle passing through points $P, M, C$, and a line through $P$ parallel to $AB$ intersects $\odot O$ at point $D$.
(1) (8 points) Prove that $M$ is the midpoint of $AB$;
(2) (12 points) Find the length of $PD$.
(1) From the given, we have
$$
(A M-1)^{2}+(B M-1)^{2}+(C M-1)^{2}=0,
$$

which implies $A M=B M=C M=1$, meaning $M$ is the midpoint of $A B$.
(2) From $\left\{\begin{array}{l}M A=M C \Rightarrow \angle A=\angle M C A, \\ P D / / A B: \angle A=\angle C P D\end{array}\right.$
$\Rightarrow \angle M C A=\angle C P D$, thus $\overparen{P} M=\overparen{C D}$, and $P C / / M D$. Since $A P \| A$, then $A P D M$ is a parallelogram, hence $P D=1$.