Skip to content

Conversation

javierdiaz72
Copy link
Collaborator

This PR adds a fold operator to STS.

@javierdiaz72 javierdiaz72 added the enhancement New feature or request label Feb 8, 2025
@javierdiaz72 javierdiaz72 requested a review from WhatisRT February 8, 2025 17:31
@javierdiaz72 javierdiaz72 self-assigned this Feb 8, 2025
Copy link
Collaborator

@WhatisRT WhatisRT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a comment would be nice here. From what I can tell, if you have a relation that relates some states given some inputs, you can show that it if it holds for the states of a single step and with no step, then it also holds for arbitrarily many steps with the closure relation. It took me a few minutes to figure this out, so it'd be nice if the next person didn't have to.

module _ ⦃ _ : HasTransition Γ S I ⦄ where

fold : ∀ {ℓ} {γ : Γ} (P : List I → Rel S ℓ) →
(∀ {i is} → Trans (_⊢_—[ i ]→_ γ) (P is) (P (i ∷ is))) →
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
( {i is} Trans (_⊢_—[ i ]→_ γ) (P is) (P (i ∷ is))) →
( {i is} Trans (γ ⊢_—[ i ]→_) (P is) (P (i ∷ is))) →

I think this is more readable. You can do the same thing 2 lines below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly what I wanted to do but an error about ambiguous parsing showed up, although that happened in another context in which I first developed the function. So, I've just fixed it in 0760676.

@javierdiaz72
Copy link
Collaborator Author

I think a comment would be nice here. From what I can tell, if you have a relation that relates some states given some inputs, you can show that it if it holds for the states of a single step and with no step, then it also holds for arbitrarily many steps with the closure relation. It took me a few minutes to figure this out, so it'd be nice if the next person didn't have to.

Fixed in 20ec33c.

@javierdiaz72 javierdiaz72 merged commit 38c7aab into main Feb 10, 2025
1 check passed
@javierdiaz72 javierdiaz72 deleted the javierdiaz72/sts-fold branch February 10, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants