diff options
| author | Hugo Herbelin | 2016-07-19 13:19:34 +0200 |
|---|---|---|
| committer | Hugo Herbelin | 2016-07-19 13:45:23 +0200 |
| commit | f7ae4e6433e44a0b3a838847c58ab72ffffa3d48 (patch) | |
| tree | f05d58a6f51c77ce890452ff00babd8cadf2e990 /test-suite | |
| parent | a67bd7f93224c61b6a59459ea1114a6670daa857 (diff) | |
Some extra fixes in printing patterns in binders.
- typo in notation_ops.ml
- factorization of patterns in ppconstr.ml
- update of test-suite
- printing of cast of a binding pattern if in mode "printing all"
The question of whether or not to print the type of a binding pattern
by default seems open to me.
Diffstat (limited to 'test-suite')
| -rw-r--r-- | test-suite/output/PatternsInBinders.out | 22 | ||||
| -rw-r--r-- | test-suite/output/PatternsInBinders.v | 32 |
2 files changed, 36 insertions, 18 deletions
diff --git a/test-suite/output/PatternsInBinders.out b/test-suite/output/PatternsInBinders.out index 6acaa0ccec..c012a86b01 100644 --- a/test-suite/output/PatternsInBinders.out +++ b/test-suite/output/PatternsInBinders.out @@ -9,23 +9,31 @@ proj_informative = fun '(exist _ x _) => x : A foo = fun '(Bar n b tt p) => if b then n + p else n - p : Foo -> nat baz = -fun '(Bar n1 _ tt p1) => fun '(Bar _ _ tt _) => n1 + p1 +fun '(Bar n1 _ tt p1) '(Bar _ _ tt _) => n1 + p1 : Foo -> Foo -> nat -λ '(x, y), (y, x) - : A * B → B * A -∀ '(x, y), swap (x, y) = (y, x) - : Prop swap = -fun (A B : Type) (pat : A * B) => let '(x, y) := pat in (y, x) +fun (A B : Type) '(x, y) => (y, x) : forall A B : Type, A * B -> B * A Arguments A, B are implicit and maximally inserted Argument scopes are [type_scope type_scope _] -forall (A B : Type) (pat : A * B), let '(x, y) := pat in swap (x, y) = (y, x) +fun (A B : Type) '(x, y) => swap (x, y) = (y, x) + : forall A B : Type, A * B -> Prop +forall (A B : Type) '(x, y), swap (x, y) = (y, x) : Prop exists '(x, y), swap (x, y) = (y, x) : Prop +exists '(x, y) '(z, w), swap (x, y) = (z, w) + : Prop +λ '(x, y), (y, x) + : A * B → B * A +∀ '(x, y), swap (x, y) = (y, x) + : Prop both_z = fun pat : nat * nat => let '(n, p) as pat0 := pat return (F pat0) in (Z n, Z p) : F (n, p) : forall pat : nat * nat, F pat +fun '(x, y) '(z, t) => swap (x, y) = (z, t) + : A * B -> B * A -> Prop +forall '(x, y) '(z, t), swap (x, y) = (z, t) + : Prop diff --git a/test-suite/output/PatternsInBinders.v b/test-suite/output/PatternsInBinders.v index 8911909abc..b5c91e347b 100644 --- a/test-suite/output/PatternsInBinders.v +++ b/test-suite/output/PatternsInBinders.v @@ -21,7 +21,20 @@ Print foo. Definition baz '(Bar n1 b1 tt p1) '(Bar n2 b2 tt p2) := n1+p1. Print baz. -(** Some test involving unicode noations. *) +Module WithParameters. + +Definition swap {A B} '((x,y) : A*B) := (y,x). +Print swap. + +Check fun (A B:Type) '((x,y) : A*B) => swap (x,y) = (y,x). +Check forall (A B:Type) '((x,y) : A*B), swap (x,y) = (y,x). + +Check exists '((x,y):A*A), swap (x,y) = (y,x). +Check exists '((x,y):A*A) '(z,w), swap (x,y) = (z,w). + +End WithParameters. + +(** Some test involving unicode notations. *) Module WithUnicode. Require Import Coq.Unicode.Utf8. @@ -31,24 +44,21 @@ Module WithUnicode. End WithUnicode. - (** * Suboptimal printing *) -(** These tests show examples which expose the [let] introduced by - the pattern notation in binders. *) - Module Suboptimal. -Definition swap {A B} '((x,y) : A*B) := (y,x). -Print swap. - -Check forall (A B:Type) '((x,y) : A*B), swap (x,y) = (y,x). - -Check exists '((x,y):A*A), swap (x,y) = (y,x). +(** This test shows an example which exposes the [let] introduced by + the pattern notation in binders. *) Inductive Fin (n:nat) := Z : Fin n. Definition F '(n,p) : Type := (Fin n * Fin p)%type. Definition both_z '(n,p) : F (n,p) := (Z _,Z _). Print both_z. +(** These tests show examples which do not factorize binders *) + +Check fun '((x,y) : A*B) '(z,t) => swap (x,y) = (z,t). +Check forall '(x,y) '((z,t) : B*A), swap (x,y) = (z,t). + End Suboptimal. |
