Case valuations #
A derivation that values the case of nominals step by step keeps, for each nominal, the value
its case has received so far, none while it is unvalued: a valuation of the nominals. Every
step of the formalized case theories, the dependent-case rules of [Mar91], Agree
([Cho00]) and the licensing of [Kal18], keeps the nominals and the values already
assigned and assigns new values only from what its rules provide: it extends the valuation by
those values (Extends). What such steps have in common, that a derivation is total, that a
value once assigned persists, and that every new value comes from the rules, is proved once here
for Extends and inherited by each theory through a single lemma per step.
The steps are not monotone: a more valued input can yield an output that does not extend the
output of a less valued one, as when lexical case on a lower nominal bleeds the dependent case of
a higher one. They are only inflationary, so no order-theoretic closure applies. A second
relation, ValuedLE, compares two derivations by which nominals they value at all, for accounts
in which adding an assigner may change what values a nominal but never leaves one unvalued.
Main definitions #
Case.Valuation: nominals, from the highest down, each with the value of its case.Case.Valuation.initial,Case.Valuation.fill,Case.Valuation.unvalued: the valuation with given values, the simultaneous valuation of the unvalued nominals, and the positions of the unvalued ones.Case.Valuation.valueOf: the value of a nominal, the nominals being identified by their own type rather than by a label.Case.Valuation.Extends: one valuation extends another by values satisfying a predicate.Case.Valuation.ValuedLE: one valuation values every nominal another does.
Main results #
Case.Valuation.Extends.getElem?_of_some,Case.Valuation.Extends.of_getElem?: values persist, and every new value satisfies the predicate.Case.Valuation.Extends.foldl: a sequence of extending steps extends.Case.Valuation.extends_fill: filling the unvalued nominals extends the valuation.
Implementation notes #
The operations are structurally recursive on the list, rather than defined through
List.mapIdx or List.lookmap, whose accumulators decide cannot evaluate.
References #
Nominals, from the highest down, each with the value of its case, none while unvalued.
Equations
- Case.Valuation α β = List (α × Option β)
Instances For
Operations #
The valuation giving each nominal the value v gives it.
Equations
- Case.Valuation.initial v xs = List.map (fun (x : α) => (x, v x)) xs
Instances For
fill, with positions counted from i.
Equations
- Case.Valuation.fillFrom f x✝ [] = []
- Case.Valuation.fillFrom f x✝ ((x_2, none) :: s) = (x_2, f x✝ x_2) :: Case.Valuation.fillFrom f (x✝ + 1) s
- Case.Valuation.fillFrom f x✝ ((x_2, some v) :: s) = (x_2, some v) :: Case.Valuation.fillFrom f (x✝ + 1) s
Instances For
Value every unvalued nominal with what f proposes for its position, simultaneously.
Equations
- Case.Valuation.fill f s = Case.Valuation.fillFrom f 0 s
Instances For
The value of nominal a, if it has one.
Equations
- Case.Valuation.valueOf a s = (List.lookup a s).join
Instances For
The positions of the unvalued nominals P selects, highest first.
Equations
- Case.Valuation.unvalued P s = List.map (fun (x : (α × Option β) × ℕ) => x.snd) (List.filter (fun (p : (α × Option β) × ℕ) => p.fst.snd.isNone && P p.fst.fst) (List.zipIdx s))
Instances For
Extension #
t extends s by values satisfying p: it has the same nominals, keeps every value s
assigns, and values a nominal s leaves unvalued only with a value satisfying p.
Equations
- Case.Valuation.Extends p s t = List.Forall₂ (fun (a b : α × Option β) => a.fst = b.fst ∧ (a.snd = b.snd ∨ a.snd = none ∧ ∀ (v : β), v ∈ b.snd → p v)) s t
Instances For
Comparing derivations #
t has the nominals of s and values every nominal s values.
Equations
- s.ValuedLE t = List.Forall₂ (fun (a b : α × Option β) => a.fst = b.fst ∧ (a.snd.isSome = true → b.snd.isSome = true)) s t