Skip to content

Commit cf70021

Browse files
committed
feat(notations): add user-extensible notations
Adds a `notation` construct that lets users declare `#`-prefixed syntactic sugar for formulas, with template-based parsing and typing-time expansion. Notations are stored as operators (sharing abbreviation infrastructure), so they work uniformly with import/export, clone, locality, sections, qualified lookup, and `rewrite /#foo` unfolds. Declarations: notation #big ['a] #< i : 'a > (r : 'a list) (P : i ==> bool = predT) (F : i ==> t) "[" i " : " r ("| " P)? "] " F = big P F r. Uses: lemma L (d : 'a distr) (f : 'a -> real) J : uniq J => BRA.#big [ x : J ] (mu1 d x * f x).`1 <= 1%r. lemma M &m (bs : out_t list) : Dst.#big [ b : bs ] (Pr[A.guess() @ &m : res = b]) <= 1%r. (* slot placeholders work as pose / rewrite patterns *) pose c := #big [ _ : _ | _ ] _. Expansions round-trip back to template syntax in the pretty-printer. Includes a stdlib port: `#big` / `#bigi` are declared in Bigop.eca and used across algebra, analysis, distributions, modules, and crypto files. Tests under tests/notations/ (wired into `make unit`) and reference documentation under doc/notation.rst.
1 parent b5e92e0 commit cf70021

67 files changed

Lines changed: 2640 additions & 519 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config/tests.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ exclude = examples/MEE-CBC examples/old examples/old/list-ddh !examples/incomple
1414
okdirs = examples/MEE-CBC
1515

1616
[test-unit]
17-
okdirs = tests tests/exception
17+
okdirs = tests tests/exception tests/notations
18+
kodirs = tests/notations-ko

doc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ EasyCrypt reference manual
55
:maxdepth: 2
66

77
tactics
8+
notation

0 commit comments

Comments
 (0)