"Peter is sleeping for four hours."
Translation:पीटर चार घंटे से सो रहा है।
The English translation is not clear here. It is in the present continuous, which means it could still be happening in the future (i.e. Peter has slept two hours and will be sleeping for a total of four hours). But the Hindi sentence wants us to say that he has already been sleeping for four hours. A better English translation would be "Peter has been sleeping for four hours" . This would convey the correct meaning. Which is the purpose of language.
If am right the sentence means "Peter has been sleeping for four hours" ("Peter schläft seit vier Stunden").
What function does the postposition से play in this sentence? Ablative or Instrumental case? And why से comes after घंटे and why not the postposition के लिए as in पीटर चार घंटे के लिए सो रहा है ?
You're right, the translation is a little wonky here, a better translation would be "Peter has been sleeping since four hours ago" but in Hindi the term "Has been" doesn't exist, it's replaced instead with the present continuous form, so मैं दो साल से हिंदी सीख रहा हूँ = I have been learning Hindi for two years, or I have been learning Hindi since two years ago (The second form is how it's said in Hindi, hence से (Since))
The 'has been' form (present perfect continuous) does exist in Hindi. It would be 'पीटर चार घंटे से सोता रहा है। ' But it seems like overkill here because Hindi is much laxer compared to English when it comes to substituting the present continuous form in its place when there is no ambiguity. It is only used in sentences like मैं अब पढ़ रहा हूँ और सुबह से पढ़ता रहा हूँ। (I am studying now and have been studying since the morning)