This is a purely hypothetical question as a true pope cannot become a formal heretic (see this post). Nevertheless, let us read the words of Archbishop John Baptist Purcell who recounted what happened during his attendance at the First Vatican Council:
“The question was also raised by a Cardinal, ‘What is to be done with the Pope if he becomes a heretic?’ It was answered that there has never been such a case; the Council of Bishops could depose him for heresy, for from the moment he becomes a heretic he is not the head or even a member of the Church. The Church would not be, for a moment, obliged to listen to him when he begins to teach a doctrine the Church knows to be a false doctrine, and he would cease to be Pope, being deposed by God Himself.
“If the Pope, for instance, were to say that the belief in God is false, you would not be obliged to believe him, or if he were to deny the rest of the creed, ‘I believe in Christ,’ etc. The supposition is injurious to the Holy Father in the very idea, but serves to show you the fullness with which the subject has been considered and the ample thought given to every possibility. If he denies any dogma of the Church held by every true believer, he is no more Pope than either you or I; and so in this respect the dogma of infallibility amounts to nothing as an article of temporal government or cover for heresy.”1
So you see that if it were possible for a pope to become a heretic, he would cease to be a member of the Church from the very moment that he fell into (public) heresy. Consequently, he could be deposed by a council of bishops since he would no longer be pope at the time of the deposition. What Archbishop Purcell heard is in agreement with the Magisterium of Pope Pius XII who taught in Mystici Corporis that the (pubic) sin of heresy per se separates the heretic from the Church.2 Being separated from the Church, the heretic is no longer a member. Being no longer a member he could not be the head. To claim otherwise is to admit that the papal office can exist separated from the Church because the heretic being separated from the Church would nonetheless be pope. Hence, the claim is absurd. What Archbishop Purcell heard is also Opinion No. 5 (see this post) of the Five Opinions expounded upon by St. Robert Bellarmine.