
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 $\overrightarrow{a}=(\sqrt{3}\sin x,\;m+\cos x)$ and $\overrightarrow{b}=(\cos x,-m+\cos x)$, and let $f(x)= \overrightarrow{a}\cdot \overrightarrow{b}$.  
$(1)$ Find the analytical expression of the function $f(x)$; and determine its smallest positive period and the center of symmetry.  
$(2)$ When $x\in\left[-\frac{\pi}{6}, \frac{\pi}{3}\right]$, the minimum value of $f(x)$ is $-4$. Find the maximum value of the function $f(x)$ during this interval, and determine the corresponding value of $x$.

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