Beta

Is there an arrow missing ? (Relations - Part1: Reflexivity)

Description:

##Relations Relations form a foundational topic in Logic, Math and Philosopy.

Here are a few references to understand the importance of relations:

Objects, properties and relations

Math

There are many different categories of relations. In this kata we will focus on reflexivity.

##Reflexivity Reflexivity as explained on Stanford:

A relation R is reflexive iff, everything bears R to itself. For example, "being the same height as" is a reflexive relation: everything is the same height as itself. Stanford

###The Model In this exercise we will look at a Model consisting of points and arrows. The points will be given in an array S. For example S = [1,2,3] and the arrows will be given as a relation R = [ [1,1], [1,2], [1,3] ] . What this means is that there are arrows pointing from 1 to itself, from 1 to 2 and from 1 to 3.

In the tests every arrow in R will always be unique.

###Task What we want to know is whether the Relation is reflexive. R is a reflexive relation if every point in S has an arrow pointing from itself to itself

###Examples Suppose you have S and R as in the first example below then this means that you have 3 points where every point has an arrow pointing from itself to itself.

In the second example the red arrow is missing from the relation R, i.e. [1,1] is not in R. Therefore the relation is not reflexive.

Example 1: Suppose S = [1,2,3]. Let R be [[1,1],[2,2],[3,3]]

Result: R is reflexive, return true in the kata.

Example 2: Suppose S = [1,2]. Let R be [[1,2],[2,2]]

Result: R is NOT reflexive, as you can tell point 1 has no arrow pointing from itself to itself, i.e. [1,1] is missing in the relation R. Return false in the kata.

Logic
Set Theory
Puzzles

Stats:

CreatedNov 30, 2016
PublishedNov 30, 2016
Warriors Trained104
Total Skips26
Total Code Submissions71
Total Times Completed32
PHP Completions10
JavaScript Completions24
Total Stars2
% of votes with a positive feedback rating87% of 15
Total "Very Satisfied" Votes12
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes1
Total Rank Assessments13
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • jonneroelofs2 Avatar
  • cliffstamp Avatar
Ad