s2_language

# s2_language - Alloy Analyzer 4 Tutorial Session 2 Language...

This preview shows pages 1–8. Sign up to view the full content.

Alloy Analyzer 4 Tutorial Session 2: Language and Analysis Greg Dennis and Rob Seater Software Design Group, MIT

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
alloy language & analysis language = syntax for structuring specifications in logic shorthands, puns, sugar analysis = tool for finding solutions to logical formulas searches for and visualizes counterexamples
“I'm My Own Grandpa” Song popular radio skit originally written in the 1930's expanded into hit song by “Lonzo and Oscar” in 1948

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
module  grandpa abstract sig  Person {   father:  lone  Man,   mother:  lone  Woman } sig  Man  extends  Person {   wife:  lone  Woman } sig  Woman  extends  Person {   husband:  lone  Man } fact  {   no  p: Person |     p  in p.^(mother + father)   wife = ~husband } assert  noSelfFather {  no  m: Man | m = m.father } check  noSelfFather fun  grandpas[p: Person] :  set  Person {  p.(mother + father).father } pred  ownGrandpa[p: Person] {  p  in  grandpas[p] } run  ownGrandpa  for  4 Person “I'm My Own Grandpa” in Alloy
language: module header module  grandpa first non-comment of an Alloy model

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
language: signatures sig  A {} set of atoms A sig  A {} sig  B {} disjoint sets A and B (no A & B) sig  A, B {} same as above sig  B  extends  A {} set B is a subset of A (B in A) sig  B  extends  A {} sig  C  extends  A {} B and C are disjoint subsets of A (B in A && C in A && no B & C) sig  B, C  extends  A {} same as above abstract sig  A {} sig  B  extends  A {} sig  C  extends  A {} A partitioned by disjoint subsets B and C (no B & C && A = (B + C)) sig  B  in  A {} B is a subset of A – not necessarily disjoint from any other set sig  C  in  A + B {} C is a subset of the union of A and B one sig  A {} lone sig  B {} some sig  C {} A is a singleton set B is a singleton or empty C is a non-empty set
grandpa: signatures all men and women are persons no person is both a man and a woman all persons are either men or women abstract sig  Person {   . . .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern