You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to fix #2145 and #1138 I've realised quite how much duplication has crept into the many many Reasoning modules we have in the library. Trying to change the syntax is incredibly painful as you have to do it all over the library.
I think a modular approach along the lines of:
moduleRelation.Binary.Reasoning.Base.Syntax
{a ℓ} {A :Set a} (_R_ : Rel A ℓ) where-------------------------------------------------------------------------- Propositional equality syntaxmodule≡-step-syntaxwhere-- Step with a non-trivial propositional equalitystep-≡ :∀ x {y z} → y R z → x ≡ y → x R z
step-≡ _ x∼z refl = x∼z
-- Step with a definition identitystep-≡-refl :∀ (x : A) {y} → x R y → x R y
step-≡-refl x xRy = xRy
-- Step with a flipped non-trivial propositional equalitystep-≡-sym :∀ x {y z} → y R z → y ≡ x → x R z
step-≡-sym _ x∼z refl = x∼z
infixr2 step-≡ step-≡-refl step-≡-sym
syntax step-≡-refl x xRy = x ≡⟨⟩ xRy
syntax step-≡-sym x yRz y≡x = x ≡⟨ y≡x ⟨ yRz
syntax step-≡ x yRz x≡y = x ≡⟨ x≡y ⟩ yRz
-------------------------------------------------------------------------- Setoid equality syntaxmodule≈-syntax
{ℓ₂} {_≈_ : Rel A ℓ₂}
(sym : Symmetric _≈_)
(step : Trans _≈_ _R_ _R_)
where-- Step with the setoid equalitystep-≈ :∀ (x : A) {y z} → y R z → x ≈ y → x R z
step-≈ x yRz x≈y = step {x} x≈y yRz
-- Flipped step with the setoid equalitystep-≈-sym :∀ x {y z} → y R z → y ≈ x → x R z
step-≈-sym x y∼z x≈y = step-≈ x y∼z (sym x≈y)
syntax step-≈ x y∼z x≈y = x ≈⟨ x≈y ⟩ y∼z
syntax step-≈-sym x y∼z y≈x = x ≈⟨ y≈x ⟨ y∼z
where we can then use these modules to mix and match whatever syntax we want for a particular Reasoning module.
I'm going to try and squeeze this in for v2.0 as this will make the two issues above almost trivial to do.
The text was updated successfully, but these errors were encountered:
Very cool! (but I might be partisan, seeing the symbols chosen... ;-))
Ah, but you went for the _≈⟨_⟩_/_≈⟨_⟨_ version as opposed to the _≈⟨_⟨_/_≈⟨_⟨_ version? but perhaps because the latter is upwards-compatible with the initial choice above, which is at least backwards-compatible... I think I see.
Sorry, should be clear that I won't touch the symmetry thing in this PR. The above was just an example I was trying to put together after already having tried to start the symmetry changes. I'll use the old notation in the first instance.
While trying to fix #2145 and #1138 I've realised quite how much duplication has crept into the many many
Reasoning
modules we have in the library. Trying to change the syntax is incredibly painful as you have to do it all over the library.I think a modular approach along the lines of:
where we can then use these modules to mix and match whatever syntax we want for a particular
Reasoning
module.I'm going to try and squeeze this in for
v2.0
as this will make the two issues above almost trivial to do.The text was updated successfully, but these errors were encountered: