# HG changeset patch # User haftmann # Date 1457467666 -3600 # Node ID 7a9aa69f9b388aadf5f07a8ac84a4500554d9214 # Parent 656e9653c645f676a1688a5985d36e39d4d2a0de syntax for multiset membership modelled after syntax for set membership diff -r 656e9653c645 -r 7a9aa69f9b38 NEWS --- a/NEWS Mon Mar 07 23:20:11 2016 +0100 +++ b/NEWS Tue Mar 08 21:07:46 2016 +0100 @@ -54,7 +54,6 @@ resemble the f.split naming convention, INCOMPATIBILITY. * Multiset membership is now expressed using set_mset rather than count. -ASCII infix syntax ":#" has been discontinued. - Expressions "count M a > 0" and similar simplify to membership by default. diff -r 656e9653c645 -r 7a9aa69f9b38 src/HOL/Library/Multiset.thy --- a/src/HOL/Library/Multiset.thy Mon Mar 07 23:20:11 2016 +0100 +++ b/src/HOL/Library/Multiset.thy Tue Mar 08 21:07:46 2016 +0100 @@ -113,11 +113,27 @@ definition set_mset :: "'a multiset \ 'a set" where "set_mset M = {x. count M x > 0}" -abbreviation Melem :: "'a \ 'a multiset \ bool" (infix "\#" 50) - where "a \# M \ a \ set_mset M" - -abbreviation not_Melem :: "'a \ 'a multiset \ bool" (infix "\#" 50) - where "a \# M \ a \ set_mset M" +abbreviation Melem :: "'a \ 'a multiset \ bool" + where "Melem a M \ a \ set_mset M" + +notation + Melem ("op \#") and + Melem ("(_/ \# _)" [51, 51] 50) + +notation (ASCII) + Melem ("op :#") and + Melem ("(_/ :# _)" [51, 51] 50) + +abbreviation not_Melem :: "'a \ 'a multiset \ bool" + where "not_Melem a M \ a \ set_mset M" + +notation + not_Melem ("op \#") and + not_Melem ("(_/ \# _)" [51, 51] 50) + +notation (ASCII) + not_Melem ("op ~:#") and + not_Melem ("(_/ ~:# _)" [51, 51] 50) context begin @@ -134,6 +150,10 @@ "_MBall" :: "pttrn \ 'a set \ bool \ bool" ("(3\_\#_./ _)" [0, 0, 10] 10) "_MBex" :: "pttrn \ 'a set \ bool \ bool" ("(3\_\#_./ _)" [0, 0, 10] 10) +syntax (ASCII) + "_MBall" :: "pttrn \ 'a set \ bool \ bool" ("(3\_:#_./ _)" [0, 0, 10] 10) + "_MBex" :: "pttrn \ 'a set \ bool \ bool" ("(3\_:#_./ _)" [0, 0, 10] 10) + translations "\x\#A. P" \ "CONST Multiset.Ball A (\x. P)" "\x\#A. P" \ "CONST Multiset.Bex A (\x. P)"