prove or disprove: if $y'=y^2-\cos(x)$ then any solution diverges in a finite time given the following ode, prove or disprove:

*

*if $y'=y^2-\cos(x)$ then any solution diverges in a finite time.

"diverge" means, that there is a point $x$ where the solution isn't continuous (there and thereafter).

if $y(0)>1$ or $y(0)<-1$ it's clear how to show it.
for instance, take $y(0)>1$, and let say we have $x$ where for the first time $y(x)=1$.
then according to the mean value theorem there is $t$ where $y'(t)<0$ and then it applies that $y(t)<1$, thus $x$ is not the first time we reached $y(x)=1$, therefore there isn't such point.
The problem is showing that if $-1<y(0)<1$ it must go out from this range in a finite time.
Edit
I thought about a solution $y'=y^2-\cos(x)>y^2-1$, which its solution is $\frac{1-e^{2c+2x}}{e^{2c+2x}+1}$, which might have a pole. depending on y(0)
 A: Fleshing out my comment above. I'll first show the following:

*

*There are numbers $a < \frac{\pi}{2} < b$ and a solution $y = y_0(x)$ with the properties
$$
y_0(\frac{\pi}{2}) = -1,  \; \lim_{x \to a} y_0(x) = - \infty, \; \lim_{x \to b} y_0(x) = + \infty 
$$
Proof. Let $y = y_0(x)$ be the solution with $y_0(\frac{\pi}{2}) = -1$ and let $(a, b)$ be its maximal interval of existence. Then clearly $y_0(x)$ is $< -1$ for $x < \pi/2$, close to this number. Let's say $y_0(x_0) = -1 - \delta$ for some $x_0 < \pi/2$. As in the argument given by the OP, this implies $y_0(x) < -1 - \delta$ for all $x < x_0$ as long as the solution exists. Since we know $y_0' \ge y_0^2 - 1$ and the solution of $w' = w^2 - 1, \, w(x_0) = -1- \delta$ goes to $- \infty$ in finite time as $x$ decreases below $x_0$, this implies that $y_0(x) \to - \infty$ as $x \to a$ where $a$ is finite.
Next, for $\frac{\pi}{2} \le \pi < \min(b, 3 \pi/2)$ we have $\frac{d}{dx} y_0(x) \ge - \cos x$. Consequently $y_0(x) \ge - \sin x$ on this interval and $y_0(3 \pi/2) \ge 1$.
Now if $b \le 3 \pi/2$, we are done, since the only way that is can happen is if $|y_0(x)| \to \infty$ as $x \to b$ and $y_0(x)$ cannot go to $- \infty$.
So we may assume that $b > \frac{3 \pi}{2}$. In this case as before $y(x) > 1$ for $x > 3 \pi/2$, close to $3 \pi/2$. We can again use the inequality $y_0' \ge y_0^2 - 1$ to show that $y_0(x) \to + \infty$ as $x \to b$ and $b$ is finite.
Next it follows that

*

*For each $k \in \mathbb{Z}$  there is a solution $y = y_k(x)$ with the properties
$$
\lim_{x \to a + 2 k \pi} y_k(x) = - \infty, \; \lim_{x \to b+ 2 k \pi} y_k(x) = + \infty 
$$
where $a, \, b$ are as above.

Simply set $y_k(x) = y_0(x - 2 k \pi)$.
Finally let $y(x)$ be an arbitrary solution.

*

*Then $y$ exists on a finite interval and goes to $\pm\infty$ at the right / left endpoint.

Proof. Pick a $c$ such that $y(c)$ is defined.  Let $M = \max(2 \pi, b-a)$. Suppose $y$ exists on $[c, c + 2M]$. We can then find a solution $y_k$ as above and a number $d \in [c, \, c + M]$ such that $y_k(d) < y(d)$. Then $d > a + 2 k \pi$. It follows that $y(x) \to \infty$ as $x \to b + 2k\pi < d + M + 2 \pi \le c + 2M$, contradiction.  Such a solution therefore must go to $+\infty$ before $x$ reaches $c + 2M$. The same argument shows that $y(x)$ must go to $-\infty$ before $x$ reaches $c - 4 M$. This completes the proof.
Edit: There was an incorrect estimate in the earlier version of the proof of the first bullet. This has now been fixed and the proof has been streamlined.
A: Gosh -- this is hard! I've tried plotting a streamline plot of the ODE, which seems to confirm finite-time blowup. The horizontal axis is the $x$-coordinate; the vertical axis is the $y$-coordinate.

As a rough first argument, you can say that $y^2 + \cos(x) \approxeq y^2$ for $y$ large. More precisely, as $y \to \infty$, we have $y^2 + \cos(x) \to y^2$ since $|\cos(x)| \leq 1$. (You can probably state this precisely using big $O$ notation, but I won't bother.) The solution to $y' = y^2$ is $y(x) = \frac{-1}{x+C}$, which diverges to infinity in finite time for $y>0$. That shows that finite-time blowup if $y$ is large.
To show that $y$ blows up when $y(0)$ is between $-1$ and $1$, you have to show that the graph of $y(x)$ eventually exceeds $y=1$. Then, $y^2 > |\cos(x)|$, so $y'$ will be positive, causing $y$ to increase more, increasing $y^2$ more in turn, which increases $y'$ more, and so on. This is not a rigorous proof, but I'm fairly certain you can use the  argument in the above paragraph to justify this claim precisely.
This reduction makes your task somewhat easier, but I have little clue how to show $y(x)$ eventually exceeds $y=1$ given $y(0)$ between $-1$ and $1$. Here's a possible direction for a proof.
Notice that on the $y$-axis, all slopes are negative, and as $x$ gets larger, $f'(x)$ increases and increases until it diverges. In other words, the second derivative $f''$ (assuming it exists) appears to be positive for some region to the right of the $y$-axis. Differentiating both sides with respect to $x$:
$$f'' = 2y\dfrac{dy}{dx} + \sin (x) > 0 $$
for all $x$ in some interval $[0,M)$. So we get $2y(x) \cdot y'(x) > \sin (x)$. We can solve the equation $2y(x) \cdot y'(x) = \sin (x)$ exactly, and the solution is:
$$y(x) = \sqrt{(2\cos(x) -2C)} $$
This is where I'm stuck. Maybe you can say that $y(x) > \sqrt{(2\cos(x) -2C)}$ and try going from there?
