module Derivations:sig..end
Permissions. A typing derivation can either represent success, or failure.Permissions. A typing derivation can either represent success, or failure.type derivation =
| |
Good of |
(* | We found a rule to apply. | *) |
| |
Bad of |
(* | We found either no rule to apply, or we tried several rules, and none of them worked. In that case, we stop recording derivations as soon as we hit a rule that doesn't work; that rule will be the tail of the list. | *) |
typerule =rule_instance * derivation list
typerule_instance =string
type judgement =
| |
JSubType of |
| |
JSubVar of |
| |
JSubPerm of |
| |
JSubPerms of |
| |
JSubFloating of |
| |
JSubConstraint of |
| |
JSubConstraints of |
| |
JEqual of |
| |
JLt of |
| |
JGt of |
| |
JNothing |
| |
JAdd of |
| |
JDebug of |
typeresult =(TypeCore.env * derivation, derivation) Either.either
LazyList.t
val no_proof : TypeCore.env -> judgement -> resultval apply_axiom : TypeCore.env ->
judgement ->
rule_instance -> TypeCore.env -> result
Please note that:
apply_axiom env j r sub_env
is equivalent to
try_proof env j r (qed sub_env)
val try_several : TypeCore.env ->
judgement ->
rule_instance ->
'a list ->
(TypeCore.env -> 'a list -> 'a -> result) -> result
try_several env j r items attempt will try to prove judgement j in
environment env, using rule r; for each item in items, it will
attempt item, hoping to find a successful result, passing it env' (the
resulting environment), remaining (the other items), and item. If no item
in items works, the result will be a conjunction of failures.
val par : TypeCore.env ->
judgement ->
rule_instance -> result list -> resultval nothing : TypeCore.env -> rule_instance -> resultval option_of_result : result -> TypeCore.env optionenv option part of a result.val is_good : result -> booltype state
val try_proof : TypeCore.env ->
judgement ->
rule_instance -> state -> resulttry_proof env j r s tries to prove judgement j in environment env by
applying rule r. The premises of rule r are stored in state.val premises : TypeCore.env ->
(TypeCore.env -> result) list -> statepremises takes care of chaining them left-to-right.val (>>=) : result ->
(TypeCore.env -> state) -> stateqed or fail. This operator
passes the environments through and accumulates the premises (in case of
success), or just discards the remaining premises (in case of failure).val qed : TypeCore.env -> stateval fail : stateval (>>~) : state -> (TypeCore.env -> TypeCore.env) -> stateenv part of a state without giving any
justification for it.