Yes -- you can design a "fair" TPK, using the definition you provided
Using the definition you provided, it's absolutely possible to have a fair TPK battle. You could create a situation in which "success" is something other than survival -- for example, perhaps the players avert a catastrophe at the cost of their lives. You've defined "fair" as a situation in which the player can achieve different outcomes depending on their actions, and this would meet that definition.
But "fair" is missing the point
Normally, when we use the word "fair", we're referring to some sort of competition, in which each side tries to defeat the other side. Then, if one side does something that's forbidden by the rules, we say that that side is "not playing fair".
It's weird to use this term in the context of a D&D game. A D&D game should not be a battle which pits the DM against the players. A D&D game should be a kind of shared storytelling, in which the DM tells a story which the players will enjoy participating in. In a game like this, you're not competing against anyone, so there's nobody to be "unfair" to.
A different way to say this: as the DM, you have basically unlimited power. You can create any monster you want and make the characters fight it. The only balancing factor on this power is that you're expected to give the characters challenges they can win -- but that's exactly what, in this question, you're proposing not to do.
To put it more simply: your players aren't expecting you to be "fair". Your players are expecting you to be fun.
Sometimes, on this site, we get questions from people who are about to do something they know their players will hate. And the question goes: "hey, I'm about to do this awful thing -- but at least it's fair, right?" (example)
Your question has gone through a lot of edits; I assume that some of the edits are your own doing because you want a specific type of answer, and other edits are requested by moderators and don't necessarily reflect your intent.
One way that someone could interpret your question is that you just really want to kill off all your characters, and you know it's not going to be fun for them, but you want us to tell you that at least it will be "fair". So you've provided a definition of "fair" which will get you a clear "yes this would be fair" answer, and you've added disclaimers like "please only use this definition of fair" and "please don't talk about whether this would be fun" and "as long as you can make something fair, it's a lot easier to accept as being fun."
I'd like to ask you, for the sake of your players, to please not be that guy.
One last thing. All of the above has assumed that your players don't want their characters to die horribly at the end of the adventure. This is a pretty safe assumption -- most players are attached to their characters and want good things to happen to them. But there are sometimes exceptions. If you wanted, you could have a conversation with your players and say: "hey, I think a good resolution to this adventure would be if your characters all died horribly in an unwinnable battle -- what do you think?"
It might happen that your players say: "Heck yeah, that's so metal, we're all in!"
If this happens, then you could plan a TPK, and we'd be comfortable with you calling it "fair". You'd want to think about interesting ways for them all to die. (Or you could just ask them each to describe how their character dies? That's probably safer, in that you'd be less likely to accidentally narrate something they'd hate.)
I don't think most groups would go for this in practice, though.