1. Program modules can import other modules. [You have seen this al-ready in the Haskell course.] They can also depend indirectly on mod-ules via some chain of importation, so that for instanceMdepends onMifMimportsMandMimportsM. The relation ‘depends’ isthe transitive closure of the relation ‘imports’.2. Two people are related if one is the parent of the other, if they are mar-ried, or if there is a chain of such relationships joining them directly.We can model this by a universal setPeople, with three relationsMar-ried,ParentandRelative.The relationRelativeis defined using thetransitive closure:Relative= ((Parent∪Parent-1)∪Married)+DEFINITION3.16 (TRANSITIVECLOSURE)LetRbe a binary relation onA. Thetransitive closureofR, writtent(R)orR+, isn≥1Rn: that is,R∪R2∪R3∪R4∪. . .The transitive closure of a binary relation always exists. To cast more lightonR+, we now examine an alternative way of building the transitive clo-sure. LetR
This is the end of the preview.
access the rest of the document.
Transitive relation, Haskell, Transitive closure, E C L O S U R