That will definitely work but my understanding is that you don't have to necessarily withdraw $4,000 less than the total qualified expenses. You can withdraw an amount equal to the total qualified expenses so long as you are willing to treat $4,000 of them as non qualified withdrawal (so that $4,000 can be used for AOTC eligibility) and pay taxes on the earnings portion of that $4,000 as dcandmc also mentioned earlier. So in this case, aelaino1 will have to pay taxes on $1,000 (prorated earnings portion of $4,000) of ordinary income and claim the full benefit of AOTC.
If the student is the one claiming AOTC then, a portion of it may go unused unless the student has other income (earned income, investment income etc.) so AOTC can offset some or all of the taxes on that income.