Skip to content
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

Refactoring uses of with #2123

Open
3 tasks
jamesmckinna opened this issue Oct 5, 2023 · 0 comments
Open
3 tasks

Refactoring uses of with #2123

jamesmckinna opened this issue Oct 5, 2023 · 0 comments

Comments

@jamesmckinna
Copy link
Contributor

jamesmckinna commented Oct 5, 2023

Cf. #1937

As well as removing 'redundant' uses of with, it seems worth flagging as a separate issue the need/desire to exploit the (idiomatics of the) extended capabilities of with notation throughout the library. Specifically:

  • use of nested with esp. in conjunction with the next idiom, irrefutable with, building up a cascade of dependent inversions until the final RHS proof term may be assembled from the resulting pieces;
  • use of 'irrefutable' with: with <pat> ← <exp> = ... which avoids having to uncouple the sub-expression <exp> from the single matching clause ... | <pat> = ... with which the definition then proceeds; there are three distinguished special cases of this, according to the form of <pat>:
  • () or more generally, <constructor> (<constructor>... ()...), as a (convenient?) drop-in replacement for more explicit appeals to ⊥-elim or Relation.Nullary.Negation.Core.contradiction;
  • refl: such uses seem strictly to extend the capability of rewrite <exp> for an <exp> of type s ≡ t;
  • <pat1> , <pat2> , ... , <patn> (and record constructors more generally) for extended/nested Σ-types; the advantages being that parentheses around the pattern are frequently redundant clutter, but also that such uses may often also permit simplification in the form of replacing the use of an irrefutable with pattern with a let <pat1> , <pat2> , ... , <patn> = <exp> in ... binding instead;
  • the use of with <exp> in <eq>: this is perhaps more controversial, given the ongoing saga of this notation not precisely offering a drop-in replacement for the hoped-to-be-deprecated inspect idiom; nevertheless, all uses of inspect have been successfully removed from the library, so the use of this extended form is encouraged where possible;

Other features/idioms as they arise... with the proposal that at some point (v2.1? v3.0?) we systematically weed out the redundant uses of with and refactor to take advantage of the above.

github-merge-queue bot pushed a commit that referenced this issue Apr 19, 2024
…) (#2361)

* `with`-free definitions plus tests

* `CHANGELOG`

* use `foldr` on @JacquesCarette 's solution

* tidied up unsolved metas

* factrored out comparison as removable module `MapMaybeTest`

* tidied up; removed `mapMaybeTest`

* tidied up; removed v2.1 deprecation section

* tidy up long line

* Update src/Data/List/Base.agda

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>

* @gallais 's comments

* Update src/Data/List/Base.agda

Oops!

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>

---------

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
github-merge-queue bot pushed a commit that referenced this issue Apr 20, 2024
#2364)

* `with`-free definition of `unfold`

* fixed previous commit
github-merge-queue bot pushed a commit that referenced this issue Apr 22, 2024
…2365)

* refactor towards `if_then_else_` and away from `yes`/`no`

* reverted chnages to `derun` proofs

* undo last reversion!

* layout
github-merge-queue bot pushed a commit that referenced this issue Jun 5, 2024
)

* refactor towards `if_then_else_`

* layout

* `let` into `where`
jamesmckinna added a commit to jamesmckinna/agda-stdlib that referenced this issue Jul 1, 2024
…th` agda#2123) (agda#2365)"

This reverts commit 438f9ed.

Specifically, it restores `with`-based definitions of the
`Decidable`-definable functions on `List`s, incl. `filter`
Fixes agda#2415
github-merge-queue bot pushed a commit that referenced this issue Jul 5, 2024
…2123) (#2365)" (#2423)

This reverts commit 438f9ed.

Specifically, it restores `with`-based definitions of the
`Decidable`-definable functions on `List`s, incl. `filter`
Fixes #2415
andreasabel pushed a commit that referenced this issue Jul 10, 2024
…) (#2361)

* `with`-free definitions plus tests

* `CHANGELOG`

* use `foldr` on @JacquesCarette 's solution

* tidied up unsolved metas

* factrored out comparison as removable module `MapMaybeTest`

* tidied up; removed `mapMaybeTest`

* tidied up; removed v2.1 deprecation section

* tidy up long line

* Update src/Data/List/Base.agda

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>

* @gallais 's comments

* Update src/Data/List/Base.agda

Oops!

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>

---------

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
andreasabel pushed a commit that referenced this issue Jul 10, 2024
#2364)

* `with`-free definition of `unfold`

* fixed previous commit
andreasabel pushed a commit that referenced this issue Jul 10, 2024
…2365)

* refactor towards `if_then_else_` and away from `yes`/`no`

* reverted chnages to `derun` proofs

* undo last reversion!

* layout
andreasabel pushed a commit that referenced this issue Jul 10, 2024
)

* refactor towards `if_then_else_`

* layout

* `let` into `where`
andreasabel pushed a commit that referenced this issue Jul 10, 2024
…2123) (#2365)" (#2423)

This reverts commit 438f9ed.

Specifically, it restores `with`-based definitions of the
`Decidable`-definable functions on `List`s, incl. `filter`
Fixes #2415
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant