
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 that the graph of the function $f(x) = m\sin x + \cos x$ $(x \in \mathbb{R})$ passes through the point $\left(\frac{\pi}{2}, -1\right)$,  
$(1)$ find the expression for $f(x)$ and determine the intervals where the function is monotonically increasing;  
$(2)$ if $g(x) = f(x) + 1$ and $x$ is in the interval $[0, \pi]$, find the minimum value of the function $g(x)$ and the corresponding set of values for $x$.

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