Long comment
One of the most "reasonable" reading of Cogito is that it is not an inference but an intuition.
Having said that, your formalization is not very clear to me...
Are the first four lines the premises of the argument? If so, where do you use 2nd premise?
Does doubt(x,x) means that x doubt about itself? The first x is a "subject" formulating a thought, the second one is an "object of thought".
How this relates to 4th premise: "if doubt(x,x), then not doubtful(x)"?
If my reading is correct, it sounds wrong.
In conclusion, IMO 3rd and 4th ones seem wrong.
But the real issue is with 2nd premise:
"if doubtful(x), then there is some y such that doubt(y,x)".
But this IS the Cogito!
And thus the Cogito is the premise of the argument; in conclusion, the argument is circular.
Way out: the "argument" is not an argument at all but the "elucidation" of an ungrounded intuition: my "experience" of doubt is the evidence that there is a subject formulating that thought, and this subject is "myself".