[RFC] Implement Boolean-to-Prop coercion using `Bool.asProp`
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
A while ago, Sebastian suggested[1] that we should redefine the Boolean-to-Prop coercion using a dedicated function. This recently came up again[3] because we're porting material about List.filter, which is now defined on Booleans and thus exercises the coercion heavily.
def Bool.asProp (b : Bool) : Prop :=
b = true
instance : Coe Bool Prop where
coe := Bool.asProp
Pros:
- No accidental simplification of
¬ b = truetob = false(which requires duplication of simp lemmas). decide b = bis defeq (after #2038)- Pretty-printing and
norm_castwork out-of-the-box.
Cons:
simp only [h]no longer works as well for a hypothesish : bwithb : Bool.
Original proposal: [1] https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/rfc.3A.20theorem.20names/near/240161960
Other threads:
[2] https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/BEq.20Subtype/near/296650727
[3] https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Prop.20-.3E.20Bool.20regression/near/321996465
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed Bool.asProp definition and the existing Boolean-to-Prop coercion. The issue names no files, tests, or entry points, so locate the coercion implementation and related tests before deciding how the listed pros and cons affect the design. Done means implementing the coercion with Bool.asProp and validating the behavior described in the proposal.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100