
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
Given $M(1+\cos 2x,1)$, $N\left(1, \sqrt{3}\sin 2x+a\right) (x\in\mathbb{R},a\in\mathbb{R},a$ is a constant$)$, and $y= \overrightarrow{OM}\cdot \overrightarrow{ON}$ (where $O$ is the origin of coordinates).

$(1)$ Find the function relationship $y=f(x)$ with respect to $x$;

$(2)$ Find the monotonic intervals of the function $y=f(x)$;

$(3)$ If $x\in\left[0, \frac{\pi}{2}\right]$ and the maximum value of $f(x)$ is $4$, find the value of $a$.

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