Wi-fi doesn't work on my iPhone 4
Absolutely. I personally still own an iPhone 4 and am using it to access the internet without the SIM card installed. The notification bar shows No Sim, which but this does not impact the device's WiFi.

The Common Fix: Resetting Network Settings
I would like you to try: Settings > General > Reset > Reset Network Settings

Which should clear up any issues by resettings the Network gear to their default settings. It has shown to be a common solution in the past. You will need to reconnect to your WiFi access point once the iPhone has restarted. Please report back with the status afterward.