Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

User Interaction Sketches

Raphael Sonabend edited this page Jul 18, 2019 · 3 revisions

Use Case: Constructing Intervals


Brief: Constructing an interval (not necessarily on the Reals) which may or may not be countable.

Basic flow:

  1. Construct a given interval with lower and upper limits, bounds and a logical indicating if countable

Pseudo-code:

Interval$new(1, 10, "()", countable = TRUE) # == 1,2,3,4,5,6,7,8,9,10
Interval$new(-Inf, Inf, "()", countable = FALSE) # Default

Use Case: Constructing Sets


Brief: Constructing a set, of ANY type

Basic flow:

  1. Construct a set with given elements

Pseudo-code:

Set$new(1,2,3,4) # Set of numerics
Set$new("A","B","C") # Set of characters
Set$new(Set$new(1), 2, "A") # Set of sets and other types

Use Case: Constructing Tuples


Brief: Constructing a tuple, inheriting from Set, of ANY type

Basic flow:

  1. Construct a tuple with given ordered elements

Pseudo-code:

Tuple$new(1,2,3,4) # Set of numerics
Tuple$new("A","B","C") # Set of characters
Tuple$new(Set$new(1), 2, "A") # Set of sets and other types
Tuple$new(1,2,3,4) != Tuple$new(3,1,2,4) # Set$new(1,2,3,4) == Set$new(3,1,2,4)

Use Case: Constructing Special Sets


Brief: Constructing one of the implemented special sets

Basic flow:

  1. Construct an implemented special set

Pseudo-code:

Reals$new()
Empty$new()
PosIntegers$new()

Use Case: Algebra of SetIntervals


Brief: Perform manipulation of sets with basic operations including intersection, union, complement

Basic flow:

  1. Construct two or more SetIntervals (of same type)
  2. Use S3 dispatch to construct new SetIntervals dependent on operation

Pseudo-code:

x <- Set$new(1,2,3,4,5)
y <- Set$new(4,5,6,7,8)
union(x, y) == x + y # Set$new(1,2,3,4,5,6,7,8) # Maybe x | y
complement(x, y) == x - y # Set$new(1,2,3)
complement(x) # Exists only if a universe in x is defined
product(x, y) == x * y # Set$new(Set$new(1,4),Set$new(1,5),...,Set$new(5,8))
intersection(x, y) == x & y # Set$new(4, 5)
power(x, 2) == x^2 # Set$new(1,2,3,4,5, dim = 2)
union(x, Empty$new()) == x
intersection(x, x$universe()) == x
union(x, complement(x)) == x$universe()
intersection(x, complement(x)) == Empty$new()
x$powerSet()

Use Case: Querying Properties and Traits


Brief: After constructing a SetInterval, query for properties and traits

Basic flow:

  1. Construct a set, tuple or interval
  2. Query for properties or traits

Pseudo-code:

Reals$new()$properties()
Reals$new()$traits()
Reals$new()$countable() # Trait
Reals$new()$bounds() # Trait
Reals$new()$cardinality() # Trait
Reals$new()$universe() # Trait
Set$new(1,2)$countable() # Trait
Set$new(1,2)$cardinality() # Property
Interval$new(1,2)$bounds() # Property
Interval$new(1,2, universe = Reals)$universe() # Property

Use Case: Querying Bounds


Brief: After constructing a SetInterval, query for min, max, sup, inf

Basic flow:

  1. Construct a set, tuple or interval
  2. Query for bounds

Pseudo-code:

Reals$new()$min()
Reals$new()$max()
Reals$new()$inf()
Reals$new()$sup()
Set$new(1,2,3)$min() == 1
Set$new("1",2,3)$min() == Error
Interval$new(1,5,type="[]")$min() == 1
Interval$new(1,5,type="[]")$inf() == 1
Interval$new(1,5,type="(]")$min() == 1 + 1.1e-15
Interval$new(1,5,type="(]")$inf() == 1
Clone this wiki locally