From Ineffabilis Deus, the Apostolic Constitution of Pope Pius IX on the Immaculate Conception (December 8, 1854):
"We declare, pronounce, and define that the doctrine which holds that the most Blessed Virgin Mary, in the first instance of her conception, by a singular grace and privilege granted by Almighty God, in view of the merits of Jesus Christ, the Savior of the human race, was preserved free from all stain of original sin, is a doctrine revealed by God and therefore to be believed firmly and constantly by all the faithful."
Some of the reasoning leading up to the definition:
"God ineffable -- whose ways are mercy and truth, whose will is omnipotence itself, and whose wisdom "reaches from end to end mightily, and orders all things sweetly" -- having foreseen from all eternity the lamentable wretchedness of the entire human race which would result from the sin of Adam, decreed, by a plan hidden from the centuries, to complete the first work of his goodness by a mystery yet more wondrously sublime through the Incarnation of the Word. This he decreed in order that man who, contrary to the plan of Divine Mercy had been led into sin by the cunning malice of Satan, should not perish; and in order that what had been lost in the first Adam would be gloriously restored in the Second Adam. From the very beginning, and before time began, the eternal Father chose and prepared for his only-begotten Son a Mother in whom the Son of God would become incarnate and from whom, in the blessed fullness of time, he would be born into this world. Above all creatures did God so lover her that truly in her was the Father well pleased with singular delight. Therefore, far above all the angels and all the saints so wondrously did God endow her with the abundance of all heavenly gifts poured from the treasury of his divinity that this mother, ever absolutely free of all stain of sin, all fair and perfect, would possess that fullness of holy innocence and sanctity than which, under God, one cannot even imagine anything greater, and which, outside of God, no mind can succeed in comprehending fully.
SUPREME REASON FOR THE PRIVILEGE: THE DIVINE MATERNITY
And indeed it was wholly fitting that so wonderful a mother should be ever resplendent with the glory of most sublime holiness and so completely free from all taint of original sin that she would triumph utterly over the ancient serpent. To her did the Father will to give his only-begotten Son -- the Son whom, equal to the Father and begotten by him, the Father loves from his heart -- and to give this Son in such a way that he would be the one and the same common Son of God the Father and of the Blessed Virgin Mary. It was she whom the Son himself chose to make his Mother and it was from her that the Holy Spirit willed and brought it about that he should be conceived and born from whom he himself proceeds.
The Catholic Church, directed by the Holy Spirit of God, is the pillar and base of truth and has ever held as divinely revealed and as contained in the deposit of heavenly revelation this doctrine concerning the original innocence of the august Virgin -- a doctrine which is so perfectly in harmony with her wonderful sanctity and preeminent dignity as Mother of God -- and thus has never ceased to explain, to teach and to foster this doctrine age after age in many ways and by solemn acts. From this very doctrine, flourishing and wondrously propagated in the Catholic world through the efforts and zeal of the bishops, was made very clear by the Church when she did not hesitate to present for the public devotion and veneration of the faithful the Feast of the Conception of the Blessed Virgin. By this most significant fact, the Church made it clear indeed that the conception of Mary is to be venerated as something extraordinary, wonderful, eminently holy, and different from the conception of all other human beings -- for the Church celebrates only the feast days of the saints.
And hence the very words with which the Sacred Scriptures speak of Uncreated Wisdom and set forth his eternal origin, the Church, both in its ecclesiastical offices and in its liturgy, has been wont to apply likewise to the origin of the Blessed Virgin, inasmuch as God, by one and the same decree, had established the origin of Mary and the Incarnation of Divine Wisdom.
ORDINARY TEACHING OF THE ROMAN CHURCH
These truths, so generally accepted and put into practice by the faithful, indicate how zealously the Roman Church, mother and teacher of all Churches, has continued to teach this doctrine of the Immaculate Conception of the Virgin. Yet the more important actions of the Church deserve to be mentioned in detail. For such dignity and authority belong to the Church that she alone is the center of truth and of Catholic unity. It is the Church in which alone religion has been inviolably preserved and from which all other Churches must receive the tradition of the Faith.
The same Roman Church, therefore, desired nothing more than by the most persuasive means to state, to protect, to promote and to defend the doctrine of the Immaculate Conception. This fact is most clearly shown to the whole world by numerous and significant acts of the Roman Pontiffs, our predecessors. To them, in the person of the Prince of the Apostles, were divinely entrusted by Christ our Lord, the charge and supreme care and the power of feeding the lambs and sheep; in particular, of confirming their brethren, and of ruling and governing the universal Church.
VENERATION OF THE IMMACULATE
Our predecessors, indeed, by virtue of their apostolic authority, gloried in instituting the Feast of the Conception in the Roman Church. They did so to enhance its importance and dignity by a suitable Office and Mass, whereby the prerogative of the Virgin, her exception from the hereditary taint, was most distinctly affirmed. As to the homage already instituted, they spared no effort to promote and to extend it either by the granting of indulgences, or by allowing cities, provinces and kingdoms to choose as their patroness God's own Mother, under the title of "The Immaculate Conception." Again, our predecessors approved confraternities, congregations and religious communities founded in honor of the Immaculate Conception, monasteries, hospitals, altars, or churches; they praised persons who vowed to uphold with all their ability the doctrine of the Immaculate Conception of the Mother of God. Besides, it afforded the greatest joy to our predecessors to ordain that the Feast of the Conception should be celebrated in every church with the very same honor as the Feast of the Nativity; that it should be celebrated with an octave by the whole Church; that it should be reverently and generally observed as a holy day of obligation; and that a pontifical Capella should be held in our Liberian pontifical basilica on the day dedicated to the conception of the Virgin. Finally, in their desire to impress this doctrine of the Immaculate Conception of the Mother of God upon the hearts of the faithful, and to intensify the people's piety and enthusiasm for the homage and the veneration of the Virgin conceived without the stain of original sin, they delighted to grant, with the greatest pleasure, permission to proclaim the Immaculate Conception of the Virgin in the Litany of Loreto, and in the Preface of the Mass, so that the rule of prayer might thus serve to illustrate the rule of belief. Therefore, we ourselves, following the procedure of our predecessors, have not only approved and accepted what had already been established, but bearing in mind, moreover, the decree of Sixtus IV,  have confirmed by our authority a proper Office in honor of the Immaculate Conception, and have with exceeding joy extended its use to the universal Church.
THE ROMAN DOCTRINE
Now inasmuch as whatever pertains to sacred worship is intimately connected with its object and cannot have either consistency or durability if this object is vague or uncertain, our predecessors, the Roman Pontiffs, therefore, while directing all their efforts toward an increase of the devotion to the conception, made it their aim not only to emphasize the object with the utmost zeal, but also to enunciate the exact doctrine. Definitely and clearly they taught that the feast was held in honor of the conception of the Virgin. They denounced as false and absolutely foreign to the mind of the Church the opinion of those who held and affirmed that it was not the conception of the Virgin but her sanctification that was honored by the Church. They never thought that greater leniency should be extended toward those who, attempting to disprove the doctrine of the Immaculate Conception of the Virgin, devised a distinction between the first and second instance of conception and inferred that the conception which the Church celebrates was not that of the first instance of conception but the second. In fact, they held it was their duty not only to uphold and defend with all their power the Feast of the Conception of the Blessed Virgin but also to assert that the true object of this veneration was her conception considered in its first instant. Hence the words of one of our predecessors, Alexander VII, who authoritatively and decisively declared the mind of the Church: "Concerning the most Blessed Virgin Mary, Mother of God, ancient indeed is that devotion of the faithful based on the belief that her soul, in the first instant of its creation and in the first instant of the soul's infusion into the body, was, by a special grace and privilege of God, in view of the merits of Jesus Christ, her Son and the Redeemer of the human race, preserved free from all stain of original sin. And in this sense have the faithful ever solemnized and celebrated the Feast of the Conception."
Moreover, our predecessors considered it their special solemn duty with all diligence, zeal, and effort to preserve intact the doctrine of the Immaculate Conception of the Mother of God. For, not only have they in no way ever allowed this doctrine to be censured or changed, but they have gone much further and by clear statements repeatedly asserted that the doctrine by which we profess the Immaculate Conception of the Virgin is on its own merits entirely in harmony with the ecclesiastical veneration; that it is ancient and widespread, and of the same nature as that which the Roman Church has undertaken to promote and to protect, and that it is entirely worthy to be used in the Sacred Liturgy and solemn prayers. Not content with this they most strictly prohibited any opinion contrary to this doctrine to be defended in public or private in order that the doctrine of the Immaculate Conception of the Virgin might remain inviolate. By repeated blows they wished to put an end to such an opinion. And lest these oft-repeated and clearest statements seem useless, they added a sanction to them...."