“ Are the meanings of the following sentences the same?
No.
You can't have your cake and eat it.
You can't have your cake and you can't eat it.
You can't have your cake and eat it(,) too.
You can't have your cake and you can't eat it(,) too.
The first and third mean that you can't do both.
The second and fourth mean that you can't do either.
In the following description, I put the meanings inside the quatation marks.
I think the first and the second sentences have the same two meanings, meaning 1 and meaning2.
Meaning 1. "You can't have your cake. You can't eat it." You can't have your cake. has nothing to do with You can't eat it. So the firt and the second sentences are just stating two dirrerent things. One thing is You can't have your cake. and the other is You can't eat it.
How about this variation?
George Bush can't walk and chew gum at the same time.
I'm sure you would agree that I may not rephrase this as
George Bush can't walk, and, at the same time, George Bush can't chew gum.
How about,
George Bush can't walk and chew gum. (Native speakers will assume this to mean "at the same time.")
Similarly, your first and third examples would be taken by native speakers to mean "within the same scenario."
In both cases, the operative word is "and." You would like us to ignore the "and." Sorry, no deal.
Perhaps the reason you're having trouble with this is that you're a mathmetician. We get into this mess about whether "not' is distributive, or some such bull. (not A and B means not A and not B) Sorry, it doesn't. (actually, not A and B means not both) You can have one or the other but not both. You can't solve this problem with math. The rules are different.
Meaning 2. "You can't have your cake and eat it(,) too. " "You can either have your cake or eat it." You can't have your cake. is closely connected to You can't eat it. So the firt and the second sentences are stating only one thing.
The business about having and eating being closely connected or not closely connected is going right over the top of my head. I have no idea what you mean. Sorry. You come out with the exact opposite conclusion from what a native speaker would reach. The key is the clause, not closeness. In your second version, you have two independent clauses, each of which is a negative statement. One does not effect the other. Your sentence says (not A and not B.) This is the meaning you attribute to your first version. You have everything ass-backwards, as my mother used to say.
I think the third and the fourth sentences have the same one meaning and it's the same as meaning 2 above. No, no, no, and no. One and three are the same. Two and four are the same. ”