Marked types for the monotonicity calculus #
This file defines the type system of the [IMT17]
monotonicity calculus: simple types over a set of base types, with
each arrow marked as monotone (+), antitone (−), or unmarked
(·).
Main declarations #
- The three markings are the signs
1(+),-1(−) and0(·), composing under valence composition as signs multiply; they are compared by information (MarkingLE), a join-semilattice with·on top (markingSup), not by the order ofSignType. Ty: marked simple types, with the subtyping order — contravariant in domains, covariant in codomains and markings — decidable over aDecidableEqbase.Ty.sup?: the partial join of compatible types.Ty.unmark: erasure of the markings along the codomain spine.
References #
- [IMT17] — Definitions 3.1–3.3.
Markings #
A monotonicity marking ([IMT17] Definition 3.1) is a sign: 1 (+,
monotone), -1 (−, antitone) or 0 (·, no information), composing as signs multiply.
The information order on markings: + ⊑ · and − ⊑ ·.
Equations
- NaturalLogic.MarkingLE m m' = (m = m' ∨ m' = 0)
Instances For
Equations
- NaturalLogic.instDecidableRelSignTypeMarkingLE x✝¹ x✝ = { decide := decide (x✝¹ = x✝) || decide (x✝ = 0), reflects_decide := ⋯ }
The join in the information order: a marking with itself, · otherwise.
Equations
- NaturalLogic.markingSup m m' = if m = m' then m else 0
Instances For
Marked types #
Equations
- One or more equations did not get rendered due to their size.
- NaturalLogic.instDecidableEqTy.decEq (NaturalLogic.Ty.base a) (NaturalLogic.Ty.base b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- NaturalLogic.instDecidableEqTy.decEq (NaturalLogic.Ty.base a) (a_1.arr a_2 a_3) = isFalse ⋯
- NaturalLogic.instDecidableEqTy.decEq (a.arr a_1 a_2) (NaturalLogic.Ty.base a_3) = isFalse ⋯
Instances For
The subtyping order ([IMT17] Definition 3.2):
contravariant in domains, covariant in codomains and markings, so
that every +- or −-typed function can also be considered
·-typed.
- base {B : Type u_1} (b : B) : (Ty.base b).LE (Ty.base b)
- arr {B : Type u_1} {σ σ' τ τ' : Ty B} {m m' : SignType} : σ'.LE σ → τ.LE τ' → MarkingLE m m' → (σ.arr m τ).LE (σ'.arr m' τ')
Instances For
Equations
- NaturalLogic.Ty.instLE = { le := NaturalLogic.Ty.LE }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
- (NaturalLogic.Ty.base a).decidableLE (NaturalLogic.Ty.base b) = if h : a = b then isTrue ⋯ else isFalse ⋯
- (NaturalLogic.Ty.base a).decidableLE (a_1.arr a_2 a_3) = isFalse ⋯
- (a.arr a_1 a_2).decidableLE (NaturalLogic.Ty.base a_3) = isFalse ⋯
Compatibility join and marking erasure #
The partial join of compatible types ([IMT17] Definition 3.3): defined when the two types share their unmarked skeleton and their domains exactly, joining the markings along the codomain spine.
Equations
- (NaturalLogic.Ty.base b).sup? (NaturalLogic.Ty.base b') = if b = b' then some (NaturalLogic.Ty.base b) else none
- (σ.arr m τ).sup? (σ'.arr m' τ') = if σ = σ' then Option.map (σ.arr (NaturalLogic.markingSup m m')) (τ.sup? τ') else none
- x✝¹.sup? x✝ = none
Instances For
Both compatible types lie below their join.
Erase the markings along the codomain spine ([IMT17]
Definition 3.3, their σ̂).
Equations
- (NaturalLogic.Ty.base b).unmark = NaturalLogic.Ty.base b
- (σ.arr a τ).unmark = σ.arr 0 τ.unmark
Instances For
Every type embeds into its marking erasure.