| 1 |
Set Implicit Arguments. |
| 2 |
Unset Strict Implicit. |
| 3 |
|
| 4 |
(* Suggested by Pierre Casteran (BZ#169) *) |
| 5 |
(* Argument 3 is needed to typecheck and should be printed *) |
| 6 |
Definition compose (A B C : Set) (f : A -> B) (g : B -> C) (x : A) := g (f x). |
| 7 |
Check (compose (C:=nat) S). |
| 8 |
|
| 9 |
(* Better to explicitly display the arguments inferable from a |
| 10 |
position that could disappear after reduction *) |
| 11 |
Inductive ex (A : Set) (P : A -> Prop) : Prop := |
| 12 |
ex_intro : forall x : A, P x -> ex P. |
| 13 |
Check (ex_intro (P:=fun _ => True) (x:=0) I). |
| 14 |
|
| 15 |
(* Test for V8 printing of implicit by names *) |
| 16 |
Definition d1 y x (h : x = y :>nat) := h. |
| 17 |
Definition d2 x := d1 (y:=x). |
| 18 |
|
| 19 |
Print d2. |
| 20 |
|
| 21 |
Set Strict Implicit. |
| 22 |
Unset Implicit Arguments. |
| 23 |
|
| 24 |
(* Check maximal insertion of implicit *) |
| 25 |
|
| 26 |
Require Import TestSuite.list. |
| 27 |
|
| 28 |
Set Implicit Arguments. |
| 29 |
Set Maximal Implicit Insertion. |
| 30 |
|
| 31 |
Definition id (A:Type) (x:A) := x. |
| 32 |
|
| 33 |
Check map id (1::nil). |
| 34 |
|
| 35 |
Definition id' (A:Type) (x:A) := x. |
| 36 |
|
| 37 |
Arguments id' {A} x. |
| 38 |
|
| 39 |
Check map id' (1::nil). |
| 40 |
|
| 41 |
Unset Maximal Implicit Insertion. |
| 42 |
Unset Implicit Arguments. |
| 43 |
|
| 44 |
(* Check explicit insertion of last non-maximal trailing implicit to ensure *) |
| 45 |
(* correct arity of partiol applications *) |
| 46 |
|
| 47 |
Set Implicit Arguments. |
| 48 |
Definition id'' (A:Type) (x:A) := x. |
| 49 |
|
| 50 |
Check map (@id'' nat) (1::nil). |
| 51 |
|
| 52 |
Module MatchBranchesInContext. |
| 53 |
|
| 54 |
Set Implicit Arguments. |
| 55 |
Set Contextual Implicit. |
| 56 |
|
| 57 |
Inductive option A := None | Some (a:A). |
| 58 |
Coercion some_nat := @Some nat. |
| 59 |
Check fix f x := match x with 0 => None | n => some_nat n end. |
| 60 |
|
| 61 |
End MatchBranchesInContext. |
| 62 |
|
| 63 |
Module LetInContext. |
| 64 |
|
| 65 |
Set Implicit Arguments. |
| 66 |
Set Contextual Implicit. |
| 67 |
Axiom False_rect : forall A:Type, False -> A. |
| 68 |
Check fun x:False => let y:= False_rect (A:=bool) x in y. (* will not be in context: explicitation *) |
| 69 |
Check fun x:False => let y:= False_rect (A:=True) x in y. (* will be in context: no explicitation *) |
| 70 |
|
| 71 |
End LetInContext. |