Skip to content
Snippets Groups Projects

Add `filter_reverse`, `head_filter_Some`, `last_filter_Some` lemmas

Merged Jonas Kastberg requested to merge jihgfee/stdpp:last_filter_postfix into master

Added the lemma:

Lemma last_filter_postfix P `{!∀ x : A, Decision (P x)} l x
  last (filter P l) = Some x 
   l1 l2, l = l1 ++ [x] ++ l2  Forall (λ z, ¬ (P z)) l2.

(and its counterpart for head)

The lemmas seem useful and general enough to fit in stdpp. The last lemma derives the property Forall (λ z, ¬ (P z)) l2 of the postfix of a split l1 ++ [x] ++ l2 for a list l whenever last (filter P l) = Some x.

Edited by Robbert Krebbers

Merge request reports

Merge request pipeline #60087 passed

Merge request pipeline passed for 3ada2331

Approval is optional

Merged by Robbert KrebbersRobbert Krebbers 3 years ago (Jan 19, 2022 9:39am UTC)

Merge details

  • Changes merged into master with 9cd8ad3c (commits were squashed).
  • Did not delete the source branch.

Pipeline #60301 passed

Pipeline passed for 9cd8ad3c on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Thanks for the MR. Could you split it up into two parts:

    • One for the general lemmas about last (which I think are good, modulo comments).
    • One for the interaction of filter and last (we might need some additional debating there as you already guessed :smile:).
    Edited by Robbert Krebbers
  • Jonas Kastberg added 1 commit

    added 1 commit

    • f491810c - Some improvements for proposed lemmas and added [last_app]

    Compare with previous version

  • Jonas Kastberg mentioned in merge request !355 (merged)

    mentioned in merge request !355 (merged)

  • Jonas Kastberg added 3 commits

    added 3 commits

    • 095fc4ef - Added some useful lemmas for the [last] function
    • 87eb1296 - Added explicit names of variables for induction tactic
    • f8144839 - Added [last_filter_postfix] lemma

    Compare with previous version

  • Jonas Kastberg added 9 commits

    added 9 commits

    Compare with previous version

  • Jonas Kastberg added 1 commit

    added 1 commit

    • ecee5998 - Removed overly specialised lemma

    Compare with previous version

  • Jonas Kastberg added 1 commit

    added 1 commit

    Compare with previous version

  • Jonas Kastberg added 1 commit

    added 1 commit

    • ee9589c8 - Added [last_filter_postfix] lemma

    Compare with previous version

  • Jonas Kastberg resolved all threads

    resolved all threads

  • Jonas Kastberg added 1 commit

    added 1 commit

    Compare with previous version

  • Jonas Kastberg added 1 commit

    added 1 commit

    • c5900b79 - Added [head_filter_prefix] lemma, and dependencies

    Compare with previous version

  • Jonas Kastberg added 1 commit

    added 1 commit

    • fe795bf4 - Moved the [head_filter_prefix] and [last_filter_postfix] lemmas

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading