"Every firstborn that opens the womb is Mine" (Exodus 34:19). One might think this includes even a female. Therefore the verse teaches, "all your cattle that is male" (Exodus 34:19) — just as the firstborn of an animal is a male and not a female, so too the firstborn of a human is a male and not a female. "All your cattle" — one might think even a camel or a horse. Therefore the verse teaches, "the firstling of an ox or a sheep" (Exodus 34:19). This is a general statement and then a specification, and a general statement followed by a specification includes only what is in the specification. Another interpretation: Rabbi Yehoshua ben Korchah says, "Every firstborn that opens the womb is Mine" — this is a general statement. One might think even those belonging to others; therefore the verse teaches, "your cattle." One might think even that of a female; therefore the verse teaches, "male." One might think even that of a wild animal; therefore the verse teaches, "the firstling of an ox or a sheep." This is a general statement that requires the specification.
Every Firstborn That Opens the Womb Belongs to the LORD
Mekhilta DeRabbi Shimon Ben Yochai 34:8
כל פטר רחם לי יכול אף נקבה ת"ל וכל מקנך תזכר מה בכור בהמה זכר ולא נקבה אף בכור אדם זכר ולא נקבה: וכל מקנך. יכול אפילו גמל וסוס ת״ל פטר שור ושה הרי זה כלל ופרט אין בכלל אלא מה שבפרט: ד"א ר' יהושע בן קרחה אומר כל פטר רחם לי הרי זה כלל יכול אף של אחרים ת"ל מקנך יכול אף של נקבה ת"ל תזכר יכול אף של חיה ת"ל פטר שור ושה זה הוא כלל שצריך לפרט: