The Alids are the dynasties descended from Ali ibn Abi Talib, son-in-law of the Islamic prophet Muhammad (see Family tree of Muhammad and Family tree of Husayn ibn Ali). Shia Muslims consider him the First Imam appointed by Muhammad and the first rightful caliph.
Primarily Sunnis in the Arab world reserve the term sharif or "sherif" for descendants of Hasan ibn Ali, while sayyid is used for descendants of Husayn ibn Ali. Both Hasan and Husayn are grandchildren of Prophet Muhammad, through the marriage of his cousin Ali and his daughter Fatima. However ever since the post-Hashemite era began, the term sayyid has been used to denote descendants from both Hasan and Husayn. Arab Shiites use the terms sayyid and habib to denote descendants from both Hasan and Husayn; see also ashraf.
To try to resolve the confusion surrounding the descendants of Muhammad, the Ottoman Caliphs during the 19th Century C.E. attempted to replicate the Almanach de Gotha (the tome listing the Noble houses of Europe) to show known and verifiable lines of descent. Although not 100% complete in its scope (some lines might have been excluded due to lack of proof, although no false lines are included) the resulting "Kitab al-Ashraf" (Book of the Sharifs), kept at the Topkapi Palace Museum in Istanbul is one of the best sources of evidence of descent from Muhammad.