diff options
| author | Pierre-Marie Pédrot | 2018-12-18 10:21:00 +0100 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2018-12-18 10:21:00 +0100 |
| commit | 5dffdc66a47acd919c148e2e774252b4b4b51859 (patch) | |
| tree | 7e9e1d24af8749139d7f269adc638faffbcaf7de | |
| parent | 74313ad1ce4693ed197ada385edbdec2b7ce5a81 (diff) | |
| parent | c028333ee53d943f16bd30f1802afa1a313f857d (diff) | |
Merge PR #9160: Avoid user-given names in automatic introduction of binders
| -rw-r--r-- | CHANGES.md | 3 | ||||
| -rw-r--r-- | tactics/tactics.ml | 13 | ||||
| -rw-r--r-- | test-suite/bugs/closed/bug_8819.v | 2 |
3 files changed, 15 insertions, 3 deletions
diff --git a/CHANGES.md b/CHANGES.md index 4fafb9a18a..fe9f758597 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -90,6 +90,9 @@ Vernacular commands - `Arguments` now accepts names for arguments provided with `extra_scopes`. +- The naming scheme for anonymous binders in a `Theorem` has changed to + avoid conflicts with explicitly named binders. + Tools - The `-native-compiler` flag of `coqc` and `coqtop` now takes an argument which can have three values: diff --git a/tactics/tactics.ml b/tactics/tactics.ml index 0756344ba3..b1f2ceee57 100644 --- a/tactics/tactics.ml +++ b/tactics/tactics.ml @@ -1063,9 +1063,16 @@ let intros_replacing ids = (* The standard for implementing Automatic Introduction *) let auto_intros_tac ids = - Tacticals.New.tclMAP (function - | Name id -> intro_mustbe_force id - | Anonymous -> intro) (List.rev ids) + let fold used = function + | Name id -> Id.Set.add id used + | Anonymous -> used + in + let avoid = NamingAvoid (List.fold_left fold Id.Set.empty ids) in + let naming = function + | Name id -> NamingMustBe CAst.(make id) + | Anonymous -> avoid + in + Tacticals.New.tclMAP (fun name -> intro_gen (naming name) MoveLast true false) (List.rev ids) (* User-level introduction tactics *) diff --git a/test-suite/bugs/closed/bug_8819.v b/test-suite/bugs/closed/bug_8819.v new file mode 100644 index 0000000000..a4cb9dcd14 --- /dev/null +++ b/test-suite/bugs/closed/bug_8819.v @@ -0,0 +1,2 @@ +Theorem foo (_ : nat) (H : bool) : bool. +Proof. exact H. Qed. |
