Skip to content

Suggestion with Preserves for two predicates #2909

@mechvel

Description

@mechvel

lib-2.3 has Preserves for the pair of a binary relation and a map.
But such is also needed for one or two predicates.
For example, I define

Preserves11 :     ∀ {β p q}{B : Set β} → (A → B) → Pred A p → Pred B q → Set _                  
Preserves11 f P Q =  ∀ {x} → P x → Q (f x)                                      
                                                                                
_Preserves_ :  ∀ {p} → (A → A) → Pred A p → Set (α ⊔ p)                         
f Preserves P =  ∀ {x} → P x → P (f x)                                          

For example, Preserves11 Integer.+_ Even-ℕ Even-ℤ

means (if {n : ℕ} is even, then (+ n) : ℤ is even in ℤ).

And this cannot be named Respects* or Congruent* due to the library style.
May this have sense for Standard library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fairbairn thresholdThe contribution is 'too small' to merit the overheadadditiondiscoverabilityHow easy/hard will it be for users to find, within the context of their application?library-design

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions