The Agda standard library provides a data type Maybe
accompanied with a view Any
.
Then there is the property Is-just
defined using Any
. I found working with this type difficult as the standard library provides exactly no tooling for Any
.
Thus I am looking for examples on how to work with Is-just
effectively. Is there an open source project that uses it?
Alternatively, I am seeking how to put it to good use:
- Given
Is-just m
andIs-nothing m
, how to eliminate? CanRelation.Nullary.Negation.contradiction
be used here? - Given a property
p : ... → (mp : Is-just m) → ... → ... ≡ to-witness mp
that needs to be shown inductively byp ... = {! p ... (subst Is-just m≡somethingelse mp) ... !}
, the given term does not fill the hole, because it has type... ≡ to-witness (subst Is-just m≡somethingelse mp)
.
Often it seems easier to work with Σ A (_≡_ m ∘ just)
than Is-just m
.
Regarding your first question, it is possible to derive a contradiction from having both
Is-just m
andIs-nothing m
in context. You can then use⊥-elim
to prove anything.The second one is a bit too abstract for me to be sure whether what I'm suggesting will work but the usual strategies are to try to pattern match on the value of type
Maybe A
or on the proof thatIs-just m
.As for using another definition of
Is-just
, I tend to likebecause it computes.