Skip to main content

Module entailment

Module entailment 

Source
Expand description

Predicate entailment over the closed refinement vocabulary (#2802).

One engine answers “does the sender’s conjunction of predicates guarantee this receiver predicate?” for both consumers that ask it: the checker’s cross-context argument and return matching (crate::checker’s refinements_match) and the deploy-gate classifier (crate::contract_compat). The two used to hold separate notions (set-equality here, entailment there), so the compiler rejected a program the gate called compatible.

Predicates arrive in their canonical text (contract::canon_pred_set), so NonEmpty is already MinLength(1) and InRange bounds are values, not lexemes. The engine is sound but incomplete: it models an Int as unbounded, so it never concludes something only the safe-integer limit would give. Matches is entailed only by an identical Matches (regex-language inclusion is not attempted); a Matches on the sender is otherwise ignored, so Matches(p) && MaxLength(4) still entails MaxLength(8).

Functions§

entailed
Does the conjunction sender guarantee the predicate q?
unmet
The receiver predicates the sender’s conjunction does not guarantee; empty when the sender is admissible where the receiver is expected.