Skip to content

Commit 269ea40

Browse files
committed
chore(Tactic): rewrite subsingleton tactic docstring (leanprover-community#38294)
This PR rewrites the docstrings for the `subsingleton` tactic, to consistently match the [official style guide](https://github.com/leanprover/lean4/blob/master/doc/style.md#tactics), to make sure they are complete while not getting too long. The remark about `Sort _` being set to `Sort 0` by `apply Subsingleton.elim` does not seem to be true anymore, so I removed it. Co-authored-by: Anne C.A. Baanen <vierkantor@vierkantor.com>
1 parent 3a429d2 commit 269ea40

1 file changed

Lines changed: 10 additions & 23 deletions

File tree

Mathlib/Tactic/Subsingleton.lean

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -108,34 +108,21 @@ def Lean.MVarId.subsingleton (g : MVarId) (insts : Array (Term × AbstractMVarsR
108108
namespace Mathlib.Tactic
109109

110110
/--
111-
The `subsingleton` tactic tries to prove a goal of the form `x = y` or `x ≍ y`
112-
using the fact that the types involved are *subsingletons*
113-
(a type with exactly zero or one terms).
114-
To a first approximation, it does `apply Subsingleton.elim`.
115-
As a nicety, `subsingleton` first runs the `intros` tactic.
116-
117-
- If the goal is an equality, it either closes the goal or fails.
118-
- `subsingleton [inst1, inst2, ...]` can be used to add additional `Subsingleton` instances
119-
to the local context. This can be more flexible than
120-
`have := inst1; have := inst2; ...; subsingleton` since the tactic does not require that
121-
all placeholders be solved for.
111+
`subsingleton` proves the main goal of the form `∀ a ... b, x = y` or `∀ a ... b, x ≍ y` using the
112+
fact that the type(s) of `x` and `y` are *subsingletons* (a type with exactly zero or one elements).
113+
If `subsingleton` cannot close the goal, it fails.
122114
123115
Techniques the `subsingleton` tactic can apply:
124116
- proof irrelevance
125117
- heterogeneous proof irrelevance (via `proof_irrel_heq`)
126118
- using `Subsingleton` (via `Subsingleton.elim`)
127-
- proving `BEq` instances are equal if they are both lawful (via `lawful_beq_subsingleton`)
128-
129-
### Properties
130-
131-
The tactic is careful not to accidentally specialize `Sort _` to `Prop`,
132-
avoiding the following surprising behavior of `apply Subsingleton.elim`:
133-
```lean
134-
example (α : Sort _) (x y : α) : x = y := by apply Subsingleton.elim
135-
```
136-
The reason this `example` goes through is that
137-
it applies the `∀ (p : Prop), Subsingleton p` instance,
138-
specializing the universe level metavariable in `Sort _` to `0`.
119+
- proving instances of the type `BEq α` are equal if they are both lawful
120+
(via `lawful_beq_subsingleton`)
121+
122+
* `subsingleton [inst1, inst2, ...]` can be used to add additional `Subsingleton` instances
123+
to the local context. This can be more flexible than
124+
`have := inst1; have := inst2; ...; subsingleton` since the tactic does not require that
125+
all placeholders be solved for.
139126
-/
140127
syntax (name := subsingletonStx) "subsingleton" (ppSpace "[" term,* "]")? : tactic
141128

0 commit comments

Comments
 (0)