
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
In the Cartesian coordinate system $xoy$, with the origin $O$ as the pole and the positive half-axis of $x$ as the polar axis, a polar coordinate system is established using the same unit of length as the Cartesian coordinate system $xoy$. It is known that the polar coordinates of point $P$ are $(4, \frac{\pi}{2})$, and the polar equation of line $l$ is $\rho\cos (\theta- \frac{\pi}{4})=a$, and point $P$ lies on line $l$.  
$(1)$ Find the value of $a$ and the Cartesian equation of line $l$;  
$(2)$ Suppose the parametric equation of curve $C$ is $\begin{cases} x= \sqrt{3}\cos \theta \\ y=\sin \theta \end{cases}$ (with $\theta$ as the parameter), find the maximum distance from points on curve $C$ to line $l$.

Present the answer in LaTex format: \boxed{Your answer}
user