Desugar statement templates (#226)

* Desugar statement templates

* Support desugaring of SetContains statement templates

* Update the book
This commit is contained in:
Rob Knight 2025-05-09 05:48:18 -07:00 committed by GitHub
parent 726f95483d
commit b2cb563eb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 158 additions and 14 deletions

View file

@ -9,8 +9,7 @@ use serde::{Deserialize, Serialize};
use crate::middleware::{
self, check_st_tmpl, hash_str, hash_values, AnchoredKey, Hash, Key, MainPodInputs,
NativeOperation, NativePredicate, OperationAux, OperationType, Params, PodId, PodProver,
PodSigner, Predicate, Statement, StatementArg, Value, WildcardValue, EMPTY_VALUE, KEY_TYPE,
SELF,
PodSigner, Predicate, Statement, StatementArg, Value, WildcardValue, KEY_TYPE, SELF,
};
mod custom;
@ -251,8 +250,11 @@ impl MainPodBuilder {
}
Native(SetContainsFromEntries) => {
let [set, value] = op.1.try_into().unwrap(); // TODO: Error handling
let empty = OperationArg::Literal(Value::from(EMPTY_VALUE));
Operation(Native(ContainsFromEntries), vec![set, value, empty], op.2)
Operation(
Native(ContainsFromEntries),
vec![set, value.clone(), value],
op.2,
)
}
Native(SetNotContainsFromEntries) => {
let [set, value] = op.1.try_into().unwrap(); // TODO: Error handling