feat: add language interface#323
Draft
ayhon wants to merge 19 commits intoleanprover-community:masterfrom
Draft
Conversation
Further context found in the following Zulip conversation. https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/Did.20coercions.20stop.20being.20printed.20with.20.60.E2.86.91.60.3F/with/587821793
In the end, it seems like around `40` is quite a good precedence level. If we look at `Notation.lean`, we see the precedence levels of various notations. ``` @[inherit_doc] infixr:90 " ∘ " => Function.comp @[inherit_doc] infixr:35 " × " => Prod @[inherit_doc] infixr:35 " ×' " => PProd @[inherit_doc] infix:50 " ∣ " => Dvd.dvd @[inherit_doc] infixl:55 " ||| " => HOr.hOr @[inherit_doc] infixl:58 " ^^^ " => HXor.hXor @[inherit_doc] infixl:60 " &&& " => HAnd.hAnd @[inherit_doc] infixl:65 " + " => HAdd.hAdd @[inherit_doc] infixl:65 " - " => HSub.hSub @[inherit_doc] infixl:70 " * " => HMul.hMul @[inherit_doc] infixl:70 " / " => HDiv.hDiv @[inherit_doc] infixl:70 " % " => HMod.hMod @[inherit_doc] infixl:75 " <<< " => HShiftLeft.hShiftLeft @[inherit_doc] infixl:75 " >>> " => HShiftRight.hShiftRight @[inherit_doc] infixr:80 " ^ " => HPow.hPow @[inherit_doc] infixl:65 " ++ " => HAppend.hAppend @[inherit_doc] prefix:75 "-" => Neg.neg @[inherit_doc] prefix:100 "~~~" => Complement.complement @[inherit_doc] postfix:max "⁻¹" => Inv.inv @[inherit_doc] infixr:73 " • " => HSMul.hSMul ``` If we take further into account that the precedence of the arrow `→` is `25`, then my earlier choice of `40` makes it weaker than all other usual operators, but still stronger than implication, which is roughly where I wanted to place it.
One actually cannot make the definition of `NSteps` use `Iterate` because `Step` is a tagged relation, and `Iterate` does not support merging the observations between `Step`s.
Actually, we can see `List Obs` to be the free monoid of `Obs`, so we don't actually gain any expressivity by changing the definition. Maybe it would make for a nicer API, but it doesn't warrant making the change at this stage.
e160189 to
6828180
Compare
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
Port the file
program_logic/language.v. I needed to make multiple changes to the file while porting, since the Rocq definition was using canonical structures, which is something that doesn't exist in Lean. This interface instead relies on various typeclasses, and assumptions about them (for instance, oneExprmay only have oneVal,StateandObstypes associated, since they are marked asoutParams).Main differences:
languagestructure is now aLanguagetypeclass, which embeds separateToValandPrimSteptypeclasses.ofVal, with most relevant theorems defined in terms of it (SUBJECT TO CHANGE).primStepnotation now makes use of a productExpr x Stateinstead of taking them as separate parameters.Some other changes needed to implement this file
Relation.ReflTransGenfrom Mathlib.Relation.Iterateconstruction.Forall₂.Checklist
PORTING.mdas appropriateauthorssection of any appropriate files