Rabbi Joshua came to the academy one afternoon and asked the students what Rabbi Eleazar ben Azariah had taught that morning. The young man had been appointed head of the Sanhedrin at eighteen years old, the precocious teenage leader of the rabbinic movement in the late first century CE. When he taught, people listened carefully.
The students reported his lesson.
Rabbi Eleazar had taught that the entire community, without exception, must attend school and attend the service. Every one of them. The teaching was based on the command of Moses in Deuteronomy 31:12: Gather the people together, men, and women, and children, and thy stranger that is within thy gates, that they may hear, and that they may learn.
The students said Rabbi Eleazar laid out exactly who would be rewarded and for what. The men come, they said, and the men are rewarded for attending, because they gain understanding from the teaching. The women come, and the women are rewarded for attending, because they gain inspiration and piety from hearing the word.
But what about the children, they asked. The little ones are too young to understand a word of it. They squirm, they fall asleep on their mothers' laps, they throw pebbles under the benches. Why must they come?
Because, Rabbi Eleazar answered, if the children are present, then the adults who brought them earn a reward of their own, the reward for bringing the children. The infant on the bench is not there for her own sake. She is there so that her parents can be counted among those who raise a child to the sound of Torah. You do not wait for understanding before you bring a child to shul. You bring the child to shul, and the understanding comes.
This teaching from Chagigah 3a, preserved in The Exempla of the Rabbis (Gaster, 1924), is the foundational Jewish argument for dragging sleepy toddlers to synagogue. Heaven is keeping a separate ledger for the ones who carried them in.