Filters - alternative to the base of Domain theory#2829
Filters - alternative to the base of Domain theory#2829gabriellisboaconegero wants to merge 3 commits intoagda:masterfrom
Conversation
src/Relation/Binary/Filter.agda
Outdated
| UpwardClosure : (A → Set ℓ₁) → Rel A ℓ₂ → Set _ | ||
| UpwardClosure {A = A} F _≤_ = ∀ (x y : A) → (x ≤ y) × (F x) → F y |
There was a problem hiding this comment.
[DRY]
This is redundant, as an instance of Relation.Binary.Definitions._Respects_... noting that the use of of _×_ again involves redundant currying/uncurrying.
| -- - `F` is downwards directed: there exists some x with F(x), and for | ||
| -- - every x, y : P with F(x) and F(y), there exists some z : P with | ||
| -- F(z) × z ≤ x × z ≤ y |
There was a problem hiding this comment.
I suppose that the thing which makes me uneasy about such a definition is that it fuses two aspects of the definition, in the interest of avoiding some of the difficulties that Reed alludes to in #2814 , namely:
- the 'subset' implicitly defined by the predicate
F - the abstract property of a relation, here '
_≤_restricted to the subset defined byF', as being directed
I think as far as stdlib is concerned, it would be (more) helpful to isolate the second one, as for example in #2813 (where it would make sense simply to cherry-pick the definition, and perhaps some of its properties, and leave the Pointed extension construction to a separate PR), and as to the first, perhaps introduce a/the construction, analogous to Function.Base._on_, corresponding to the first one?
Not sure whether we should continue the discussion here, or else on #2814 though.
|
@gabriellisboaconegero and I have had some offline discussions about using a homomorphism-based definition that seems to be the One True Way. The idea is that we can define a setoidal analog of the order on propositions by defining a poset whose carrier is module Cool where
open import Level
open import Data.Product
open import Function.Base
open import Relation.Binary.Structures
open import Relation.Binary.Bundles
open IsPreorder
open IsPartialOrder
record _↔_ {ℓ ℓ'} (P : Set ℓ) (Q : Set ℓ') : Set (ℓ ⊔ ℓ') where
field
to : P → Q
from : Q → P
open _↔_
private variable
ℓ : Level
P Q R : Set ℓ
id↔ : P ↔ P
id↔ .to = id
id↔ .from = id
_∙↔_ : P ↔ Q → Q ↔ R → P ↔ R
(f ∙↔ g) .to = g .to ∘ f .to
(f ∙↔ g) .from = f .from ∘ g .from
_↔⁻¹ : P ↔ Q → Q ↔ P
(f ↔⁻¹) .to = f .from
(f ↔⁻¹) .from = f .to
BiImplicationIsEquivalence : ∀ {ℓ} → IsEquivalence (_↔_ {ℓ})
BiImplicationIsEquivalence .IsEquivalence.refl = id↔
BiImplicationIsEquivalence .IsEquivalence.sym = _↔⁻¹
BiImplicationIsEquivalence .IsEquivalence.trans = _∙↔_
Omega : ∀ (κ : Level) → Poset (suc κ) κ κ
Omega κ .Poset.Carrier = Set κ
Omega κ .Poset._≈_ P Q = P ↔ Q
Omega κ .Poset._≤_ P Q = P → Q
Omega κ .Poset.isPartialOrder .isPreorder .isEquivalence = BiImplicationIsEquivalence
Omega κ .Poset.isPartialOrder .isPreorder .reflexive p↔q = p↔q .to
Omega κ .Poset.isPartialOrder .isPreorder .trans p→q q→r = q→r ∘ p→q
Omega κ .Poset.isPartialOrder .antisym p→q q→r .to = p→q
Omega κ .Poset.isPartialOrder .antisym p→q q→r .from = q→rThis removes the need for upwards and downwards closure, as a homomorphism Next, we can define the order-theoretic analog of the category of elements. This transforms a monotone map Finally, we can define a filter as a monotone map EDIT: It was pointed out on zulip that this equivalence relation already exists as https://agda.github.io/agda-stdlib/master/Function.Properties.Equivalence.html#1935, so it should be really easy to assemble this from kit that we already have. |
This work aims to be an alternative to the base of domain theory (#2809). There were a lot of discussions about the decisions, and talking with @TOTBWF, a good alternative would be using filters. So, we introduced a generalised way.
Added
Structure
I know the current implementation does not follow the stdlib patterns, but some of the facts and definitions I was not sure about were to be put.