Hamilton-Jacobi-Bellman Equation: Reinforcement Learning and Diffusion Models