feat: deprecate Iris/Std/Classes.lean and reuse definitions from core libraries#518
Open
alvinylt wants to merge 6 commits into
Open
feat: deprecate Iris/Std/Classes.lean and reuse definitions from core libraries#518alvinylt wants to merge 6 commits into
alvinylt wants to merge 6 commits into
Conversation
alvinylt
commented
Jul 15, 2026
| applyReflexivity (goal : MVarId) : TacticM Unit := do | ||
| try | ||
| discard <| apply' goal ``refl | ||
| discard <| apply' goal ``Std.Refl.refl |
Contributor
Author
There was a problem hiding this comment.
Relevant to the discussions: https://leanprover.zulipchat.com/#narrow/channel/490604-iris-lean
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.
Description
Addresses #468.
This PR involves four commits, one for each set of changes.
The first commit removes the type classes
ReflexiveandTransitivefromIris/Std/Classes.leanand replaces them withReflinInit/Core.leanandTransinInit/Prelude.lean, respectively.Preorderremains inIris/Std/Classes.leanand adjusted to use the built-in type classes.BIBase.Entails.rflinBI.leanwith@[refl], we are able to use the tacticrflto tackle goals in the formP ⊢ Pas an alternative toby apply .rfl.The second commit eliminates the custom type class
Preorderand replaces it withIsPreorderinInit/Data/Order/Classes.lean. In fact, the type classIsPreorderis relatively new (see Lean 4.25.0 documentation).IsPreorderto work forBI PROP, there must be an instance ofLE PROP. At this point my approach was to extend the type classBIBase:⊢) is now definitionally equal to≤in the type classLE, which meanssimpmay possibly unfold⊢as≤, and the@[refl]annotation introduced in the first commit would not achieve its purpose becauserflwould require the@[refl]annotation directly for≤.The third commit addresses the problem with
LE PROPin a different way.BIBaseand havingStd.IsPreorder PROPas a field ofBI, we instead have the bare propositions of reflexivity and transitivity as two fields ofBI:entails_refl {P : PROP} : P ⊢ P entails_trans {P Q R : PROP} : (P ⊢ Q) → (Q ⊢ R) → P ⊢ RLE PROPandIsPreorder PROPas separate instances in terms ofentails_reflandentails_trans. This is more consistent with how other Lean code is organised.⊢as≤in the previous commit.The fourth commit eliminates
Iris/Std/Classes.leanentirely.BI/DerivedLaws.leanusing definitions fromIris/Std/Classes.lean. There are similar type classes for commutativity, associativity, antisymmetry,LeftAbsorb,RightAbsorb,LeftIdandRightIdinInit/Core.lean, but they are expressed in terms of equality rather than bi-entailment.BI/DerivedLaws.leanout until the built-in type classes are compatible with this use case, rather than using a mixture of built-in type classes and custom, more generic type classes. (Perhaps ongoing development regarding bi-entailment as equality might help?)Iris/Std/Classes.leandefines the notation⊤for the top element for instances of the type classTop. This is used only once inCoPset.lean, so I moved to the notation there.Similarly, the notationThe notation##for disjointness is used only once inGenSets.leanand thus defined there directly.##for disjointness is used inGenSets.leanandNamespaces.lean.Remarks
Step-indexing (PR #515) further involves irreflexivity, total relations and strict orders. At the moment, I have introduced these three new definitions into
Iris/Std/Classes.lean. If we decide to deprecateIris/Std/Classes.lean, we can directly useirreflandtotalfromInit/Core.lean, as well asIsPartialOrderfromInit/Data/Order/Classes.lean. Not aware that a type class for strict orders (irreflexivity + transitivity) exists though.Would be great to discuss whether to adopt any of these changes.
Checklist
authorssection of any appropriate files