Alloy20110818

765 views
732 views

Published on

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
765
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Alloy20110818

  1. 1. N. Shimizu <chikoski@gmail.com> 2011/08/18 
AlloyN. Shimizu (chikoski@gmail.com / @chikoski)
  2. 2. N. Shimizu <chikoski@gmail.com> 2011/08/18•  #• 
  3. 3. N. Shimizu <chikoski@gmail.com> 2011/08/18•  #   #  50 #• 6 #   #   #
  4. 4. N. Shimizu <chikoski@gmail.com> 2011/08/18https://sites.google.com/site/softwareabstractionsja/
  5. 5. N. Shimizu <chikoski@gmail.com> 2011/08/18Alloy Mac OS• Java 1.5 #• Lion Java #   #  http://support.apple.com/kb/DL1421
  6. 6. N. Shimizu <chikoski@gmail.com> 2011/08/18Alloy Mac OS
  7. 7. N. Shimizu <chikoski@gmail.com> 2011/08/18Alloy Mac OS (cont.)
  8. 8. N. Shimizu <chikoski@gmail.com> 2011/08/18Alloy Mac OS (cont.)•  .app # 1.  Finder # 2.  + +a# 3.  # 4.  .app #
  9. 9. N. Shimizu <chikoski@gmail.com> 2011/08/18Alloy Mac OS (cont.)% mkdir alloy#% cd alloy#% mv ~/Downloads/alloy4.2-rc.jar alloy.jar#% java -jar alloy.jar
  10. 10. N. Shimizu <chikoski@gmail.com> 2011/08/18Alloy Mac OS (cont.)
  11. 11. N. Shimizu <chikoski@gmail.com> 2011/08/18
  12. 12. N. Shimizu <chikoski@gmail.com> 2011/08/18
  13. 13. N. Shimizu <chikoski@gmail.com> 2011/08/18
  14. 14. N. Shimizu <chikoski@gmail.com> 2011/08/181.  #2.  ‘Execute’ #3.  2 #4.  “Instance”
  15. 15. N. Shimizu <chikoski@gmail.com> 2011/08/182.1:module tour/addressBook1#sig Name, Addr {}#sig Book{# #addr: Name -> lone Addr#}#pred show{}#run show for 3 but 1 Book
  16. 16. N. Shimizu <chikoski@gmail.com> 2011/08/181.  Show #2.  ‘Theme’ “Load Sample Theem” #3.  book/chapter2/theme.thm
  17. 17. N. Shimizu <chikoski@gmail.com> 2011/08/18
  18. 18. N. Shimizu <chikoski@gmail.com> 2011/08/183module tour/addressBook1#sig Name, Addr {}#sig Book{# #addr: Name -> lone Addr#}#pred show{}#run show for 3 but 1 Book
  19. 19. N. Shimizu <chikoski@gmail.com> 2011/08/18 b -> n -> amodule tour/addressBook1#sig Name, Addr {}#sig Book{# #addr: Name -> lone Addr#}#pred show{}#run show for 3 but 1 Book
  20. 20. N. Shimizu <chikoski@gmail.com> 2011/08/18addr: b -> n -> aBook Name Addr b0 n0 a0 b0 n1 a1 b0 n2 a1 b1 n0 a2 b1 n3 a2 b1 n4 a1
  21. 21. N. Shimizu <chikoski@gmail.com> 2011/08/18module tour/addressBook1#sig Name, Addr {}#sig Book{# #addr: Name -> lone Addr#}#pred show{}#run show for 3 but 1 Book
  22. 22. N. Shimizu <chikoski@gmail.com> 2011/08/18module tour/addressBook1#sig Name, Addr {}#sig Book{# #addr: Name -> lone Addr#}#pred show{}#run show for 3 but 1 Book
  23. 23. N. Shimizu <chikoski@gmail.com> 2011/08/18 
module tour/addressBook1#sig Name, Addr {}#sig Book{# #addr: Name -> lone Addr#}#pred show{}#run show for 3 but 1 Book
  24. 24. N. Shimizu <chikoski@gmail.com> 2011/08/18for•  #•  3#• for 3 but 1 Book#   #   Book 1#
  25. 25. N. Shimizu <chikoski@gmail.com> 2011/08/18 
module tour/addressBook1#sig Name, Addr {}#sig Book{# #addr: Name -> lone Addr#}#pred show{}#run show for 3 but 1 Book
  26. 26. N. Shimizu <chikoski@gmail.com> 2011/08/18pred show(b: Book){# ##(b.addr) > 1#}
  27. 27. N. Shimizu <chikoski@gmail.com> 2011/08/18#pred show(b: Book){# ##(b.addr) > 1#}
  28. 28. N. Shimizu <chikoski@gmail.com> 2011/08/18
  29. 29. N. Shimizu <chikoski@gmail.com> 2011/08/18pred show(b: Book){# ##(b.addr) > 1# #some n:Name | #n.(b.addr) > 1#}
  30. 30. N. Shimizu <chikoski@gmail.com> 2011/08/18some x: e | F• e x F #• some n:Name | #n.(b.addr) > 1#  Name n #  #n.(b.addr) > 1 #
  31. 31. N. Shimizu <chikoski@gmail.com> 2011/08/18addr: b -> n -> aBook Name Addr b0 n0 a0 b0 n1 a1 b0 n2 a1 b1 n0 a2 b1 n3 a2 b1 n4 a1
  32. 32. N. Shimizu <chikoski@gmail.com> 2011/08/18# n.(b.addr) > 1Book Name Addr b0 n0 a0 b0 n1 a1 b0 n2 a1
  33. 33. N. Shimizu <chikoski@gmail.com> 2011/08/18
  34. 34. N. Shimizu <chikoski@gmail.com> 2011/08/18sig Book{# #addr: Name -> lone Addr#}#pred show(b: Book){# ##(b.addr) > 1# #some n:Name | #n.(b.addr) > 1#}
  35. 35. N. Shimizu <chikoski@gmail.com> 2011/08/18pred show(b: Book){# ##(b.addr) > 1# ##Name.(b.addr) > 1#}
  36. 36. N. Shimizu <chikoski@gmail.com> 2011/08/18pred show(b: Book){# ##(b.addr) > 1# ##Name.(b.addr) > 1#}
  37. 37. N. Shimizu <chikoski@gmail.com> 2011/08/18
  38. 38. N. Shimizu <chikoski@gmail.com> 2011/08/182.2
pred add (b, b : Book , n: Name, a:Addr){# #b.addr = b.addr + n -> a#}
  39. 39. N. Shimizu <chikoski@gmail.com> 2011/08/18pred showAdd(b, b: Book, n:Name, a:Addr){# #add [b, b, n, a]# ##Name.(b.addr) > 1#}
  40. 40. N. Shimizu <chikoski@gmail.com> 2011/08/18run showAdd for 3 but 2 Book
  41. 41. N. Shimizu <chikoski@gmail.com> 2011/08/18 2 Bookrun showAdd for 3 but 2 Book
  42. 42. N. Shimizu <chikoski@gmail.com> 2011/08/18
  43. 43. N. Shimizu <chikoski@gmail.com> 2011/08/18pred del(b, b: Book, n:Name){# #b.addr = b.addr - n -> Addr#}
  44. 44. N. Shimizu <chikoski@gmail.com> 2011/08/18fun lookup(b: Book, n:Name): set Addr{# #n.(b.addr)#}
  45. 45. N. Shimizu <chikoski@gmail.com> 2011/08/18assert delUndoesAdd{# #all b, b, b: Book, n:Name, a:Addr |# # #no n.(b.addr) and # # #add [b, b, n, a] and # # #del[b, b, n]# # #implies b.addr = b.addr#}#
  46. 46. N. Shimizu <chikoski@gmail.com> 2011/08/18 (Assertion)• •  #   #   Java assert# p  assert(args.length > 0)# p  assert(a != null)#
  47. 47. N. Shimizu <chikoski@gmail.com> 2011/08/18assert delUndoesAdd{# #all b, b, b: Book, n:Name, a:Addr |# # #no n.(b.addr) and # # #add [b, b, n, a] and # # #del[b’, b, n]# # #implies b.addr = b.addr#}#
  48. 48. N. Shimizu <chikoski@gmail.com> 2011/08/18check delUndoesAdd for 3
  49. 49. N. Shimizu <chikoski@gmail.com> 2011/08/18
  50. 50. N. Shimizu <chikoski@gmail.com> 2011/08/18assert delUndoesAdd{# #all b, b, b: Book, n:Name, a:Addr |# # #add [b, b, n, a] and del[b, b, n]# # #implies b.addr = b.addr#}
  51. 51. N. Shimizu <chikoski@gmail.com> 2011/08/18
  52. 52. N. Shimizu <chikoski@gmail.com> 2011/08/18all x: e | F• e x F #• all n:Name | #n.(b.addr) > 1#  Name n #  #n.(b.addr) > 1 #
  53. 53. N. Shimizu <chikoski@gmail.com> 2011/08/18書式 意味 some e e はタプルをいくつか持つ no e e はタプルを持たない lone e e はタプルを多くても1つ持つ one e e はタプルをちょうど1つ持つ
  54. 54. N. Shimizu <chikoski@gmail.com> 2011/08/18演算子 短縮形式 意味 not ! 否定 and && 連言 or || 選言 implies => 含意 iff <=> 両含意
  55. 55. N. Shimizu <chikoski@gmail.com> 2011/08/182.3:•  #• Java
  56. 56. N. Shimizu <chikoski@gmail.com> 2011/08/18module tour/addressBook2##abstract sig Target {}#sig Addr extends Target {}#abstract sig Name extends Target{}#sig Alias, Group extends Name {}#sig Book { addr: Name -> Target}
  57. 57. N. Shimizu <chikoski@gmail.com> 2011/08/18
  58. 58. N. Shimizu <chikoski@gmail.com> 2011/08/18•  ‘Execute’ “Show MetaModel”#•  M
  59. 59. N. Shimizu <chikoski@gmail.com> 2011/08/18fact{# #all b:Book | # # #no n:Name | n in n.^(b.addr)#}
  60. 60. N. Shimizu <chikoski@gmail.com> 2011/08/18 
sib Book{addr: Name -> Target} {# #no n:Name | n in n.^addr#}
  61. 61. N. Shimizu <chikoski@gmail.com> 2011/08/18in :• p in q p q #• n in n.^(b.addr) #  n n^(b.addr) #  n n addr #
  62. 62. N. Shimizu <chikoski@gmail.com> 2011/08/18^:•  r #• ^r = r + r.r + r.r.r + r.r.r.r + …
  63. 63. N. Shimizu <chikoski@gmail.com> 2011/08/18Alaispred show(b: Book) { some Alias.(b.addr)}
  64. 64. N. Shimizu <chikoski@gmail.com> 2011/08/18
  65. 65. N. Shimizu <chikoski@gmail.com> 2011/08/18 Addr Groupsig Book { addr: Name -> Target}{# #all a: Alias | lone a.addr#}
  66. 66. N. Shimizu <chikoski@gmail.com> 2011/08/18
  67. 67. N. Shimizu <chikoski@gmail.com> 2011/08/18•  #•  #•  #

×