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 #
Marking: the three markings — a commutative monoid under valence composition (+the identity,·absorbing), and a join-semilattice with·on top.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 #
@[instance_reducible]
Equations
- NaturalLogic.instDecidableEqMarking x✝ y✝ = if h : x✝.ctorIdx = y✝.ctorIdx then isTrue ⋯ else isFalse ⋯
Equations
- One or more equations did not get rendered due to their size.
- NaturalLogic.instReprMarking.repr NaturalLogic.Marking.pos prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "NaturalLogic.Marking.pos")).group prec✝
- NaturalLogic.instReprMarking.repr NaturalLogic.Marking.neg prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "NaturalLogic.Marking.neg")).group prec✝
Instances For
@[instance_reducible]
Equations
- NaturalLogic.instReprMarking = { reprPrec := NaturalLogic.instReprMarking.repr }
Valence composition: signs multiply, · absorbs.
Equations
Instances For
@[instance_reducible]
Equations
- NaturalLogic.Marking.instMul = { mul := NaturalLogic.Marking.comp }
@[instance_reducible]
Equations
- NaturalLogic.Marking.instOne = { one := NaturalLogic.Marking.pos }
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
The information order: + ⊑ · and − ⊑ ·.
Equations
- x✝.le NaturalLogic.Marking.unmarked = True
- NaturalLogic.Marking.pos.le NaturalLogic.Marking.pos = True
- NaturalLogic.Marking.neg.le NaturalLogic.Marking.neg = True
- x✝¹.le x✝ = False
Instances For
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
@[instance_reducible]
Equations
- NaturalLogic.Marking.instLE = { le := NaturalLogic.Marking.le }
@[instance_reducible]
Equations
- a.decidableLE b = a.instDecidableRelLe b
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
@[instance_reducible]
Equations
- NaturalLogic.Marking.instOrderTop = { top := NaturalLogic.Marking.unmarked, le_top := NaturalLogic.Marking.instOrderTop._proof_1 }
Marked types #
def
NaturalLogic.instDecidableEqTy.decEq
{B✝ : Type u_1}
[DecidableEq B✝]
(x✝ x✝¹ : Ty B✝)
:
Decidable (x✝ = x✝¹)
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
@[instance_reducible]
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' : Marking} : σ'.LE σ → τ.LE τ' → m ≤ m' → (σ.arr m τ).LE (σ'.arr m' τ')
Instances For
@[instance_reducible]
Equations
- NaturalLogic.Ty.instLE = { le := NaturalLogic.Ty.LE }
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
@[irreducible]
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 (m ⊔ m')) (τ.sup? τ') else none
- x✝¹.sup? x✝ = none
Instances For
@[simp]
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 NaturalLogic.Marking.unmarked τ.unmark