{"id":571,"date":"2014-05-15T10:43:31","date_gmt":"2014-05-15T10:43:31","guid":{"rendered":"http:\/\/www.lexicalscope.com\/blog\/?p=571"},"modified":"2014-05-15T10:44:41","modified_gmt":"2014-05-15T10:44:41","slug":"naming-quantifiers-in-dafny","status":"publish","type":"post","link":"https:\/\/www.lexicalscope.com\/blog\/2014\/05\/15\/naming-quantifiers-in-dafny\/","title":{"rendered":"Naming quantifiers in Dafny"},"content":{"rendered":"<p>It seems to help Dafny with instantiation of quantifiers during proofs if you give the quantified expression a name by encapsulating it in a predicate. If you don&#8217;t you can end up in a situation where you prove some quantified property, but are then unable to subsequently assert that quantified property, I think due to Dafny not understanding that the quantification is the same. Naming the property (or more likely, only writing it in one place rather than two places) fixes this. <\/p>\n<p>For example rather than writing:<\/p>\n<pre lang=\"foo\">\r\n   ...\r\n   ensures forall c :: P(a, c) == P(b, c);\r\n   ...\r\n   assert forall c :: P(a, c) == P(b, c);\r\n<\/pre>\n<p>Write this:<\/p>\n<pre lang=\"foo\">\r\n   predicate Q(a:S,b:S)\r\n   { forall c :: P(a, c) == P(b, c) }\r\n   ...\r\n   ensures Q(a, b);\r\n   ...\r\n   assert Q(a, b);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It seems to help Dafny with instantiation of quantifiers during proofs if you give the quantified expression a name by encapsulating it in a predicate. If you don&#8217;t you can end up in a situation where you prove some quantified &hellip; <a href=\"https:\/\/www.lexicalscope.com\/blog\/2014\/05\/15\/naming-quantifiers-in-dafny\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[15],"tags":[],"class_list":["post-571","post","type-post","status-publish","format-standard","hentry","category-dafny"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2e3P7-9d","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.lexicalscope.com\/blog\/wp-json\/wp\/v2\/posts\/571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lexicalscope.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lexicalscope.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lexicalscope.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lexicalscope.com\/blog\/wp-json\/wp\/v2\/comments?post=571"}],"version-history":[{"count":2,"href":"https:\/\/www.lexicalscope.com\/blog\/wp-json\/wp\/v2\/posts\/571\/revisions"}],"predecessor-version":[{"id":573,"href":"https:\/\/www.lexicalscope.com\/blog\/wp-json\/wp\/v2\/posts\/571\/revisions\/573"}],"wp:attachment":[{"href":"https:\/\/www.lexicalscope.com\/blog\/wp-json\/wp\/v2\/media?parent=571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lexicalscope.com\/blog\/wp-json\/wp\/v2\/categories?post=571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lexicalscope.com\/blog\/wp-json\/wp\/v2\/tags?post=571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}