Skip to content

feat(symbolic): nested dict, dict-of-set, 3-level nesting#10

Merged
danwt merged 1 commit intomainfrom
danwt/claude/symbolic-mc-phase2
Feb 12, 2026
Merged

feat(symbolic): nested dict, dict-of-set, 3-level nesting#10
danwt merged 1 commit intomainfrom
danwt/claude/symbolic-mc-phase2

Conversation

@danwt
Copy link
Owner

@danwt danwt commented Feb 12, 2026

Summary

  • Support Dict[Int, Dict[Int, T]], Dict[Int, Set[Int]], and deeper nesting (e.g. PBFT's Dict[Int, Dict[Int, Dict[Int, Bool]]])
  • Flatten index chains (d[k1][k2][k3]) and resolve recursively via resolve_index_chain
  • Generalized init/effect encoding with encode_init_compound_body and encode_compound_update_for_slot
  • Clear error messages for infeasible Set[Seq[T]] and Dict[Seq[T], V] constructs
  • Fixed stride == 1 vs scalar value bug: compound types with a single key (e.g. Dict[0..0, Bool]) have stride 1 but are not scalars

Newly passing specs (10)

Spec Nesting type Time
Paxos Dict[Int, Dict[Int, Bool]] 0.16s
PBFT 3-level Dict[Int, Dict[Int, Dict[Int, Bool]]] 0.10s
Comet Dict[Int, Dict[Int, Int]] 0.28s
EPaxos nested dict 1.64s
Percolator nested dict 1.60s
MESI nested dict 0.45s
Redlock Dict[Int, Set[Int]] 0.06s
SWIM Dict[Int, Dict[Int, Int]] 0.42s
Simplex nested dict 0.14s
Counters dict 0.08s

Test plan

  • cargo fmt --check clean
  • cargo build -p specl-symbolic zero warnings
  • cargo test --workspace --exclude specl-tla all tests pass
  • All previously passing specs still pass (no regressions)
  • 10 newly passing specs verified individually
  • Infeasible constructs (Raft, narwhal_tusk) get clear Set[Seq[T]] error

🤖 Generated with Claude Code

… support

Support Dict[Int, Dict[Int, T]], Dict[Int, Set[Int]], and deeper
nesting like PBFT's Dict[Int, Dict[Int, Dict[Int, Bool]]].

- state_vars: type_to_kind_value with spec context for nested type resolution
- encoder: flatten index chains, recursive resolve_index_chain for arbitrary depth
- encoder: generalized len/membership for nested compounds
- transition: recursive init (encode_init_compound_body) and effect encoding
- transition: encode_compound_update_for_slot handles Dict/Set/Seq uniformly
- trace: format_compound_value displays nested dicts/sets recursively
- Clear error messages for infeasible Set[Seq[T]] and Dict[Seq[T], V]

Newly passing: Paxos, PBFT, Comet, EPaxos, Percolator, MESI, Redlock,
SWIM, Simplex, Counters (10 new specs, ~49/59 total with correct constants)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@danwt danwt merged commit 3156b99 into main Feb 12, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant