-
Notifications
You must be signed in to change notification settings - Fork 21
Switch to the standard type for relations. #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lemma Relation.ReflTransGen.diamond_extend (h : Diamond R) : | ||
Relation.ReflTransGen R A B → | ||
R A C → | ||
lemma Relation.ReflTransGen.diamond_extend (h : Diamond R) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these identified by a linter? If so, can we enable this by default/include it in a workflow check?
/-- Inverse of a relation. -/ | ||
def Relation.inv (r : α → β → Prop) : β → α → Prop := flip r | ||
|
||
-- /-- Composition of two relations. -/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented out definition?
(r1 r2 : Rel State State) (h1 : Simulation lts r1) (h2 : Simulation lts r2) : | ||
Simulation lts (r1.comp r2) := by | ||
(r1 r2 : State → State → Prop) (h1 : Simulation lts r1) (h2 : Simulation lts r2) : | ||
Simulation lts (Relation.Comp r1 r2) := by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Relation.Comp
have a notation? If so, that would be preferred here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question regarding the usage of Relation.inv
.
constructor | ||
case left => | ||
simp only [Rel.comp] | ||
simp only [Relation.Comp] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All uses of simp only [Relation.Comp]
in this file are not needed.
constructor | ||
· exact h2'tr | ||
· simp [Rel.comp] | ||
· simp only [Relation.Comp] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All uses of simp only [Relation.Comp]
in this file are not needed.
/-- Union of two relations. -/ | ||
def Relation.union (r s : α → β → Prop) : α → β → Prop := | ||
fun x y => r x y ∨ s x y | ||
|
||
instance {α : Type u} {β : Type v} : Union (α → β → Prop) where | ||
union := Relation.union |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mathlib already provides this with ⊔
notation
/-- The identity relation. -/ | ||
inductive Relation.Id : α → α → Prop where | ||
| id {x : α} : Id x x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is Eq
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's a surprising name from the textbooks I'm used to. Thanks for pointing it out, I'd been naively looking for Id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it's because I was looking for it in mathlib as a Rel
a long time ago.. the Eq
from Lean is of course what I want. Adopting it is even simplifying some proofs!
* Switch to the standard type for relations. * Missing changes
This PR creates a new
Cslib.Data.Relation
file with some utilities and a union notation for relations, merging the previous filesCslib.Utils.Rel
andCslib.Utils.Relation
(now deleted).It removes all dependencies of the recently-changed
Rel
type from mathlib, in preparation for bumping our mathlib dependency.I'm a bit in doubt as to the name styling for definitions such as 'Relation.inv' and 'Relation.union'. In mathlib, they are uppercased for
Relation
but lowercased forRel
, I guess because forRelation
one knows that the final type isProp
. It is however a bit weird.