Yes. Lennon wrote both lyrics and music for "Imagine." He occasionally collaborated on arrangements (e.g., Phil Spector's production, Nicky Hopkins' piano), but the melody, harmony, and structure are his own composition.