feat: pretty print props with → only if domain is prop, add pp.foralls#7812
Merged
kmill merged 1 commit intoleanprover:masterfrom Apr 4, 2025
Merged
feat: pretty print props with → only if domain is prop, add pp.foralls#7812kmill merged 1 commit intoleanprover:masterfrom
→ only if domain is prop, add pp.foralls#7812kmill merged 1 commit intoleanprover:masterfrom
Conversation
…alls` This PR modifies the pretty printing of pi types. Now `∀` will be preferred over `→` for propositions if the domain is not a proposition. For example, `∀ (n : Nat), True` pretty prints as itself rather than as `Nat → True`. There is also now an option `pp.foralls` (default true) that when false disables using `∀` at all. This PR also adjusts instance implicit binder pretty printing; nondependent pi types won't show the instance binder name. Closes leanprover#1834.
ghost
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 4, 2025
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 4, 2025
|
Mathlib CI status (docs):
|
kmill
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 19, 2025
* fixes * fix test * fix * chore: adaptations for leanprover/lean4#7797 * stricter rfl check * fix merge * Trigger CI for leanprover/lean4#7797 * Trigger CI for leanprover/lean4#7797 * Trigger CI for leanprover/lean4#7797 * inverse construction * Update lean-toolchain for testing leanprover/lean4#7791 * lake update * Fix * Fix * Fix * chore: bump to nightly-2025-04-03 * more fixes * merge lean-pr-testing-6325 * bump proofwidgets * Update lean-toolchain for testing leanprover/lean4#7812 * shake * fix shake * fix tests * import mathlib.init * Update lean-toolchain for testing leanprover/lean4#7816 * Trigger CI for leanprover/lean4#7816 * Update lean-toolchain for testing leanprover/lean4#7802 * Fix * fixes * Fix (pending upstream changes) * Trigger CI for leanprover/lean4#7802 * fix * chore: bump to nightly-2025-04-04 * Fix * Fix * Fix * Fix * Fix * Fix * Update lean-toolchain for testing leanprover/lean4#7818 * Fix * Fix * Fix * Merge master into nightly-testing * Fix * Fix comments * fixes * Trigger CI for leanprover/lean4#7816 * fix * fix * missing doc-string? * chore: bump to nightly-2025-04-05 * chore: bump to nightly-2025-04-06 * move Batteries to nightly-testing * lake update * lint * fix * chore: bump to nightly-2025-04-07 * sprinkle noncomputable * fix: relativize file paths fix for leanprover/lean4#7822 * chore: reset cache * chore: bump to nightly-2025-04-07 * shake * fix: relativize more * Update lean-toolchain for testing leanprover/lean4#7856 * Update lean-toolchain for testing leanprover/lean4#7851 * Fix * Fix * Fix * Fix * chore: bump to nightly-2025-04-08 * Update lean-toolchain for testing leanprover/lean4#7870 * Trigger CI for leanprover/lean4#7870 * Trigger CI for leanprover/lean4#7870 * Trigger CI for leanprover/lean4#7870 * wip * Trigger CI for leanprover/lean4#7870 * . * chore: bump to nightly-2025-04-09 * Trigger CI for leanprover/lean4#7870 * . * bump * lake update * fixes for leanprover/lean4#7873 * fixes * deprecations * chore: bump to nightly-2025-04-10 * chore: `Option.zipWith` -> `Option.merge` * lake update * toolchain * fix * fix * Update lean-toolchain for testing leanprover/lean4#7897 * Trigger CI for leanprover/lean4#7897 * fix * lake update and fix * Fix * Fix * Trigger CI for leanprover/lean4#7897 * fix merge * chore: adaptations for nightly-2025-04-10 * chore: bump to nightly-2025-04-14 * fix * . * annotate changed goal state * fixes (adaptation notes) * cleanup imports * cleanup * Update lean-toolchain for testing leanprover/lean4#7933 * Fix * Fix * Update lean-toolchain for testing leanprover/lean4#7975 * remove adaptation notes * chore: bump to nightly-2025-04-16 --------- Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Kim Morrison <kim@tqft.net> Co-authored-by: Markus Himmel <markus@lean-fro.org> Co-authored-by: Rob23oba <robin.arnez@web.de> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Johan Commelin <johan@commelin.net> Co-authored-by: github-actions <github-actions@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR modifies the pretty printing of pi types. Now
∀will be preferred over→for propositions if the domain is not a proposition. For example,∀ (n : Nat), Truepretty prints as∀ (n : Nat), Truerather than asNat → True. There is also now an optionpp.foralls(default true) that when false disables using∀at all, for pedagogical purposes. This PR also adjusts instance implicit binder pretty printing — nondependent pi types won't show the instance binder name. Closes #1834.The linked RFC also suggests using
_for binder names in case of non-dependance. We're tabling that idea. Potentially it is useful for hygienic names; this could improve howNat → Truepretty prints as∀ (a : Nat), True, with thisathat's chosen by implication notation elaboration. Relatedly, this PR exposes even further the issue where binder names are reused in a confusing way. Consider:Nat → Nat → (a : Nat) → a = apretty prints as∀ (a a a : Nat), a = a.