biblicit 1.0 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (406) hide show
  1. data/.gitmodules +3 -0
  2. data/Gemfile +1 -1
  3. data/README.md +125 -30
  4. data/Rakefile +22 -0
  5. data/biblicit.gemspec +9 -7
  6. data/lib/biblicit/cb2bib.rb +10 -11
  7. data/lib/biblicit/citeseer.rb +14 -26
  8. data/lib/biblicit/extractor.rb +40 -19
  9. data/lib/biblicit/parscit.rb +38 -0
  10. data/parscit/.gitignore +8 -0
  11. data/parscit/CHANGELOG +125 -0
  12. data/parscit/COPYING +674 -0
  13. data/parscit/COPYING.LESSER +165 -0
  14. data/parscit/INSTALL +105 -0
  15. data/parscit/README +97 -0
  16. data/{perl/ParsCit/README.TXT → parscit/USAGE} +25 -15
  17. data/parscit/bin/archtest.pl +31 -0
  18. data/parscit/bin/citeExtract.pl +562 -0
  19. data/parscit/bin/conlleval.pl +315 -0
  20. data/parscit/bin/headExtract.pl +40 -0
  21. data/parscit/bin/parsHed/convert2TokenLevel.pl +138 -0
  22. data/parscit/bin/parsHed/keywordGen.pl +308 -0
  23. data/parscit/bin/parsHed/parseXmlHeader.pl +141 -0
  24. data/parscit/bin/parsHed/redo.parsHed.pl +198 -0
  25. data/parscit/bin/parsHed/tr2crfpp_parsHed.pl +521 -0
  26. data/parscit/bin/parseRefStrings.pl +102 -0
  27. data/parscit/bin/phOutput2xml.pl +223 -0
  28. data/parscit/bin/redo.parsCit.pl +105 -0
  29. data/parscit/bin/sectExtract.pl +149 -0
  30. data/parscit/bin/sectLabel/README +110 -0
  31. data/parscit/bin/sectLabel/README.txt +110 -0
  32. data/parscit/bin/sectLabel/genericSect/crossValidation.rb +98 -0
  33. data/parscit/bin/sectLabel/genericSect/extractFeature.rb +104 -0
  34. data/parscit/bin/sectLabel/genericSectExtract.rb +53 -0
  35. data/parscit/bin/sectLabel/getStructureInfo.pl +156 -0
  36. data/parscit/bin/sectLabel/processOmniXML.pl +1427 -0
  37. data/parscit/bin/sectLabel/processOmniXML_new.pl +1025 -0
  38. data/parscit/bin/sectLabel/processOmniXMLv2.pl +1529 -0
  39. data/parscit/bin/sectLabel/processOmniXMLv3.pl +964 -0
  40. data/parscit/bin/sectLabel/redo.sectLabel.pl +219 -0
  41. data/parscit/bin/sectLabel/simplifyOmniXML.pl +382 -0
  42. data/parscit/bin/sectLabel/single2multi.pl +190 -0
  43. data/parscit/bin/sectLabel/tr2crfpp.pl +158 -0
  44. data/parscit/bin/tr2crfpp.pl +260 -0
  45. data/parscit/bin/xml2train.pl +193 -0
  46. data/parscit/lib/CSXUtil/SafeText.pm +130 -0
  47. data/parscit/lib/Omni/Config.pm +93 -0
  48. data/parscit/lib/Omni/Omnicell.pm +263 -0
  49. data/parscit/lib/Omni/Omnicol.pm +292 -0
  50. data/parscit/lib/Omni/Omnidd.pm +328 -0
  51. data/parscit/lib/Omni/Omnidoc.pm +153 -0
  52. data/parscit/lib/Omni/Omniframe.pm +223 -0
  53. data/parscit/lib/Omni/Omniline.pm +423 -0
  54. data/parscit/lib/Omni/Omnipage.pm +282 -0
  55. data/parscit/lib/Omni/Omnipara.pm +232 -0
  56. data/parscit/lib/Omni/Omnirun.pm +303 -0
  57. data/parscit/lib/Omni/Omnitable.pm +336 -0
  58. data/parscit/lib/Omni/Omniword.pm +162 -0
  59. data/parscit/lib/Omni/Traversal.pm +313 -0
  60. data/parscit/lib/ParsCit/.PostProcess.pm.swp +0 -0
  61. data/parscit/lib/ParsCit/Citation.pm +737 -0
  62. data/parscit/lib/ParsCit/CitationContext.pm +220 -0
  63. data/parscit/lib/ParsCit/Config.pm +35 -0
  64. data/parscit/lib/ParsCit/Controller.pm +653 -0
  65. data/parscit/lib/ParsCit/PostProcess.pm +505 -0
  66. data/parscit/lib/ParsCit/PreProcess.pm +1041 -0
  67. data/parscit/lib/ParsCit/Tr2crfpp.pm +1195 -0
  68. data/parscit/lib/ParsHed/Config.pm +49 -0
  69. data/parscit/lib/ParsHed/Controller.pm +143 -0
  70. data/parscit/lib/ParsHed/PostProcess.pm +322 -0
  71. data/parscit/lib/ParsHed/Tr2crfpp.pm +448 -0
  72. data/{perl/ParsCit/lib/ParsCit/Tr2crfpp.pm → parscit/lib/ParsHed/Tr2crfpp_token.pm} +22 -21
  73. data/parscit/lib/SectLabel/AAMatching.pm +1949 -0
  74. data/parscit/lib/SectLabel/Config.pm +88 -0
  75. data/parscit/lib/SectLabel/Controller.pm +332 -0
  76. data/parscit/lib/SectLabel/PostProcess.pm +425 -0
  77. data/parscit/lib/SectLabel/PreProcess.pm +116 -0
  78. data/parscit/lib/SectLabel/Tr2crfpp.pm +1246 -0
  79. data/parscit/resources/parsCit.model +0 -0
  80. data/parscit/resources/parsCit.split.model +0 -0
  81. data/{perl/ParsCit → parscit}/resources/parsCitDict.txt +205 -0
  82. data/parscit/resources/parsHed/bigram +10 -0
  83. data/parscit/resources/parsHed/keywords +10 -0
  84. data/parscit/resources/parsHed/parsHed.model +0 -0
  85. data/parscit/resources/parsHed/parsHed.template +178 -0
  86. data/parscit/resources/sectLabel/affiliation.model +0 -0
  87. data/parscit/resources/sectLabel/author.model +0 -0
  88. data/parscit/resources/sectLabel/funcWord +320 -0
  89. data/parscit/resources/sectLabel/genericSect.model +0 -0
  90. data/parscit/resources/sectLabel/sectLabel.config +42 -0
  91. data/parscit/resources/sectLabel/sectLabel.configXml +42 -0
  92. data/parscit/resources/sectLabel/sectLabel.model +0 -0
  93. data/sh/convert_to_text.sh +20 -0
  94. data/spec/biblicit/extractor_spec.rb +121 -0
  95. data/spec/fixtures/Review_of_Michael_Tyes_Consciousness_Revisited.docx +0 -0
  96. data/spec/fixtures/critical-infrastructures.ps +63951 -0
  97. data/spec/fixtures/txt/E06-1050.txt +867 -0
  98. data/spec/fixtures/txt/sample1.txt +902 -0
  99. data/spec/fixtures/txt/sample2.txt +394 -0
  100. data/spec/spec_helper.rb +3 -0
  101. data/{perl → svm-header-parse}/HeaderParseService/lib/HeaderParse/API/Function.pm +2 -20
  102. data/{perl → svm-header-parse}/HeaderParseService/lib/HeaderParse/API/MultiClassChunking.pm +0 -7
  103. data/{perl → svm-header-parse}/HeaderParseService/lib/HeaderParse/API/Parser.pm +0 -2
  104. data/{perl → svm-header-parse}/HeaderParseService/lib/HeaderParse/API/ParserMethods.pm +0 -7
  105. data/{perl → svm-header-parse}/HeaderParseService/lib/HeaderParse/Config/API_Config.pm +6 -1
  106. data/svm-header-parse/HeaderParseService/tmp/.gitignore +4 -0
  107. data/svm-header-parse/extract.pl +75 -0
  108. metadata +351 -317
  109. data/perl/DocFilter/lib/DocFilter/Config.pm +0 -35
  110. data/perl/DocFilter/lib/DocFilter/Filter.pm +0 -51
  111. data/perl/FileConversionService/README.TXT +0 -11
  112. data/perl/FileConversionService/converters/PDFBox/pdfbox-app-1.7.1.jar +0 -0
  113. data/perl/FileConversionService/lib/CSXUtil/SafeText.pm +0 -140
  114. data/perl/FileConversionService/lib/FileConverter/CheckSum.pm +0 -77
  115. data/perl/FileConversionService/lib/FileConverter/Compression.pm +0 -137
  116. data/perl/FileConversionService/lib/FileConverter/Config.pm +0 -57
  117. data/perl/FileConversionService/lib/FileConverter/Controller.pm +0 -191
  118. data/perl/FileConversionService/lib/FileConverter/JODConverter.pm +0 -61
  119. data/perl/FileConversionService/lib/FileConverter/PDFBox.pm +0 -69
  120. data/perl/FileConversionService/lib/FileConverter/PSConverter.pm +0 -69
  121. data/perl/FileConversionService/lib/FileConverter/PSToText.pm +0 -88
  122. data/perl/FileConversionService/lib/FileConverter/Prescript.pm +0 -68
  123. data/perl/FileConversionService/lib/FileConverter/TET.pm +0 -75
  124. data/perl/FileConversionService/lib/FileConverter/Utils.pm +0 -130
  125. data/perl/HeaderParseService/lib/CSXUtil/SafeText.pm +0 -140
  126. data/perl/HeaderParseService/resources/data/EbizHeaders.txt +0 -24330
  127. data/perl/HeaderParseService/resources/data/EbizHeaders.txt.parsed +0 -27506
  128. data/perl/HeaderParseService/resources/data/EbizHeaders.txt.parsed.old +0 -26495
  129. data/perl/HeaderParseService/resources/data/tagged_headers.txt +0 -40668
  130. data/perl/HeaderParseService/resources/data/test_header.txt +0 -31
  131. data/perl/HeaderParseService/resources/data/test_header.txt.parsed +0 -31
  132. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test1 +0 -23
  133. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test10 +0 -23
  134. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test11 +0 -23
  135. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test12 +0 -23
  136. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test13 +0 -23
  137. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test14 +0 -23
  138. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test15 +0 -23
  139. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test2 +0 -23
  140. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test3 +0 -23
  141. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test4 +0 -23
  142. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test5 +0 -23
  143. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test6 +0 -23
  144. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test7 +0 -23
  145. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test8 +0 -23
  146. data/perl/HeaderParseService/tmp/tmpVec_1156237246.08016_test9 +0 -23
  147. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test1 +0 -23
  148. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test10 +0 -23
  149. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test11 +0 -23
  150. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test12 +0 -23
  151. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test13 +0 -23
  152. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test14 +0 -23
  153. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test15 +0 -23
  154. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test2 +0 -23
  155. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test3 +0 -23
  156. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test4 +0 -23
  157. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test5 +0 -23
  158. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test6 +0 -23
  159. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test7 +0 -23
  160. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test8 +0 -23
  161. data/perl/HeaderParseService/tmp/tmpVec_914027525.276114_test9 +0 -23
  162. data/perl/ParsCit/crfpp/traindata/parsCit.template +0 -60
  163. data/perl/ParsCit/crfpp/traindata/parsCit.train.data +0 -12104
  164. data/perl/ParsCit/crfpp/traindata/tagged_references.txt +0 -500
  165. data/perl/ParsCit/lib/CSXUtil/SafeText.pm +0 -140
  166. data/perl/ParsCit/lib/ParsCit/Citation.pm +0 -462
  167. data/perl/ParsCit/lib/ParsCit/CitationContext.pm +0 -132
  168. data/perl/ParsCit/lib/ParsCit/Config.pm +0 -46
  169. data/perl/ParsCit/lib/ParsCit/Controller.pm +0 -306
  170. data/perl/ParsCit/lib/ParsCit/PostProcess.pm +0 -367
  171. data/perl/ParsCit/lib/ParsCit/PreProcess.pm +0 -333
  172. data/perl/ParsCit/resources/parsCit.model +0 -0
  173. data/perl/extract.pl +0 -199
  174. data/spec/biblicit/cb2bib_spec.rb +0 -48
  175. data/spec/biblicit/citeseer_spec.rb +0 -40
  176. /data/{perl → svm-header-parse}/HeaderParseService/README.TXT +0 -0
  177. /data/{perl/DocFilter → svm-header-parse/HeaderParseService}/lib/CSXUtil/SafeText.pm +0 -0
  178. /data/{perl → svm-header-parse}/HeaderParseService/lib/HeaderParse/API/AssembleXMLMetadata.pm +0 -0
  179. /data/{perl → svm-header-parse}/HeaderParseService/lib/HeaderParse/API/LoadInformation.pm +0 -0
  180. /data/{perl → svm-header-parse}/HeaderParseService/lib/HeaderParse/API/NamePatternMatch.pm +0 -0
  181. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/50states +0 -0
  182. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/AddrTopWords.txt +0 -0
  183. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/AffiTopWords.txt +0 -0
  184. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/AffiTopWordsAll.txt +0 -0
  185. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/ChineseSurNames.txt +0 -0
  186. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/Csurnames.bin +0 -0
  187. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/Csurnames_spec.bin +0 -0
  188. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/DomainSuffixes.txt +0 -0
  189. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/LabeledHeader +0 -0
  190. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/README +0 -0
  191. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/TrainMulClassLines +0 -0
  192. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/TrainMulClassLines1 +0 -0
  193. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/abstract.txt +0 -0
  194. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/abstractTopWords +0 -0
  195. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/addr.txt +0 -0
  196. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/affi.txt +0 -0
  197. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/affis.bin +0 -0
  198. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/all_namewords_spec.bin +0 -0
  199. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/allnamewords.bin +0 -0
  200. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/cities_US.txt +0 -0
  201. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/cities_world.txt +0 -0
  202. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/city.txt +0 -0
  203. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/cityname.txt +0 -0
  204. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/country_abbr.txt +0 -0
  205. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/countryname.txt +0 -0
  206. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/dateTopWords +0 -0
  207. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/degree.txt +0 -0
  208. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/email.txt +0 -0
  209. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/excludeWords.txt +0 -0
  210. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/female-names +0 -0
  211. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/firstNames.txt +0 -0
  212. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/firstnames.bin +0 -0
  213. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/firstnames_spec.bin +0 -0
  214. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/intro.txt +0 -0
  215. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/keyword.txt +0 -0
  216. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/keywordTopWords +0 -0
  217. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/male-names +0 -0
  218. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/middleNames.txt +0 -0
  219. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/month.txt +0 -0
  220. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/mul +0 -0
  221. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/mul.label +0 -0
  222. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/mul.label.old +0 -0
  223. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/mul.processed +0 -0
  224. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/mulAuthor +0 -0
  225. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/mulClassStat +0 -0
  226. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/nickname.txt +0 -0
  227. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/nicknames.bin +0 -0
  228. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/note.txt +0 -0
  229. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/page.txt +0 -0
  230. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/phone.txt +0 -0
  231. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/postcode.txt +0 -0
  232. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/pubnum.txt +0 -0
  233. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/statename.bin +0 -0
  234. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/statename.txt +0 -0
  235. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/states_and_abbreviations.txt +0 -0
  236. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/stopwords +0 -0
  237. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/stopwords.bin +0 -0
  238. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/surNames.txt +0 -0
  239. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/surnames.bin +0 -0
  240. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/surnames_spec.bin +0 -0
  241. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/A.html +0 -0
  242. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/B.html +0 -0
  243. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/C.html +0 -0
  244. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/D.html +0 -0
  245. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/E.html +0 -0
  246. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/F.html +0 -0
  247. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/G.html +0 -0
  248. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/H.html +0 -0
  249. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/I.html +0 -0
  250. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/J.html +0 -0
  251. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/K.html +0 -0
  252. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/L.html +0 -0
  253. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/M.html +0 -0
  254. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/N.html +0 -0
  255. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/O.html +0 -0
  256. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/P.html +0 -0
  257. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/Q.html +0 -0
  258. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/R.html +0 -0
  259. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/S.html +0 -0
  260. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/T.html +0 -0
  261. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/U.html +0 -0
  262. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/V.html +0 -0
  263. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/W.html +0 -0
  264. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/WCSelect.gif +0 -0
  265. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/X.html +0 -0
  266. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/Y.html +0 -0
  267. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/Z.html +0 -0
  268. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ae.html +0 -0
  269. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/am.html +0 -0
  270. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ar.html +0 -0
  271. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/at.html +0 -0
  272. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/au.html +0 -0
  273. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/bd.html +0 -0
  274. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/be.html +0 -0
  275. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/bg.html +0 -0
  276. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/bh.html +0 -0
  277. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/blueribbon.gif +0 -0
  278. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/bm.html +0 -0
  279. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/bn.html +0 -0
  280. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/br.html +0 -0
  281. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ca.html +0 -0
  282. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ch.html +0 -0
  283. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/cl.html +0 -0
  284. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/cn.html +0 -0
  285. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/co.html +0 -0
  286. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/cr.html +0 -0
  287. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/cy.html +0 -0
  288. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/cz.html +0 -0
  289. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/de.html +0 -0
  290. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/dean-mainlink.jpg +0 -0
  291. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/dk.html +0 -0
  292. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ec.html +0 -0
  293. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ee.html +0 -0
  294. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/eg.html +0 -0
  295. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/es.html +0 -0
  296. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/et.html +0 -0
  297. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/faq.html +0 -0
  298. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/fi.html +0 -0
  299. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/fj.html +0 -0
  300. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/fo.html +0 -0
  301. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/fr.html +0 -0
  302. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/geog.html +0 -0
  303. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/gr.html +0 -0
  304. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/gu.html +0 -0
  305. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/hk.html +0 -0
  306. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/hr.html +0 -0
  307. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/hu.html +0 -0
  308. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/id.html +0 -0
  309. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ie.html +0 -0
  310. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/il.html +0 -0
  311. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/in.html +0 -0
  312. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/is.html +0 -0
  313. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/it.html +0 -0
  314. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/jm.html +0 -0
  315. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/jo.html +0 -0
  316. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/jp.html +0 -0
  317. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/kaplan.gif +0 -0
  318. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/kr.html +0 -0
  319. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/kw.html +0 -0
  320. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/lb.html +0 -0
  321. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/linkbw2.gif +0 -0
  322. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/lk.html +0 -0
  323. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/lt.html +0 -0
  324. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/lu.html +0 -0
  325. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/lv.html +0 -0
  326. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ma.html +0 -0
  327. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/maczynski.gif +0 -0
  328. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/mirror.tar +0 -0
  329. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/mk.html +0 -0
  330. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/mo.html +0 -0
  331. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/mseawdm.gif +0 -0
  332. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/mt.html +0 -0
  333. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/mx.html +0 -0
  334. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/my.html +0 -0
  335. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ni.html +0 -0
  336. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/nl.html +0 -0
  337. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/no.html +0 -0
  338. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/nz.html +0 -0
  339. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/pa.html +0 -0
  340. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/pe.html +0 -0
  341. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ph.html +0 -0
  342. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/pl.html +0 -0
  343. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/pointcom.gif +0 -0
  344. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/pr.html +0 -0
  345. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ps.html +0 -0
  346. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/pt.html +0 -0
  347. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/recognition.html +0 -0
  348. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/results.html +0 -0
  349. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ro.html +0 -0
  350. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ru.html +0 -0
  351. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/sd.html +0 -0
  352. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/se.html +0 -0
  353. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/sg.html +0 -0
  354. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/si.html +0 -0
  355. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/sk.html +0 -0
  356. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/th.html +0 -0
  357. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/tr.html +0 -0
  358. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/tw.html +0 -0
  359. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ua.html +0 -0
  360. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/uk.html +0 -0
  361. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/univ-full.html +0 -0
  362. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/univ.html +0 -0
  363. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/uy.html +0 -0
  364. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/ve.html +0 -0
  365. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/yu.html +0 -0
  366. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/za.html +0 -0
  367. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list/zm.html +0 -0
  368. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/university_list.txt +0 -0
  369. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/url.txt +0 -0
  370. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/webTopWords +0 -0
  371. /data/{perl → svm-header-parse}/HeaderParseService/resources/database/words +0 -0
  372. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/10ContextModelfold1 +0 -0
  373. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/10Modelfold1 +0 -0
  374. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/11ContextModelfold1 +0 -0
  375. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/11Modelfold1 +0 -0
  376. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/12ContextModelfold1 +0 -0
  377. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/12Modelfold1 +0 -0
  378. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/13ContextModelfold1 +0 -0
  379. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/13Modelfold1 +0 -0
  380. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/14ContextModelfold1 +0 -0
  381. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/14Modelfold1 +0 -0
  382. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/15ContextModelfold1 +0 -0
  383. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/15Modelfold1 +0 -0
  384. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/1ContextModelfold1 +0 -0
  385. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/1Modelfold1 +0 -0
  386. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/2ContextModelfold1 +0 -0
  387. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/2Modelfold1 +0 -0
  388. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/3ContextModelfold1 +0 -0
  389. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/3Modelfold1 +0 -0
  390. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/4ContextModelfold1 +0 -0
  391. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/4Modelfold1 +0 -0
  392. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/5ContextModelfold1 +0 -0
  393. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/5Modelfold1 +0 -0
  394. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/6ContextModelfold1 +0 -0
  395. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/6Modelfold1 +0 -0
  396. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/7ContextModelfold1 +0 -0
  397. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/7Modelfold1 +0 -0
  398. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/8ContextModelfold1 +0 -0
  399. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/8Modelfold1 +0 -0
  400. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/9ContextModelfold1 +0 -0
  401. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/9Modelfold1 +0 -0
  402. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/NameSpaceModel +0 -0
  403. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/NameSpaceTrainF +0 -0
  404. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/WrapperBaseFeaDict +0 -0
  405. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/WrapperContextFeaDict +0 -0
  406. /data/{perl → svm-header-parse}/HeaderParseService/resources/models/WrapperSpaceAuthorFeaDict +0 -0
@@ -0,0 +1,902 @@
1
+ A Calculus of Program Transformations and Its
2
+ Applications
3
+
4
+ Rahma Ben Ayed
5
+ School of Engineering
6
+ University of Tunis II
7
+ Belvedere, 1002 Tunisia
8
+ rbenayed@stardent.cck.tn
9
+ Jules Desharnais
10
+ Department of Informatics
11
+ Laval University,
12
+ Quebec City, PQ G1K 7P4, Canada
13
+ Jules.Desharnais@ift.ulaval.ca
14
+ Marc Frappier
15
+ Dept of Maths and Informatics
16
+ University of Sherbrooke
17
+ Sherbrooke, PQ J1K 2R1 Canada
18
+ marc.frappier@dmi.usherb.ca
19
+ Ali Mili
20
+
21
+
22
+
23
+ The Institute for Software Research
24
+ 1000 Technology Drive
25
+ Fairmont, WV 26554 USA
26
+ amili@csee.wvu.edu
27
+ May 27, 1998
28
+ Abstract
29
+
30
+ Traditional programming calculi focus on transforming a specification into a program.
31
+ With the advent of such recent paradigms as white box reuse, component based software
32
+ development, and reengineering, and with the continued predominance of software maintenance,
33
+ less and less software engineering activity nowadays deals with straightforward
34
+ development. More and more, software products are derived by combining, merging, or
35
+ adapting existing components. In this paper we present a calculus that models several
36
+ aspects of these paradigms.
37
+
38
+ Keywords: Formal specifications, Programming calculi, Program construction, Software
39
+ merging, Software incrementation, Software adaptation.
40
+ 1 Relational Specifications
41
+
42
+ We represent specifications by relations; without much loss of generality, we consider
43
+ homogeneous relations, and we denote by S the space on which relations are defined. As a
44
+ specification, a relation contains all the (input, output) pairs that are considered correct.
45
+ We have discussed in [6] how to use (heterogeneous) relations to represent specifications of
46
+ objects, in the sense of object oriented programming. Hence even though the discussions
47
+ of this paper deal with specifications of simple input/output functions, they can in fact
48
+ be applied to state-bearing modules, such as objects.
49
+ Constant relations include the universal relation, denoted by L, the identity relation,
50
+ denoted by I , and the empty relation, denoted by ;. Operations on relations include the
51
+
52
+ complement, denoted by R, the inverse, denoted by
53
+
54
+ b
55
+
56
+ R, and the product, denoted by R ffi R
57
+
58
+ 0
59
+
60
+
61
+ Correspondence Author.
62
+
63
+ or RR
64
+
65
+ 0
66
+
67
+ . We say that R is deterministic if and only if
68
+
69
+ b
70
+
71
+ RR ` I , and we say that R is total
72
+
73
+ if and only if I ` R
74
+
75
+ b
76
+
77
+ R.
78
+
79
+ We define an ordering relation on relational specifications under the name refinement
80
+ ordering: A relation R is said to refine a relation R
81
+
82
+ 0
83
+
84
+ if and only if
85
+
86
+ RL " R
87
+
88
+ 0
89
+
90
+ L " (R [ R
91
+
92
+ 0
93
+
94
+ ) = R
95
+
96
+ 0
97
+
98
+ :
99
+
100
+ We then write R w R
101
+
102
+ 0
103
+
104
+ or R
105
+
106
+ 0
107
+
108
+ v R. We admit without proof that this relation is a partial
109
+ ordering. We also admit that, modulo some definition of total correctness, the following
110
+ propositions hold:
111
+
112
+ ffl A program P is correct with respect to a specification R if and only if [P ] w R,
113
+
114
+ where [P ] is the function defined by P .
115
+
116
+ ffl R w R
117
+
118
+ 0
119
+
120
+ if and only if any program correct with respect to R is correct with respect
121
+ to R
122
+
123
+ 0
124
+
125
+ .
126
+ The refinement ordering has some lattice-like properties which, for the sake of parsimony,
127
+ we present briefly without proof (details can be found in [2]).
128
+
129
+ ffl Two relations R and R
130
+
131
+ 0
132
+
133
+ have a join (denoted by R t R
134
+
135
+ 0
136
+
137
+ ) if and only if they satisfy
138
+ the condition
139
+
140
+ RL " R
141
+
142
+ 0
143
+
144
+ L = (R " R
145
+
146
+ 0
147
+
148
+ )L:
149
+ Under this condition, the join is given by
150
+
151
+ R t R
152
+
153
+ 0
154
+
155
+ = R " R
156
+
157
+ 0
158
+
159
+ L [ R
160
+
161
+ 0
162
+
163
+ " RL [ (R " R
164
+
165
+ 0
166
+
167
+ ):
168
+ The specification R t R
169
+
170
+ 0
171
+
172
+ captures all the information of R and all the information
173
+ of R
174
+
175
+ 0
176
+
177
+ . It is satisfied by any implementation that is known to satisfy both R and R
178
+
179
+ 0
180
+
181
+ .
182
+
183
+ ffl Any two relations R and R
184
+
185
+ 0
186
+
187
+ have a meet, which is denoted by RuR
188
+
189
+ 0
190
+
191
+ and defined by
192
+
193
+ R u R
194
+
195
+ 0
196
+
197
+ = RL " R
198
+
199
+ 0
200
+
201
+ L " (R [ R
202
+
203
+ 0
204
+
205
+ ):
206
+ The specification RuR
207
+
208
+ 0
209
+
210
+ captures the requirements information that R and R
211
+
212
+ 0
213
+
214
+ have
215
+ in common. It is satisfied by any implementation that is known to satisfy either R
216
+
217
+ or R
218
+
219
+ 0
220
+
221
+ .
222
+ The join operator can be used to structure complex specifications as aggregates of simpler
223
+ specifications; hence most of the manipulations we discuss in this paper can be made
224
+ arbitrarily simple by by considering arbitrarily simple component specifications.
225
+ 2 A Calculus of Programming by Parts
226
+
227
+ Programming by parts rests on the premise that complex specifications can be structured
228
+ as joins of simpler specifications, and proceeds by solving each component of the join
229
+ in turn, then combining the partially defined solutions so obtained to produce a program
230
+ that satisfies all the component subspecifications simultaneously. To support this program
231
+ derivation method, we provide the following tools:
232
+
233
+ ffl A specification/programming notation that supports specification structuring (by
234
+ means of joins, meets) as well as program structuring (by means of traditional programming
235
+ constructs).
236
+
237
+ ffl A set of guidelines for deriving partially determined programs from component subspecifications.
238
+
239
+
240
+ ffl A set of rules for combining partially determined programs into (more) completely
241
+ determined programs.
242
+ Due to space restrictions, we can only present a flavor of this method; details of this
243
+ method can be found in [2].
244
+
245
+ 2.1 A Specification Notation
246
+
247
+ Specifications are represented by structured relational expressions. We use two elementary
248
+ specifications, in addition to closed form relations, which are:
249
+
250
+ ffl Establish, which we denote by est(t), and define as:
251
+
252
+ est(t) = f(s; s
253
+
254
+ 0
255
+
256
+ )jt(s
257
+
258
+ 0
259
+
260
+ )g:
261
+ ffl Preserve, which we denote by prs(t), and define as:
262
+
263
+ prs(t) = f(s; s
264
+
265
+ 0
266
+
267
+ )jt(s) t(s
268
+
269
+ 0
270
+
271
+ )g:
272
+ For the sake of stepwise refinement, we decide that all our compound statements must be
273
+ monotonic with respect to the refinement ordering; we present some of these statements,
274
+ for illustrative purposes.
275
+
276
+ ffl Join. When two requirements must be satisfied simultaneously, they are combined
277
+ with the join (t).
278
+
279
+ ffl Meet. When any one of two requirements may be satisfied, they are combined with
280
+ the meet (u).
281
+
282
+ ffl Composition. Because the traditional relational product is not monotonic with respect
283
+ to refinement, we define a monotonic sequence-like operator, which we denote
284
+ by R
285
+
286
+ 2
287
+
288
+ R
289
+
290
+ 0
291
+
292
+ and define as
293
+
294
+ R
295
+
296
+ 2
297
+
298
+ R
299
+
300
+ 0
301
+
302
+ = RR
303
+
304
+ 0
305
+
306
+ " RR
307
+
308
+ 0
309
+
310
+ L:
311
+ ffl Closure. When a specification must be applied an arbitrary number of times, we
312
+ apply the closure operator to it, to produce
313
+
314
+ R
315
+
316
+ ?
317
+
318
+ = t i0 R
319
+
320
+ i
321
+
322
+ ;
323
+
324
+ where R
325
+
326
+ i
327
+
328
+ is the monotonic composition of R by itself i times.
329
+
330
+ 2.2 Refinement Rules: Basis of Induction
331
+
332
+ We present a sample of refinement rules that produce a programming construct or eliminate
333
+ a specification construct (join, meet).
334
+
335
+ ffl R t R is refined by R.
336
+
337
+ ffl R u R
338
+
339
+ 0
340
+
341
+ is refined by R (and by R
342
+
343
+ 0
344
+
345
+ ).
346
+
347
+ ffl If R is deterministic or R
348
+
349
+ 0
350
+
351
+ is total then R 2 R
352
+
353
+ 0
354
+
355
+ is refined by R; R'.
356
+ 2.3 Refinement Rules: Merging
357
+
358
+ Given two components of the join that have the same structure, these rules merge the
359
+ components into a single specification that has the common structure, and propagate the
360
+ joins deeper into the nesting structure. A sampling of these rules is:
361
+
362
+ ffl If all the joins are defined, then (R
363
+
364
+ 2
365
+
366
+ R
367
+
368
+ 0
369
+
370
+ ) t (Q
371
+
372
+ 2
373
+
374
+ Q
375
+
376
+ 0
377
+
378
+ ) is refined by
379
+ (R t Q)
380
+
381
+ 2
382
+
383
+ (R
384
+
385
+ 0
386
+
387
+ t Q
388
+
389
+ 0
390
+
391
+ ):
392
+ ffl If all the joins are defined, then R
393
+
394
+
395
+
396
+ t Q
397
+
398
+
399
+
400
+ is refined by
401
+ (R t Q)
402
+
403
+
404
+
405
+ :
406
+ 2.4 Refinement Rules: Structure Unification
407
+
408
+ While the rules of the previous section exploit the common structure of two subspecifications
409
+ to merge them into a single specification (that has the common structure), the
410
+ rules that we discuss in this section attempt to unify the structure of two components.
411
+ Typically, they do so by imposing the structure of one component on the other. For the
412
+ sake of illustration, we present two such rules, which impose a sequence structure on a
413
+ (structureless) relation.
414
+
415
+ ffl R is refined by (R \Theta \Theta \Theta \Theta R) 2 R,
416
+
417
+ ffl R is refined by R 2
418
+
419
+ (R B B B B R),
420
+
421
+ where (R \Theta \Theta \Theta \Theta R) is the least refined solution to the equation R v X
422
+
423
+ 2
424
+
425
+ R and (R B B B B R) is the
426
+ least refined solution to the equation R v R
427
+
428
+ 2
429
+
430
+ X . Note that for R = est(t), for some
431
+ predicate t, the first rule yields the decomposition
432
+
433
+ est(t) v est(true) 2 est(t);
434
+
435
+ and the second rule yields the decomposition
436
+
437
+ est(t) v est(t) 2 prs(t):
438
+
439
+ 2.5 Brief Illustration
440
+
441
+ For the sake of illustration, we consider the specification of a sorting program and show
442
+ how we can apply some refinement steps using the method of program construction by
443
+ parts.
444
+
445
+ Sort
446
+
447
+ v f join structure g
448
+
449
+ Perm t Ord
450
+
451
+ v f definition of Ord g
452
+
453
+ Perm t est(sorted)
454
+
455
+ v f sorted j psorted k = N , where psorted means partially sorted g
456
+
457
+ Perm t est(psorted) t est(k = N)
458
+
459
+ v f structure unification rules g
460
+
461
+ Perm
462
+
463
+ 2
464
+
465
+ Perm
466
+
467
+ t est(psorted)
468
+
469
+ 2
470
+
471
+ prs(psorted)
472
+
473
+ t est(true) 2 est(k = N)
474
+
475
+ v f merging rule g
476
+
477
+ (Perm t est(psorted) t est(true))
478
+
479
+ 2
480
+
481
+ (Perm t prs(psorted) t est(k = N))
482
+
483
+ v f common refinement of the first factor g
484
+
485
+ (k := 1 t k := 1 t k := 1)
486
+
487
+ 2
488
+
489
+ (Perm t prs(psorted) t est(k = N))
490
+
491
+ v f basis of induction rule: eliminating joins g
492
+
493
+ (k := 1)
494
+
495
+ 2
496
+
497
+ (Perm t prs(psorted) t est(k = N )).
498
+
499
+ v f basis of induction rule: replacing
500
+
501
+ 2
502
+
503
+ with ; g
504
+
505
+ (k := 1) ; (Perm t prs(psorted) t est(k = N )).
506
+ The first term of the sequence is the initialization segment; the second term is the specification
507
+ of the while statement of an insertion sort.
508
+ 3 Application: Software Incrementation
509
+
510
+ We consider a software system C and a feature F that we wish to add to C, and we are
511
+ interested in how to augment C so that it has feature F . Our position is that this problem
512
+ amounts to refining the specification
513
+
514
+ C t F:
515
+
516
+ Note that although C is a program, we can write it using our specification notation (we
517
+ have rules for doing that, given in [2]). For the sake of argument, we assume that C and
518
+
519
+ F do indeed have a join, and that C is structured as a sequence of three components, say
520
+
521
+ C = C 0 2 C 1 2 C 2 :
522
+
523
+ We assume further that after analyzing C and F , we have determined that modifications
524
+ of C to augment it with F are localized in component C 1 . In light of this analysis, we
525
+ deccompose F as
526
+
527
+ F v (F \Theta \Theta \Theta \Theta F ) 2 F 2 (F B B B B F );
528
+ using the structure unification rules given above. It may be worthwhile at this stage
529
+ to analyze the intuitive meaning of (F \Theta \Theta \Theta \Theta F ) and (F B B B B F ): the term (F \Theta \Theta \Theta \Theta F ) represents the
530
+ minimal (with respect to refinement) specification that must be satisfied upstream of
531
+
532
+ F in order not to destroy any information that F may need; for example, if F is the
533
+ specification of a sort routine, (F \Theta \Theta \Theta \Theta F ) is specification Perm, which prescribes that no cell
534
+ of the array to be sorted is lost. Also, the term (F B B B B F ) represents the minimal (with
535
+ respect to refinement) specification that must be satisfied downstream of F in order not
536
+ to destroy the work achieved by F ; if F is the specification of a sort routine, then (F B B B B F ) is
537
+ the specification that prescribes that array a (which has been sorted by F ) is kept intact.
538
+ Using the sequential decomposition of C and F into three terms, we find the following
539
+ refinement:
540
+
541
+ C t F
542
+
543
+ v f substitution g
544
+
545
+ (C 0
546
+
547
+ 2
548
+
549
+ C 1
550
+
551
+ 2
552
+
553
+ C 2 ) t
554
+
555
+ (F \Theta \Theta \Theta \Theta F )
556
+
557
+ 2
558
+
559
+ F
560
+
561
+ 2
562
+
563
+ (F B B B B F )
564
+
565
+ v f merging g
566
+
567
+ (C 0 t (F \Theta \Theta \Theta \Theta F ))
568
+
569
+ 2
570
+
571
+ (C 1 t F )
572
+
573
+ 2
574
+
575
+ (C 2 t (F B B B B F )).
576
+ We consider the first term of the product, and analyze the possibilities that may arise (the
577
+ same discussion holds for the third term):
578
+
579
+ ffl C 0 and (F \Theta \Theta \Theta \Theta F ) have no join; this means that the decompositions of F and C have not
580
+ been lined up, and must be revised. To illustrate what it means for decompositions
581
+ to be lined up, consider the following relations:
582
+
583
+ R
584
+
585
+ 0
586
+
587
+ = f(s; s
588
+
589
+ 0
590
+
591
+ )js
592
+
593
+ 0
594
+
595
+ = s + 3g, R
596
+
597
+ 00
598
+
599
+ = f(s; s
600
+
601
+ 0
602
+
603
+ )js + 7 s
604
+
605
+ 0
606
+
607
+ s + 8g.
608
+
609
+ Q
610
+
611
+ 0
612
+
613
+ = f(s; s
614
+
615
+ 0
616
+
617
+ )js + 3 s
618
+
619
+ 0
620
+
621
+ s + 4g, Q
622
+
623
+ 00
624
+
625
+ = f(s; s
626
+
627
+ 0
628
+
629
+ )js
630
+
631
+ 0
632
+
633
+ = s + 7g.
634
+
635
+ R = Q = f(s; s
636
+
637
+ 0
638
+
639
+ )js + 10 s
640
+
641
+ 0
642
+
643
+ s + 11g.
644
+ Relations R and Q do have a join since they are identical; if we decompose R as
645
+
646
+ R
647
+
648
+ 0
649
+
650
+ 2
651
+
652
+ R
653
+
654
+ 00
655
+
656
+ and decompose Q as Q
657
+
658
+ 0
659
+
660
+ 2
661
+
662
+ Q
663
+
664
+ 00
665
+
666
+ then we obtain a lined up decomposition, since
667
+
668
+ R
669
+
670
+ 0
671
+
672
+ and Q
673
+
674
+ 0
675
+
676
+ have a join (R
677
+
678
+ 0
679
+
680
+ ), and R
681
+
682
+ 00
683
+
684
+ and Q
685
+
686
+ 00
687
+
688
+ have a join (Q
689
+
690
+ 00
691
+
692
+ ); but if we decompose R
693
+
694
+ as R
695
+
696
+ 0
697
+
698
+ 2
699
+
700
+ R
701
+
702
+ 00
703
+
704
+ and Q as Q
705
+
706
+ 00
707
+
708
+ 2
709
+
710
+ Q
711
+
712
+ 0
713
+
714
+ then we do not obtain a lined up decomposition, because
715
+ neither R
716
+
717
+ 0
718
+
719
+ and Q
720
+
721
+ 00
722
+
723
+ nor R
724
+
725
+ 00
726
+
727
+ and Q
728
+
729
+ 0
730
+
731
+ have a join.
732
+
733
+ ffl C 0 and (F \Theta \Theta \Theta \Theta F ) do have a join, and C 0 does not refine (F \Theta \Theta \Theta \Theta F ). This means that C 0
734
+
735
+ must be modified to accomodate specification (F \Theta \Theta \Theta \Theta F ), hence enable the application
736
+ of function F in the next component (C 1 t F ). The modification of C 0 is carried
737
+ out using the refinement rules of the calculus of programming by parts.
738
+
739
+ ffl C 0 and (F \Theta \Theta \Theta \Theta F ) do have a join; furthermore, C 0 refines (F \Theta \Theta \Theta \Theta F ). This is the ideal
740
+ case: it means that the modification of C does not involve component C 0 , since
741
+
742
+ C 0 preserves all the information required to compute function F . The verification
743
+ condition provided for this case, which is
744
+
745
+ C 0 w (F \Theta \Theta \Theta \Theta F )
746
+ (along with the homologous condition, C 2 w (F B B B B F )) consitutes the necessary condition
747
+ under which the modification of C to augment it with F is localized to component
748
+ C 1 .
749
+ 4 Application: Software Merging
750
+
751
+ We consider two versions, say V and W , of some software system, and we are interested
752
+ in merging them into a single version that has all the features of V and all the features of
753
+
754
+ W . We view this problem as that of refining the expression
755
+
756
+ V t W:
757
+
758
+ Because V and W stem presumably from a common original system by incrementation,
759
+ it is reasonable to expect that large portions of V and W are common, and that their
760
+ differences are localized. For the sake of argument, we assume that both V and W are
761
+ structured as sequences, which we write as:
762
+
763
+ V t W
764
+
765
+ v f substitutions g
766
+
767
+ (V 0 2
768
+
769
+ V 1 2
770
+
771
+ V 2 )
772
+
773
+ t(W 0
774
+
775
+ 2
776
+
777
+ W 1
778
+
779
+ 2
780
+
781
+ W 2 )
782
+
783
+ v f merging g
784
+
785
+ ((V 0 t W 0 )
786
+
787
+ 2
788
+
789
+ (V 1 t W 1 )
790
+
791
+ 2
792
+
793
+ (V 2 t W 2 )).
794
+ We imagine, for the sake of argument, that
795
+
796
+ ffl The feature of V that W does not have is localized in V 1 ; hence V 1 w W 1 , whence
797
+
798
+ V 1 t W 1 = V 1 .
799
+
800
+ ffl The feature of W that V does not have is localized in W 2 ; hence W 2 w V 2 , whence
801
+
802
+ V 2 t W 2 = W 2 .
803
+
804
+ ffl The components V 0 and W 0 have not been changed from the original version of the
805
+ software system, hence are identical; whence V 0 t W 0 = V 0 .
806
+ Under the condition hypothesized above, the new version of the software system become,
807
+ after substitution:
808
+
809
+ V 0
810
+
811
+ 2
812
+
813
+ V 1
814
+
815
+ 2
816
+
817
+ W 2 :
818
+
819
+ 5 Application: Software Adaptation
820
+
821
+ We consider a software component C and a specification K; we assume that C does not
822
+ satisfy specification K, but we have reasons to believe that it can be modified economically
823
+ to satisfy it. This problem does look like the refinement of K t C, since it proceeds by
824
+ considering information from two specifications/programs, but differs in two significant
825
+ ways:
826
+
827
+ ffl Whereas the refinement of K t C seeks to satisfy both K and C, the modification
828
+ of C to satisfy K really seeks to satisfy K only ---but expects to use C towards this
829
+ end.
830
+
831
+ ffl Whereas structure unification rules of program construction by parts consider the
832
+ two arguments as interchangeable, and may impose any one argument's structure
833
+ on the other, software adaptation rules will always attempt to impose the structure
834
+ of C on K. In effect, what happens in software adaptation is that the refinement
835
+ proceeds by drawing syntactic information from C and semantic information from
836
+
837
+ K, to produce a component that acts (semantics) like K but looks (syntax) like C.
838
+
839
+ To acknowledge the asymmetry between the roles played by K and C in the adaptation
840
+ of C to satisfy K, we write the expression to refine as
841
+
842
+ K C;
843
+
844
+ and we derive slightly different refinement rules for the operator than we had for the
845
+
846
+ t operator. Space limitations prohibit us from presenting these rules, and from giving an
847
+ illustrative example.
848
+ 6 Conclusion
849
+
850
+ In this paper we have briefly presented a calculus of program construction by parts,
851
+ and have discussed its use for recent software development paradigms, such as software
852
+ incrementation, software merging, and software adaptation.
853
+ Several authors have advocated that the join operator is useful in the refinement
854
+ of complex specifications [2, 4, 1]. Hoare et al [1] identifies some basic properties of
855
+ join, like idempotence, commutativity, associativity and absorption. They also mention
856
+ distributivity over usual programming constructs like sequential composition, alternation,
857
+ iteration and nondeterministic choice, but for a very limited case of join (directed set of
858
+ subspecifications with bounded nondeterminacy). Recent work of Hehner [4] includes laws
859
+ of refinement for join-structured specifications. In Hehner's calculus, specifications are
860
+ predicates, termination is prescribed using a time variable, and join is logical conjunction.
861
+ Morgan and Gardiner [3] use a join statement for data refinement and for the definition
862
+ of logical constants. They do not use join as a specification structuring device nor do they
863
+ study the refinement of join-structured specifications. Finally, the work of von Wright
864
+ also mentions a join operator. In [7], he reconstructs the refinement calculus of Back from
865
+ elementary primitives. The emphasis of this work is more on the definition of a language
866
+ than on the definition of a refinement calculus. The semantics of the language is given by
867
+ predicate transformers, and miraculous specifications are allowed.
868
+ Our work differs from Hehner's work by the representation of specifications (predicates
869
+ vs. relations) and by their interpretations: termination is implicit in our specifications
870
+
871
+ whereas it is expressed as timing constraints in Hehner's. Our work differs from that of
872
+ Hoare et al [1] by using partial relations and demonic operators, by not using a fictitious
873
+ state to represent nontermination, and by providing rules to eliminate meets in a
874
+ specification. Our work differs from the work of von Wright, Gardiner and Morgan by
875
+ using a different semantics, by not allowing miraculous specifications, and by studying the
876
+ transformation of join-structured specifications. We share with the work of Sekerinski [5]
877
+ (and Z) the same specification model where the focus is on input-output pairs for which
878
+ a program must terminate. Most importantly, the work presented in this paper differs
879
+ from other programming calculi (including our own [2]) by the fact that it deals with new
880
+ software development paradigms rather than traditional program construction.
881
+ References
882
+
883
+ [1] C.A.R. Hoare et al. Laws of programming. Communications of the ACM, 30(8):672--
884
+ 686, 1987.
885
+ [2] M. Frappier, J. Desharnais, and A. Mili. A calculus of program construction by parts.
886
+
887
+ Science of Computer Programming, 6:237--254, 1996.
888
+ [3] P. Gardiner and C.C. Morgan. Data refinement of predicate transformers. Theoretical
889
+ Computer Science, 87:143--162, 1991.
890
+ [4] E.C.R. Hehner. A Practical Theory of Programming. Springer-Verlag, 1993.
891
+ [5] E. Sekerinski. A calculus for predicative programming. In R.S. Bird, C.C. Morgan, and
892
+ J.C.P. Woodcock, editors, Mathematics of program construction : second international
893
+ conference, number 669 in Lecture Notes in Computer Science, Oxford, UK, 1992.
894
+ Springer-Verlag.
895
+ [6] D.R. Skuce and A. Mili. Behavioral specifications in object oriented programming.
896
+
897
+ Journal of Object Oriented Programming, pages 41--49, January 1995.
898
+ [7] J. Von Wright. A lattice theoretical basis for program refinement. Technical report,
899
+ Dept. of Computer Science,
900
+
901
+ Abo Akademi, Finland, 1990.
902
+