-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Greetings! I'm currently working on a pretty esoteric derivative of your project, that requires additional statements about its internals (particularly, proving run_one_step_ctx to be not just some reduce implementation, but the only possible one). So, on my way there I need to tighten eval_ctx class with additional property to look like this:
Class eval_ctx (ctx_t: Type): Type :=
{
ctx_fill: list administrative_instruction -> ctx_t -> list administrative_instruction;
ctx_frame_mask: ctx_t -> frame -> frame;
ctx_frame_cond: ctx_t -> frame -> frame -> Prop;
ctx_reduce: forall (ctx: ctx_t) hs s f es hs' s' f' es',
ctx_frame_cond ctx f f' ->
reduce hs s (ctx_frame_mask ctx f) es hs' s' (ctx_frame_mask ctx f') es' ->
reduce hs s f (ctx_fill es ctx) hs' s' f' (ctx_fill es' ctx);
ctx_expand: forall (ctx: ctx_t) hs s f es hs' s' f' es',
ctx_frame_cond ctx f f' ->
reduction_possible s f es -> (* checking shape of es for validity *)
reduce hs s f (ctx_fill es ctx) hs' s' f' (ctx_fill es' ctx) ->
reduce hs s (ctx_frame_mask ctx f) es hs' s' (ctx_frame_mask ctx f') es';
}.The problem is, that while trying to prove ctx_expand for various contexts I'm starting to feel that in many places typing of instruction sequences is somewhat too loose, but I'm not sure if this is deliberate or not. The most glaring example is, probably, definition of lholed. In datatypes.v it is defined as:
Inductive lholed : nat -> Type :=
| LH_base : list value -> list administrative_instruction -> lholed 0
| LH_rec {k: nat}: list value -> nat -> list administrative_instruction -> lholed k -> list administrative_instruction -> lholed (S k)
.I'm really struggling to understand, why I see list administrative_instruction here and not simply expr? It seems that at no point of deductions right parts of a hole can contain anything but AI_basic wrappers. Any administrative instruction created in the hole either stays in the hole until destruction, or falls through into values part as reference. So, why not simply
Inductive lholed : nat -> Type :=
| LH_base : list value -> expr -> lholed 0
| LH_rec {k: nat}: list value -> nat -> expr -> lholed k -> expr -> lholed (S k)
.Am I missing some hidden reason? Tighter instruction type here would really help with required proofs.