There aren't special rules of grammar preventing you from writing clumsy sentences that arbitrarily switch between verb forms. It's purely a matter of style.
As implied there, it's bad style in example #1 to have a "contrast-based" sentence construction with an infinitive (to know) on one side, and a gerund (knowing) on the other. They don't "balance".
OP's example #2 is okay because it has infinitives on both sides (with the implicit to component elided the second time). Some people might be critical of that elision, precisely because it detracts from the "mirrored halves" construction. I'd take that line myself in the written format, but in speech I think it helps the prosody/flow - the speaker's in a hurry, because there's still a bunch more words before he gets to the all-important contrast of can with previously-specified cannot.
OP's example #3 just goes further with the elision (#4 could just delete the final do). Again, it's a stylistic choice of no real significance. Idiomatically I'm sure most people would use can't rather than cannot (it's not "informal" here), but context and personal preference come in many varieties.