Skip to content

feat: update operation for FinFun#470

Open
fmontesi wants to merge 11 commits intomainfrom
finfun-update
Open

feat: update operation for FinFun#470
fmontesi wants to merge 11 commits intomainfrom
finfun-update

Conversation

@fmontesi
Copy link
Copy Markdown
Collaborator

@fmontesi fmontesi commented Apr 6, 2026

This PR adds FinFun.update and proves some basic results about the functional interface and support of the resulting function.

@fmontesi fmontesi requested a review from chenson2018 as a code owner April 6, 2026 12:15
Comment thread Cslib/Foundations/Data/FinFun/Update.lean Outdated
Comment thread Cslib/Foundations/Data/FinFun/Update.lean Outdated
@fmontesi
Copy link
Copy Markdown
Collaborator Author

fmontesi commented Apr 8, 2026

All done!

Copy link
Copy Markdown
Collaborator

@chenson2018 chenson2018 left a comment

Choose a reason for hiding this comment

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

Some small style comments and a couple of issues with grind maintainability.

Comment thread Cslib/Foundations/Data/FinFun/Update.lean Outdated
Comment thread Cslib/Foundations/Data/FinFun/Update.lean Outdated
Comment thread Cslib/Foundations/Data/FinFun/Update.lean Outdated
/-- `FinFun` equivalent of `Function.update`. -/
def update [Zero β] [DecidableEq α] [DecidableEqZero β] (f : α →₀ β) (a : α) (b : β) :
α →₀ β where
fn := Function.update f.fn a b
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe preferred to write

Suggested change
fn := Function.update f.fn a b
fn := Function.update f a b

since we usually use the coercion?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Interesting point.
I'm ok either way, but isn't it a bit weird that the way it's used (so the 'API', one might say) affects the way it's defined? This is the most natural definition since it's an operation to modify the structure, so it's ok to know about its internal implementation.

Comment thread Cslib/Foundations/Data/FinFun/Update.lean Outdated
Comment thread Cslib/Foundations/Data/FinFun/Update.lean
Comment thread Cslib/Foundations/Data/FinFun/Update.lean Outdated
Comment thread Cslib/Foundations/Data/FinFun/Update.lean Outdated
Copy link
Copy Markdown
Collaborator

@ctchou ctchou left a comment

Choose a reason for hiding this comment

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

LGTM.

fmontesi and others added 5 commits April 14, 2026 15:30
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
@fmontesi
Copy link
Copy Markdown
Collaborator Author

@chenson2018 Should be fine now. I kept grind in some places but checked that grind? worked. Unless we want to preferrably use grind only now? (Will wait for the link to the discussion first.)

@fmontesi fmontesi requested a review from chenson2018 April 18, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants