(Genesis 38:26) Rabbi Elazar said: In three places the holy spirit appeared. In the court of Shem, as it is written, "And he said, She is more righteous than I" (Genesis 38:26). How did he know [the child was his]? Perhaps just as he had said that he had relations with her, she had relations with others too! A heavenly voice went forth and said, "From Me [mimeni] these hidden matters came forth." In the court of Samuel, "And he said, Here I am; testify against me... And he said, He is witness" (1 Samuel 12:3,5). [And in the court of Solomon,] "And the king answered and said, Give her the living child... she is its mother" (1 Kings 3:27). How did he know? Perhaps she was being cunning! A heavenly voice went forth and said, "She is its mother." Rava said: From what [do you prove a heavenly voice]? Perhaps Judah counted the days and the months, and it happened that it fit [the time he was with her], so we establish the claim; and one who does not fit we do not establish. And Samuel too all Israel are called "one," as it is written, "Israel is saved by the LORD" (Isaiah 45:17). As for Solomon's court, it was reasoning: this one shows mercy and that one does not but rather it is a tradition they had learned.
Three Times the Holy Spirit Appeared in Judgment
Yalkut Shimoni on Torah 145:11
(בראשית לח כו) אָמַר רַבִּי אֶלְעָזָר, בִּשְׁלֹשָׁה מְקוֹמוֹת הוֹפִיעַ רוּחַ הַקֹּדֶשׁ. בְּבֵית דִּינוֹ שֶׁל שֵׁם, דִּכְתִיב וַיֹּאמֶר צָדְקָה מִמֶּנִּי, מִנָּא יָדַע דִּלְמָא כִּי הֵיכֵי דְּאָמַר דְּאִזְקִיקָא לֵיהּ לְדִידֵיהּ אִזְקִיקָא נַמִּי לְאַחֲרִינֵי. יָצְאָה בַּת קוֹל וְאָמְרָה, מִמֶּנִּי יָצְאוּ כִּבּוּשִׁים בְּבֵית דִּין שֶׁל שְׁמוּאֵל (שמואל א יב, ג ה), "וַיֹּאמֶר הִנְנִי עֲנוּ בִי וְגוֹ' וַיֹּאמֶר עֵד" וְגוֹ', [בְּבֵית דִּין שֶׁל שְׁלֹמֹה] "וַיַּעַן הַמֶּלֶךְ וַיֹּאמֶר תְּנוּ לָהּ אֶת הַיָּלוּד הַחַי וְגוֹ' הִיא אִמּוֹ", מִנָּא יָדַע, דִּלְמָא עֵרוּמֵי מְעָרְמָא, יָצְאָה בַּת קוֹל וְאָמְרָה "הִיא אִמּוֹ". אָמַר רָבָא, מִמַּאי, דִּלְמָא יְהוּדָה דְּמָנָה יוֹמֵי וְיַרְחֵי וְאִיתְרַמִי לֵיהּ דְחָזְיָא מְחַזְּקִינַן וּדְלָא חָזְיָא לָא מְחַזְּקִינַן וּשְׁמוּאֵל נַמִּי כֻּלְהוּ יִשְׂרָאֵל יָחִיד מִקְרוּ, דִּכְתִיב "יִשְׂרָאֵל נוֹשַׁע בַּה'". בֵּית דִּינוֹ שֶׁל שְׁלֹמֹה סְבָרָא הוּא, הָא מְרַחֲמָא וְהָא לָא מְרַחֲמָא אֶלָּא גְּמָרָא גְמִירֵי לָהּ.