Aufbau
From Carnap's Der logische Aufbau der Welt.
A Rust meta-logic engine powering the Proposition 7 constrained generation system.
Developer API
There are two useful API layers:
aufbau::logic::partial::Synthesizer: stateful, incremental generation.aufbau::validation::completability: validation helpers that match the correctness checks used by the validation suite.
Use the synthesizer for interactive constrained generation. Use the validation helpers when you need a completed witness or a correctness check that matches the validation suite.
Synthesis and constrained generation
Typical flow:
- Load a
Grammar. - Build a
Contextfor any variables already in scope. - Create a
Synthesizerfrom the current prefix. - Call
completions_ctx(&ctx)to get the allowed next-token constraints. - Rank or filter those constraints with your decoder or model.
- Apply the chosen step:
extend(token, &ctx)for a concrete token.extend_with_regex(token, &ctx)for a regex completion.
- Inspect the returned
TypedAST, or query the committed synthesizer state withinput(),tree(), orcomplete().
use Grammar;
use Synthesizer;
use Context;
Notes:
completions_ctx()returns admissible next-token regexes, not concrete strings.extend(token, &ctx)is for a concrete token your ranking layer already chose. It updatesinput()and returns the newTypedAST.extend_with_regex(token, &ctx)asks the synthesizer to find one concrete witness for a regex completion. It commits the new input just likeextend(...), and also returns(TypedAST, String).tree()andcomplete()read the synthesizer's committed cached tree state.Synthesizer::complete()only checks whether the current input is already complete. It does not search forward.