Note: Logic

###Different styles

  1. predicate calculus style

    can’t express reachability properties

  2. navigation expression style
  3. relational calculus style

    no quantifiers

###Atom

A primitive entity that is

###Relation

A structure that relates atoms

###Expressing structure with relations

###Functional and injective

###question


####3.4.1 Constants

####3.4.2 Set Operators

####3.4.3 Relational Operators

3.4.3.1 Arrow product
3.4.3.2 Dot join

database join(retain the matching elements):

id3={a,b,c: univ | a=b and b=c}
p..q = p.id3.q
3.4.3.3 Box join
3.4.3.4 Transpose

symmetric closure of r is the smallest relation that contains r and is symmetric, and is equal to r+~r

3.4.3.5 Transitive closure
3.4.3.6 Domain and range restrictions

relation that maps every atom in some set s to itself:

s <: iden

3.4.3.7 Override

p ++ q = p - (domain(q) <: p) + q

Usage:


3.5 Constraints

####3.5.1 Logical operators

####3.5.2 Quantification

####3.5.3 Higher-order quantification

univ lone -> lone univ

####3.5.4 Let expressions and constraints

let x = e | A

####3.5.5 Comprehensions

###3.6 Declarations and multiplicity constraints

####3.6.1 Declarations

relation-name : expression

####3.6.2 Set multiplicities

####3.6.3 Relation multiplicities

r: A m -> n B

####3.6.4 Declaration formulas

declaration formula

####3.6.5 Nested multiplicities

###3.7 Cardinality and Integers

Operators(functions)

Comparing:

Sum:

sum x: e | ie


###Feb 3 Class

####Binary relation

####Alloy convention

####A gotcha

consider ^(~next) + ^next and ^(~next + next)

They mean total different things!

####Analogy

The concepts underneath Alloy shares a lot in common with relation calculus(in Database)

But the set in Alloy is strictly mathematical set(eg: no duplicates). Whilst the selection operation in SQL does retrieve duplicate result, for the simple reason that de-duplicate is too time-consuming.


###Notes during asgn0

###Feb 5 Class

###Feb 7 Class

###Feb 10 Class

###Feb 12 Class

###Notes during asgn 1

###Feb 14 Class

Your Comments

comments powered by Disqus