Advertisement
Beatgodes

Untitled

Apr 19th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.96 KB | None | 0 0
  1. (* ---------------------------------------------------------- *)
  2. (* --- Post-condition (file string.h, line 65) in 'strlen' --- *)
  3. (* ---------------------------------------------------------- *)
  4. theory VCstrlen_post_2
  5.  
  6. use import bool.Bool
  7. use import int.Int
  8. use import int.ComputerDivision
  9. use import real.RealInfix
  10. use import qed.Arith
  11. use import map.Map
  12. use import memory.Memory
  13. use import cint.Cint
  14. use import Axiomatic.Axiomatic
  15. use import A_Length.A_Length
  16.  
  17. goal WP "expl:Post-condition (file string.h, line 65) in 'strlen'":
  18. forall i_1 i_0 : int.
  19. forall malloc_0 : map int int.
  20. forall mchar_0 : map addr int.
  21. forall s_0 ss_0 : addr.
  22. let x_0 = ss_0.offset in
  23. let x_1 = s_0.offset in
  24. let x_2 = s_0.base in
  25. (0 = mchar_0[ss_0]) ->
  26. ((linked malloc_0)) ->
  27. ((sconst mchar_0)) ->
  28. ((addr_le s_0 ss_0)) ->
  29. ((valid_rd malloc_0 ss_0 1)) ->
  30. ((is_sint32 (x_0 - x_1))) ->
  31. (exists i_2 : int. (p_Length_of_str_is mchar_0 malloc_0 s_0 i_2)) ->
  32. ((is_sint8 mchar_0[{ s_0 with offset = i_1 + x_1 }])) ->
  33. ((is_sint8 mchar_0[{ s_0 with offset = i_0 + x_1 }])) ->
  34. ((addr_le ss_0 ({ s_0 with offset = x_1 + ((l_Length mchar_0 s_0)) }))) ->
  35. (forall i_2 : int. let x_3 = i_2 + x_1 in (0 <= i_2) -> (x_3 < x_0) ->
  36. (0 <> mchar_0[{ s_0 with offset = x_3 }])) ->
  37. (exists i_2 : int. (x_0 = (i_2 + x_1)) /\
  38. ((p_Length_of_str_is mchar_0 malloc_0 s_0 i_2)))
  39.  
  40. end
  41.  
  42. (* ---------------------------------------------------------- *)
  43. (* --- Preservation of Invariant (file strlen.c, line 9) --- *)
  44. (* ---------------------------------------------------------- *)
  45. theory VCstrlen_loop_inv_4_preserved
  46.  
  47. use import bool.Bool
  48. use import int.Int
  49. use import int.ComputerDivision
  50. use import real.RealInfix
  51. use import qed.Arith
  52. use import map.Map
  53. use import memory.Memory
  54. use import Axiomatic.Axiomatic
  55. use import cint.Cint
  56. use import A_Length.A_Length
  57.  
  58. goal WP "expl:Preservation of Invariant (file strlen.c, line 9)":
  59. forall i_2 i_1 i_0 : int.
  60. forall malloc_0 : map int int.
  61. forall mchar_0 : map addr int.
  62. forall s_0 ss_0 : addr.
  63. let x_0 = s_0.base in
  64. let x_1 = s_0.offset in
  65. let a_0 = { s_0 with offset = x_1 + ((l_Length mchar_0 s_0)) } in
  66. let x_2 = ss_0.offset in
  67. let a_1 = { ss_0 with offset = 1 + x_2 } in
  68. (0 <> mchar_0[ss_0]) ->
  69. ((linked malloc_0)) ->
  70. ((sconst mchar_0)) ->
  71. ((addr_le s_0 ss_0)) ->
  72. ((valid_rd malloc_0 ss_0 1)) ->
  73. (exists i_3 : int. (p_Length_of_str_is mchar_0 malloc_0 s_0 i_3)) ->
  74. ((is_sint8 mchar_0[{ s_0 with offset = i_2 + x_1 }])) ->
  75. ((is_sint8 mchar_0[{ s_0 with offset = i_1 + x_1 }])) ->
  76. ((is_sint8 mchar_0[{ s_0 with offset = i_0 + x_1 }])) ->
  77. ((addr_le ss_0 a_0)) ->
  78. (forall i_3 : int. let x_3 = i_3 + x_1 in (0 <= i_3) -> (x_3 < x_2) ->
  79. (0 <> mchar_0[{ s_0 with offset = x_3 }])) ->
  80. (((addr_le s_0 a_1)) /\ ((addr_le a_1 a_0)))
  81.  
  82. end
  83.  
  84. (* ---------------------------------------------------------- *)
  85. (* --- Establishment of Invariant (file strlen.c, line 9) --- *)
  86. (* ---------------------------------------------------------- *)
  87. theory VCstrlen_loop_inv_4_established
  88.  
  89. use import bool.Bool
  90. use import int.Int
  91. use import int.ComputerDivision
  92. use import real.RealInfix
  93. use import qed.Arith
  94. use import map.Map
  95. use import memory.Memory
  96. use import Axiomatic.Axiomatic
  97. use import cint.Cint
  98. use import A_Length.A_Length
  99.  
  100. goal WP "expl:Establishment of Invariant (file strlen.c, line 9)":
  101. forall i_1 i_0 : int.
  102. forall malloc_0 : map int int.
  103. forall mchar_0 : map addr int.
  104. forall s_0 : addr.
  105. let x_0 = s_0.base in
  106. let x_1 = s_0.offset in
  107. ((linked malloc_0)) ->
  108. ((sconst mchar_0)) ->
  109. (exists i_2 : int. (p_Length_of_str_is mchar_0 malloc_0 s_0 i_2)) ->
  110. ((is_sint8 mchar_0[{ s_0 with offset = i_1 + x_1 }])) ->
  111. ((is_sint8 mchar_0[{ s_0 with offset = i_0 + x_1 }])) ->
  112. (((addr_le s_0 s_0)) /\
  113. ((addr_le s_0 ({ s_0 with offset = x_1 + ((l_Length mchar_0 s_0)) }))))
  114.  
  115. end
  116.  
  117. (* ---------------------------------------------------------- *)
  118. (* --- Preservation of Invariant (file strlen.c, line 10) --- *)
  119. (* ---------------------------------------------------------- *)
  120. theory VCstrlen_loop_inv_5_preserved
  121.  
  122. use import bool.Bool
  123. use import int.Int
  124. use import int.ComputerDivision
  125. use import real.RealInfix
  126. use import qed.Arith
  127. use import map.Map
  128. use import memory.Memory
  129. use import Axiomatic.Axiomatic
  130. use import cint.Cint
  131. use import A_Length.A_Length
  132.  
  133. goal WP "expl:Preservation of Invariant (file strlen.c, line 10)":
  134. forall i_2 i_1 i_0 : int.
  135. forall malloc_0 : map int int.
  136. forall mchar_0 : map addr int.
  137. forall s_0 ss_0 : addr.
  138. let x_0 = s_0.offset in
  139. let x_1 = i_2 + x_0 in
  140. let x_2 = ss_0.offset in
  141. let x_3 = s_0.base in
  142. let x_4 = mchar_0[{ s_0 with offset = x_1 }] in
  143. (0 <= i_2) ->
  144. (0 <> mchar_0[ss_0]) ->
  145. ((linked malloc_0)) ->
  146. ((sconst mchar_0)) ->
  147. ((addr_le s_0 ss_0)) ->
  148. ((valid_rd malloc_0 ss_0 1)) ->
  149. (x_1 <= x_2) ->
  150. (exists i_3 : int. (p_Length_of_str_is mchar_0 malloc_0 s_0 i_3)) ->
  151. ((is_sint8 x_4)) ->
  152. ((is_sint8 mchar_0[{ s_0 with offset = i_1 + x_0 }])) ->
  153. ((is_sint8 mchar_0[{ s_0 with offset = i_0 + x_0 }])) ->
  154. ((addr_le ss_0 ({ s_0 with offset = x_0 + ((l_Length mchar_0 s_0)) }))) ->
  155. (forall i_3 : int. let x_5 = i_3 + x_0 in (0 <= i_3) -> (x_5 < x_2) ->
  156. (0 <> mchar_0[{ s_0 with offset = x_5 }])) ->
  157. (0 <> x_4)
  158.  
  159. end
  160.  
  161. (* ---------------------------------------------------------- *)
  162. (* --- Assertion 'rte,mem_access' (file strlen.c, line 14) --- *)
  163. (* ---------------------------------------------------------- *)
  164. theory VCstrlen_assert_rte_mem_access_2
  165.  
  166. use import bool.Bool
  167. use import int.Int
  168. use import int.ComputerDivision
  169. use import real.RealInfix
  170. use import qed.Arith
  171. use import map.Map
  172. use import memory.Memory
  173. use import Axiomatic.Axiomatic
  174. use import cint.Cint
  175. use import A_Length.A_Length
  176.  
  177. goal WP "expl:Assertion 'rte,mem_access' (file strlen.c, line 14)":
  178. forall i_1 i_0 : int.
  179. forall malloc_0 : map int int.
  180. forall mchar_0 : map addr int.
  181. forall s_0 ss_0 : addr.
  182. let x_0 = s_0.base in
  183. let x_1 = s_0.offset in
  184. ((linked malloc_0)) ->
  185. ((sconst mchar_0)) ->
  186. ((addr_le s_0 ss_0)) ->
  187. (exists i_2 : int. (p_Length_of_str_is mchar_0 malloc_0 s_0 i_2)) ->
  188. ((is_sint8 mchar_0[{ s_0 with offset = i_1 + x_1 }])) ->
  189. ((is_sint8 mchar_0[{ s_0 with offset = i_0 + x_1 }])) ->
  190. ((addr_le ss_0 ({ s_0 with offset = x_1 + ((l_Length mchar_0 s_0)) }))) ->
  191. (forall i_2 : int. let x_2 = i_2 + x_1 in (0 <= i_2) ->
  192. (x_2 < (ss_0.offset)) -> (0 <> mchar_0[{ s_0 with offset = x_2 }])) ->
  193. ((valid_rd malloc_0 ss_0 1))
  194.  
  195. end
  196.  
  197. (* ---------------------------------------------------------- *)
  198. (* --- Positivity of Loop variant at loop (file strlen.c, line 14) --- *)
  199. (* ---------------------------------------------------------- *)
  200. theory VCstrlen_loop_term_2_positive
  201.  
  202. use import bool.Bool
  203. use import int.Int
  204. use import int.ComputerDivision
  205. use import real.RealInfix
  206. use import qed.Arith
  207. use import map.Map
  208. use import memory.Memory
  209. use import Axiomatic.Axiomatic
  210. use import cint.Cint
  211. use import A_Length.A_Length
  212.  
  213. goal WP "expl:Positivity of Loop variant at loop (file strlen.c, line 14)":
  214. forall i_2 i_1 i_0 : int.
  215. forall malloc_0 : map int int.
  216. forall mchar_0 : map addr int.
  217. forall s_1 s_0 ss_0 : addr.
  218. let x_0 = s_0.base in
  219. let x_1 = s_0.offset in
  220. let x_2 = x_1 + ((l_Length mchar_0 s_0)) in
  221. let x_3 = ss_0.offset in
  222. (0 <> mchar_0[ss_0]) ->
  223. ((linked malloc_0)) ->
  224. ((sconst mchar_0)) ->
  225. ((addr_le s_0 ss_0)) ->
  226. ((valid_rd malloc_0 ss_0 1)) ->
  227. (exists i_3 : int. (p_Length_of_str_is mchar_0 malloc_0 s_0 i_3)) ->
  228. ((is_sint8 mchar_0[{ s_1 with offset = i_2 + (s_1.offset) }])) ->
  229. ((is_sint8 mchar_0[{ s_0 with offset = i_1 + x_1 }])) ->
  230. ((is_sint8 mchar_0[{ s_0 with offset = i_0 + x_1 }])) ->
  231. ((addr_le ss_0 ({ s_0 with offset = x_2 }))) ->
  232. (forall i_3 : int. let x_4 = i_3 + x_1 in (0 <= i_3) -> (x_4 < x_3) ->
  233. (0 <> mchar_0[{ s_0 with offset = x_4 }])) ->
  234. (x_3 <= x_2)
  235.  
  236. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement