Give Context-free Grammar for the language $\{a^i b^j c^k d^h \mid i,j,h \ge 0, k>0, i+j \le h\}$
This is a training exercise, for which we don't get any answers, in a course I'm taking. I have found similar examples, but nothing that touches on the i+j≤h
part of this. My biggest trouble is that it is ordered, so I have no idea how to add d's to the end when I add a's or b's to the front. I haven't gotten very far because of this, but my thinking looks like this at the moment:
S→ABcCD
A→aA | ϵ
B→bB | ϵ
C→cC | ϵ
D→dD | ϵ
I can't put things like A→aAd
or A→aBCD
because that would result in c's and d's before b's in the end word/string. My conclusion is that I am probably on the wrong track, but all examples I find use some sort of partitioning like this.
So could anyone point me in the right direction?