This website houses notes from my studies at the University of Liverpool. If you see any errors or issues, please do open an issue on this site's GitHub.
Digraph Representation In the directed graph representation, $R$ is: Reflexive if there is always an arrow from every vertex to itself. Symmetric if whenever there is an arrow from $x$ to $y$ there is also an arrow from $y$ to $x$. Antisymmetric if whenever there is an arrow from $x$...
Let $(S,P)$ be a probability space. A random variable $F$ is a function $F:S\rightarrow\Bbb{R}$ that assigns to every $s\in S$ a single number $F(s)$. In all these examples $S$ is the sample space and $P$ is the probability space. Neither a variable nor random. As it is the product of...
Properties of Binary Relations A binary relation $R$ on a set $A$ is: Reflexive When $xRx$ for all $x\in A$. \[\forall x\ A(x)\Rightarrow xRx\] This means that if two of the same elements are compared successfully then the relation is reflexive. As example of a relation that is non-reflexive is...
Properties of Relations on a Set Infix Notation for Binary Relations If $R$ is a binary relation then we write $xRy$ whenever $(x,y)\in R$. The predicate $xRy$ is read as $x$ is $R$-related to $y$. This is similar to the notation $a\subseteq b$ or $a\leq b$. Comparing Strings Consider relations...
Building New Relations from Given Ones Inverse Relation Given a realtion $R\subseteq A \times B$. We define the inverse relation $R^{-1}\subset B\times A$ by: \[R^{-1}=\{(b,a)\vert (a,b) \in R\}\] Example: The inverse of the relation is a parent of on the set of people is the relation is a child of....
Digraph Representation of Relations Recall that a function $f$ from a set $A$ to a set $B$ assigns exactly one element of $B$ to each element of $A$. Gives rise to the relation $R_f=\{(a,b)\in A\times B \vert b =f(a)\}$ If a relation $S\subseteq A\times B$ is such that for every...
Enhanced ER EER is an ER model bu with hierarchal relationships. Entities that are member of one entity type (the superclass) may be grouped into meaningful subsets (the subclasses). Often referred to as an “is-A” relationship. The two subclasses of TRAINEE is the training courses company: EMPLOYEE and PROFESSIONAL. Inheritance...
More Complex Custom Types More Complex Constructors More complex constructors can contain other types. data Point = Point Int Int deriving (Show, Read, Eq) This is saying that the type Point has one constructor called Point and in that constructor there are two Int. The constructor name has no relation...
Custom Types There are two ways to make types in Haskell. The type Keyword The type keyword gives a new name to an existing type. All types must start with capital letters. type String' = [Char] exclaim :: String' -> String' exclaim str = str + "!" > exclaim "hello"...
Cartesian Product For the Cartesian product you are making a list of all possibilities of the elements in both sets. This is similar to multiplying brackets. Example Let $A=\{1,2\}$ and $B=\{a,b,c\}$, then: \[A\times B = \{(1,a),(2,a),(1,b),(2,b),(1,c),(2,c)\}\] Therefore: \[B\times A = \{(a,1),(a,2),(b,1),(b,2),(c,1),(c,2)\}\] Relations Any relation between the elements in set $A$...