If someone is fasting “for” the dead, they obviously think that the dead can be helped in some fashion by that act. Thus, it is the same act in essence as praying for them: some action that we do by which they are aided, in God’s grace.
1 Samuel 31:11-13 But when the inhabitants of Ja’besh-gil’ead heard what the Philistines had done to Saul,  all the valiant men arose, and went all night, and took the body of Saul and the bodies of his sons from the wall of Beth-shan; and they came to Jabesh and burnt them there.  And they took their bones and buried them under the tamarisk tree in Jabesh, and fasted seven days. (cf. 1 Chr 10:11-12)
2 Samuel 1:11-12 Then David took hold of his clothes, and rent them; and so did all the men who were with him;  and they mourned and wept and fasted until evening for Saul and for Jonathan his son and for the people of the LORD and for the house of Israel, because they had fallen by the sword.
This actually reinforces my present argument, based on the word “for,” since David’s servants say to him, “You fasted and wept for the child while it was alive” (2 Sam 12:21). The object was to aid the child: to save his life. Somehow, David hoped, his fasting would spare his son.
When we get to 2 Samuel 1:12, the text states four times: “fasted . . . for Saul and for Jonathan . . . for the people of the LORD . . . for the house of Israel”: all of which was directed towards those who “had fallen by the sword.” Therefore, by simple grammar and the meaning of words (the same as in the phrase, “prayed for”), it means that they thought that the dead could be aided by such fasting: the same as praying for them: one person does an act by which another can be helped.
In Esther, we also find the notion that fasting for someone else can help them (much like intercessory prayer):
Esther 4:16 “Go, gather all the Jews to be found in Susa, and hold a fast on my behalf, and neither eat nor drink for three days, night or day. I and my maids will also fast as you do. Then I will go to the king, though it is against the law; and if I perish, I perish.”
* * * * *