
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 $\triangle ABC$, the sides opposite to angles $A$, $B$, $C$ are denoted as $a$, $b$, $c$ respectively, and it is given that $a^2-(b-c)^2=(2-\sqrt{3})bc$, $\sin A\sin B=\cos^2\frac{C}{2}$.

$(1)$ Find the magnitude of angle $B$;

$(2)$ If the arithmetic sequence $\{a_n\}$ has a non-zero common difference, and $a_1\cos 2B=1$, and $a_2$, $a_4$, $a_8$ form a geometric sequence, find the sum of the first $n$ terms of the sequence $\left\{\frac{4}{a_na_{n+1}}\right\}$, denoted as $S_n$.

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