Replies: 1 comment 1 reply
-
hi @azike For your question 1: We do not have a way of excluding specific symbols from unfolding while unfolding everything else. Our general philosophy around this has been that if you want this level of precise control over which symbols are unfolded, then it's better to explicitly list all the things you want to unfold, rather than specifying a mixture of things that should and should not be unfolded. It takes a bit of discipline, but we often add attributes to the symbols that we want to unfold, sometimes even grouping related symbols by tagging them with the same attribute. See this, for example: https://github.com/project-everest/everparse/blob/master/src/3d/prelude/EverParse3d.Interpreter.fst#L1341-L1357 Note, you've probably seen this already, in addition to requesting unfolding of things marked with attributes, we also have delta_qualifier and delta_namespace: https://github.com/FStarLang/FStar/blob/master/ulib/FStar.Pervasives.fsti#L277-L279 For your question 2: Mixing reduction and rewriting is delicate and there are potentially many ways to do it, with various tradeoffs. If the term you're trying to reduce is large, then bouncing back and forth between reduction and rewriting can quickly become very inefficient. If you can say a bit more about the style of proof you're doing, I can probably suggests some options. As for getting your hands on the equality: Is if verify pk signature then
let hyp:squash (verify pk signature==true) = () in
assert (eval script) by ( ... you can find hyp in the environment now and rewrite with it.. ) There might be a nicer way ... @mtzguido, this reminds me of a recent conversation we had. Any other tips? |
Beta Was this translation helpful? Give feedback.
-
Hi!
I try to execute a stack-based parser implementation for a scripting language in F*. Scripts are given as lists of opcodes. For that matter, I have a recursive evaluation function that calls a step function for each opcode in the script.
When evaluating the function using normal
assert
the smt solver fails as expected, due to the deeply nested recursion.However, it works when calling the normalizer first, e.g.
assert_norm
.Now I want to be able to evaluate the script, based on knowledge I have in my current environment.
To be more precise, the parser supports verification of signatures using a function called
verify
. If I am in a context where I know that a given key verifies a specific signature, I would like to apply that knowledge during evaluation.Based on that I have two questions:
During normalization the definition of
verify
gets unfolded (checking the type the key and the signature), however I'd like to prevent normalization ofverify
and applygrewrite_eq
given my current assumptions.I found out that I can use
norm norm_steps
to guide the normalization process. The options for delta rule application (delta, delta_attr, delta_only,...) allow to specify which definitions get unfolded, but there is no rule to specify a marker that prevents unfolding (e.g. unfold everything except definitions annotated with[@@do_not_norm]
).I don't want to annotate
verify
withirreducible
, as this proof is a special case and the annotation would break other proofs.Is there any other way I could tackle this problem?
Is it possible to search for a specific equality term in the current environment and then apply it to the goal using
grewrite_eq
?Currently, I got access to the right binder by asserting the implication of my goal given the context and using
implies_intro
:Overall I would like to normalize the script evaluation as much as possible until I can apply knowledge of my environment to the current goal with
rewrite_eq
and then continue with normalization.Thank you in advance for any hints.
Beta Was this translation helpful? Give feedback.
All reactions