trunkit 0.2.4__tar.gz → 0.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. {trunkit-0.2.4 → trunkit-0.2.6}/.dockerignore +18 -18
  2. {trunkit-0.2.4 → trunkit-0.2.6}/.gitignore +52 -40
  3. trunkit-0.2.6/AUDIT.md +227 -0
  4. {trunkit-0.2.4 → trunkit-0.2.6}/Dockerfile +18 -18
  5. {trunkit-0.2.4 → trunkit-0.2.6}/Makefile +82 -82
  6. {trunkit-0.2.4 → trunkit-0.2.6}/PKG-INFO +43 -10
  7. {trunkit-0.2.4 → trunkit-0.2.6}/README.md +310 -277
  8. trunkit-0.2.6/SECURITY.md +205 -0
  9. {trunkit-0.2.4 → trunkit-0.2.6}/SKILL.md +33 -0
  10. trunkit-0.2.6/docs/CERT_SQL_GENERATION_GUARDRAILS.md +24 -0
  11. trunkit-0.2.6/docs/CROSS_LAB_SHARED_SCHEMA.md +172 -0
  12. trunkit-0.2.6/docs/DEMO_CORPUS.md +172 -0
  13. trunkit-0.2.6/docs/TOOL_ON_TOOL_TOPOLOGY.md +102 -0
  14. {trunkit-0.2.4 → trunkit-0.2.6}/pyproject.toml +16 -1
  15. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/cli.py +25 -4
  16. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/db.py +140 -165
  17. trunkit-0.2.6/src/calx/ledger.py +162 -0
  18. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/88_cert_witness_carry.sql +6 -6
  19. trunkit-0.2.6/src/calx/sql/93_cert_observability.sql +113 -0
  20. trunkit-0.2.6/src/calx/sql/97_cert_self_topology.sql +187 -0
  21. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/precache.py +16 -2
  22. trunkit-0.2.6/src/nerode/sql/98_topological_signature.sql +238 -0
  23. {trunkit-0.2.4 → trunkit-0.2.6}/tests/conftest.py +147 -112
  24. trunkit-0.2.6/tests/dbskip.py +11 -0
  25. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_categorical.py +432 -431
  26. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_composite_dfa.py +283 -282
  27. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_cybernetic.py +544 -543
  28. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_dead_time_factory.py +287 -286
  29. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_morphisms.py +533 -526
  30. trunkit-0.2.6/tests/test_packaging_surface.py +31 -0
  31. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_phase1b.py +373 -372
  32. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_phase1c.py +294 -293
  33. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_phase2.py +456 -455
  34. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_sequence.py +336 -335
  35. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_stream_interceptor.py +334 -319
  36. trunkit-0.2.6/tools/verify_bundle.py +55 -0
  37. trunkit-0.2.4/benchmarks/llm_eval.py +0 -838
  38. trunkit-0.2.4/benchmarks/llm_eval_classify_retry.log +0 -54
  39. trunkit-0.2.4/benchmarks/llm_eval_run.log +0 -59
  40. trunkit-0.2.4/scripts/morning_brief_demo.py +0 -332
  41. trunkit-0.2.4/src/calx/sql/90_cert_equip_probes.sql +0 -87
  42. trunkit-0.2.4/tools/agent_demo.py +0 -339
  43. trunkit-0.2.4/tools/build_bigrading.py +0 -178
  44. trunkit-0.2.4/tools/build_chromatic.py +0 -195
  45. trunkit-0.2.4/tools/build_colimit_closure.py +0 -194
  46. trunkit-0.2.4/tools/build_equipment.py +0 -204
  47. trunkit-0.2.4/tools/build_f1_radix.py +0 -148
  48. trunkit-0.2.4/tools/build_grading.py +0 -182
  49. trunkit-0.2.4/tools/build_identity_decomposition.py +0 -178
  50. trunkit-0.2.4/tools/build_lithon.py +0 -223
  51. trunkit-0.2.4/tools/build_moonshine.py +0 -222
  52. trunkit-0.2.4/tools/build_self_shadow.py +0 -144
  53. trunkit-0.2.4/tools/build_self_syzygy.py +0 -124
  54. trunkit-0.2.4/tools/build_shadow.py +0 -170
  55. trunkit-0.2.4/tools/build_strata_tower.py +0 -163
  56. trunkit-0.2.4/tools/cryptanalysis.py +0 -341
  57. trunkit-0.2.4/tools/develop_omega_family.py +0 -255
  58. trunkit-0.2.4/tools/develop_sequence.py +0 -191
  59. trunkit-0.2.4/tools/diagnostic_tests.py +0 -353
  60. trunkit-0.2.4/tools/kan_in_kan.py +0 -300
  61. trunkit-0.2.4/tools/load_kan_corpus.py +0 -153
  62. trunkit-0.2.4/tools/omega_equal_control.py +0 -155
  63. trunkit-0.2.4/tools/port_curry_sqlite_to_pg.py +0 -152
  64. trunkit-0.2.4/tools/register_calx_fn_deps.py +0 -116
  65. trunkit-0.2.4/tools/register_calx_in_curry.py +0 -424
  66. trunkit-0.2.4/tools/relationship_report.py +0 -372
  67. trunkit-0.2.4/tools/run_compose_discovery.py +0 -102
  68. trunkit-0.2.4/tools/run_discovery.py +0 -115
  69. trunkit-0.2.4/tools/seed_oeis_classics.py +0 -239
  70. trunkit-0.2.4/tools/seed_sequences.py +0 -321
  71. trunkit-0.2.4/tools/shared_prime_betti.py +0 -226
  72. trunkit-0.2.4/tools/smoke_curry_calx.py +0 -114
  73. trunkit-0.2.4/tools/stream_interceptor.py +0 -232
  74. {trunkit-0.2.4 → trunkit-0.2.6}/.gitattributes +0 -0
  75. {trunkit-0.2.4 → trunkit-0.2.6}/.github/workflows/python-package-conda.yml +0 -0
  76. {trunkit-0.2.4 → trunkit-0.2.6}/LICENSE +0 -0
  77. {trunkit-0.2.4 → trunkit-0.2.6}/assets/logo.png +0 -0
  78. {trunkit-0.2.4 → trunkit-0.2.6}/benchmarks/_notify_demo.py +0 -0
  79. {trunkit-0.2.4 → trunkit-0.2.6}/benchmarks/bench.py +0 -0
  80. {trunkit-0.2.4 → trunkit-0.2.6}/benchmarks/bench_chomsky.py +0 -0
  81. {trunkit-0.2.4 → trunkit-0.2.6}/benchmarks/sequence_bench.py +0 -0
  82. {trunkit-0.2.4 → trunkit-0.2.6}/docker-compose.yml +0 -0
  83. {trunkit-0.2.4 → trunkit-0.2.6}/proofs/combined_signature.py +0 -0
  84. {trunkit-0.2.4 → trunkit-0.2.6}/proofs/equipment.py +0 -0
  85. {trunkit-0.2.4 → trunkit-0.2.6}/proofs/gap_homology_primes.py +0 -0
  86. {trunkit-0.2.4 → trunkit-0.2.6}/proofs/perfect_28.py +0 -0
  87. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/__init__.py +0 -0
  88. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/curry_adapter.py +0 -0
  89. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/generate.py +0 -0
  90. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/primesieve.py +0 -0
  91. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/00_rehome_to_calx.sql +0 -0
  92. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/01_schema.sql +0 -0
  93. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/02_views.sql +0 -0
  94. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/03_generate.sql +0 -0
  95. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/04_crt.sql +0 -0
  96. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/05_dynamics.sql +0 -0
  97. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/06_oeis_match.sql +0 -0
  98. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/07_compositions.sql +0 -0
  99. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/10_curry.sql +0 -0
  100. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/20_kan.sql +0 -0
  101. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/21_kan_functors.sql +0 -0
  102. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/22_kan_elements.sql +0 -0
  103. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/23_kan_monoidal.sql +0 -0
  104. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/24_kan_natural_transformations.sql +0 -0
  105. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/25_kan_extensions.sql +0 -0
  106. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/26_kan_enrichment.sql +0 -0
  107. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/27_kan_profunctors.sql +0 -0
  108. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/28_kan_adjunctions.sql +0 -0
  109. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/30_kan_corpus.sql +0 -0
  110. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/40_cert.sql +0 -0
  111. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/41_cert_formal.sql +0 -0
  112. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/42_cert_gap_homology.sql +0 -0
  113. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/43_kan_sequence_homology.sql +0 -0
  114. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/44_cert_seq_homology.sql +0 -0
  115. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/45_kan_factorial_homology.sql +0 -0
  116. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/46_cert_factorial_homology.sql +0 -0
  117. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/47_kan_combined_signature.sql +0 -0
  118. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/48_cert_combined.sql +0 -0
  119. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/49_kan_shared_prime_betti.sql +0 -0
  120. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/50_cert_combined_scale.sql +0 -0
  121. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/51_cert_shared_prime_h2.sql +0 -0
  122. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/52_cert_developed_sequence.sql +0 -0
  123. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/53_cert_omega_family.sql +0 -0
  124. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/54_cert_omega_family_succ.sql +0 -0
  125. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/55_kan_prime_members.sql +0 -0
  126. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/56_cert_prime_members_functor.sql +0 -0
  127. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/57_kan_strata_tower.sql +0 -0
  128. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/58_cert_strata_tower.sql +0 -0
  129. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/59_kan_grading.sql +0 -0
  130. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/60_cert_grading.sql +0 -0
  131. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/61_kan_identity_decomposition.sql +0 -0
  132. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/62_cert_identity_decomposition.sql +0 -0
  133. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/63_kan_bigrading.sql +0 -0
  134. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/64_cert_bigrading.sql +0 -0
  135. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/65_kan_chromatic.sql +0 -0
  136. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/66_cert_chromatic.sql +0 -0
  137. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/67_kan_lithon.sql +0 -0
  138. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/68_cert_lithon.sql +0 -0
  139. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/69_kan_shadow.sql +0 -0
  140. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/70_cert_shadow.sql +0 -0
  141. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/71_kan_self_syzygy.sql +0 -0
  142. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/72_cert_self_syzygy.sql +0 -0
  143. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/73_kan_self_shadow.sql +0 -0
  144. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/74_cert_self_shadow.sql +0 -0
  145. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/75_kan_f1_radix.sql +0 -0
  146. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/76_cert_f1_radix.sql +0 -0
  147. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/77_kan_moonshine.sql +0 -0
  148. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/78_cert_moonshine.sql +0 -0
  149. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/79_cert_kan_engines.sql +0 -0
  150. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/80_kan_colimit_closure.sql +0 -0
  151. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/81_cert_colimit_closure.sql +0 -0
  152. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/82_kan_equipment.sql +0 -0
  153. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/83_cert_equipment.sql +0 -0
  154. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/84_cert_witness.sql +0 -0
  155. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/85_cert_derivation.sql +0 -0
  156. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/86_cert_verify.sql +0 -0
  157. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/87_cert_export_bundle.sql +0 -0
  158. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/89_nerode_bridge.sql +0 -0
  159. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/examples/crt_examples.sql +0 -0
  160. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/examples/dynamics_examples.sql +0 -0
  161. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/sql/examples/queries.sql +0 -0
  162. {trunkit-0.2.4 → trunkit-0.2.6}/src/calx/validate.py +0 -0
  163. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/__init__.py +0 -0
  164. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/adapters.py +0 -0
  165. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/automata.py +0 -0
  166. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/cli.py +0 -0
  167. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/db.py +0 -0
  168. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sources.py +0 -0
  169. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/00_bootstrap.sql +0 -0
  170. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/01_schema.sql +0 -0
  171. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/02_run.sql +0 -0
  172. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/03_minimize.sql +0 -0
  173. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/04_product.sql +0 -0
  174. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/05_from_regex.sql +0 -0
  175. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/10_cert.sql +0 -0
  176. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/11_chomsky.sql +0 -0
  177. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/20_calx_bridge.sql +0 -0
  178. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/30_protocol.sql +0 -0
  179. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/40_eigenform.sql +0 -0
  180. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/50_corpus.sql +0 -0
  181. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/60_product_corpus.sql +0 -0
  182. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/70_morphism.sql +0 -0
  183. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/80_categorical.sql +0 -0
  184. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/90_sequence.sql +0 -0
  185. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/91_sequence_cache.sql +0 -0
  186. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/92_session_automata.sql +0 -0
  187. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/93_handoff.sql +0 -0
  188. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/94_open_session.sql +0 -0
  189. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/95_cybernetic_automata.sql +0 -0
  190. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/96_dead_time_factory.sql +0 -0
  191. {trunkit-0.2.4 → trunkit-0.2.6}/src/nerode/sql/97_composite_dfa.sql +0 -0
  192. {trunkit-0.2.4 → trunkit-0.2.6}/tests/__init__.py +0 -0
  193. {trunkit-0.2.4 → trunkit-0.2.6}/tests/fixtures/oeis/.gitkeep +0 -0
  194. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_aliquot.py +0 -0
  195. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_build.py +0 -0
  196. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_chomsky.py +0 -0
  197. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_compose_match.py +0 -0
  198. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_crt.py +0 -0
  199. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_dynamics.py +0 -0
  200. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_equivalent.py +0 -0
  201. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_factorizations.py +0 -0
  202. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_minimize.py +0 -0
  203. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_oeis_match.py +0 -0
  204. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_phase1a.py +0 -0
  205. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_product.py +0 -0
  206. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_run.py +0 -0
  207. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_schema.py +0 -0
  208. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_sieve.py +0 -0
  209. {trunkit-0.2.4 → trunkit-0.2.6}/tests/test_sources.py +0 -0
  210. {trunkit-0.2.4 → trunkit-0.2.6}/tools/cert_formal.py +0 -0
  211. {trunkit-0.2.4 → trunkit-0.2.6}/tools/compose_match.py +0 -0
  212. {trunkit-0.2.4 → trunkit-0.2.6}/tools/factorial_homology.py +0 -0
  213. {trunkit-0.2.4 → trunkit-0.2.6}/tools/oeis_loader.py +0 -0
  214. {trunkit-0.2.4 → trunkit-0.2.6}/tools/oeis_match.py +0 -0
  215. {trunkit-0.2.4 → trunkit-0.2.6}/tools/prime_members_functor.py +0 -0
  216. {trunkit-0.2.4 → trunkit-0.2.6}/tools/seq_homology.py +0 -0
@@ -1,18 +1,18 @@
1
- .git
2
- .github
3
- __pycache__
4
- *.pyc
5
- *.pyo
6
- *.py[cod]
7
- .pytest_cache
8
- .mypy_cache
9
- .ruff_cache
10
- .coverage
11
- htmlcov/
12
- .venv
13
- venv
14
- dist
15
- build
16
- *.egg-info
17
- tests/fixtures/oeis/b*.txt
18
- .claude/
1
+ .git
2
+ .github
3
+ __pycache__
4
+ *.pyc
5
+ *.pyo
6
+ *.py[cod]
7
+ .pytest_cache
8
+ .mypy_cache
9
+ .ruff_cache
10
+ .coverage
11
+ htmlcov/
12
+ .venv
13
+ venv
14
+ dist
15
+ build
16
+ *.egg-info
17
+ tests/fixtures/oeis/b*.txt
18
+ .claude/
@@ -1,40 +1,52 @@
1
- __pycache__/
2
- *.py[cod]
3
- *.egg-info/
4
- .pytest_cache/
5
- .mypy_cache/
6
- .ruff_cache/
7
- .coverage
8
- htmlcov/
9
- dist/
10
- build/
11
- .venv/
12
- venv/
13
- .env
14
- .envrc
15
- *.whl
16
- *.tar.gz
17
-
18
- # OEIS validation fixtures are pulled on demand
19
- tests/fixtures/oeis/b*.txt
20
-
21
- # Local data dumps
22
- *.dump
23
- *.sql.bak
24
- *.sql.gz
25
-
26
- # Claude IDE settings
27
- .claude/
28
-
29
- # Jules tooling
30
- .curry/
31
-
32
- # Editor
33
- .vscode/
34
- .idea/
35
-
36
- # Local artifacts
37
- test_results.txt
38
-
39
- # Accidentally-named venv path fragments
40
- Users*/
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ .coverage
8
+ htmlcov/
9
+ dist/
10
+ build/
11
+ .venv/
12
+ venv/
13
+ .env
14
+ .envrc
15
+ *.whl
16
+ *.tar.gz
17
+
18
+ # OEIS validation fixtures are pulled on demand
19
+ tests/fixtures/oeis/b*.txt
20
+
21
+ # Local data dumps
22
+ *.dump
23
+ *.sql.bak
24
+ *.sql.gz
25
+
26
+ # Claude IDE settings
27
+ .claude/
28
+
29
+ # Jules tooling
30
+ .curry/
31
+
32
+ # Editor
33
+ .vscode/
34
+ .idea/
35
+
36
+ # Local artifacts
37
+ test_results.txt
38
+ results.json
39
+ tools/advanced_results.json
40
+ tools/benchmark_advanced.py
41
+ tools/benchmark_prime.py
42
+ tools/_schema_check.py
43
+
44
+ # Accidentally-named venv path fragments
45
+ Users*/
46
+ .curry/
47
+
48
+ .pr_body.md
49
+
50
+ # Local workspace extensions (not part of the public library)
51
+ local/
52
+ corpus/
trunkit-0.2.6/AUDIT.md ADDED
@@ -0,0 +1,227 @@
1
+ # Trunkit Federation — Independent Audit Worksheet
2
+
3
+ **Target:** `Athena-Pro/Trunkit` @ tag `v0.2.4` + the live `trunk` Postgres federation
4
+ **Scope date:** 2026-05-29
5
+ **Auditor:** ________________________ **Date performed:** ____________
6
+
7
+ > **Independence principle.** Do not trust this worksheet's "Expected" column,
8
+ > the `cert.standing` view, or any prose claim. Each procedure is runnable; where
9
+ > possible, **recompute the underlying fact from primitives** and compare. Record
10
+ > what *you* observe in "Actual" and mark Pass/Fail yourself. A green ledger that
11
+ > you cannot independently reproduce is a finding, not a pass.
12
+
13
+ ---
14
+
15
+ ## 0. Environment setup
16
+
17
+ | # | Step | Command |
18
+ |---|---|---|
19
+ | 0.1 | Check out the pinned release | `git fetch --tags && git checkout v0.2.4` |
20
+ | 0.2 | Confirm the tree is clean & version | `git status --short` → empty; `grep '^version' pyproject.toml` → `0.2.4` |
21
+ | 0.3 | Bring up the DB | `docker compose up -d db-trunkit` |
22
+ | 0.4 | Confirm container + connectivity | `docker exec -i trunkit-db-trunkit-1 psql -U trunk -d trunk -c "select 1"` → `1` |
23
+
24
+ DSN for reference: `******localhost:5434/trunk`.
25
+ All SQL below runs as: `docker exec -i trunk-db-1 psql -U trunk -d trunk -c "<SQL>"`.
26
+
27
+ > **Caveat:** the federation DB is mutable (claims get re-checked, engines get
28
+ > populated). Reference values are as of v0.2.4 / 2026-05-29. If your counts
29
+ > differ, that is not automatically a fail — but every *deviation* must be
30
+ > explained by a state change you can point to. The **invariants** (§2, §3, §6)
31
+ > must hold regardless of counts.
32
+
33
+ ---
34
+
35
+ ## 1. Repository provenance (the three fixes under audit)
36
+
37
+ | # | Objective | Command | Expected | Actual | P/F |
38
+ |---|---|---|---|---|---|
39
+ | 1.1 | `cert.standing` uses LEFT JOIN (never-checked claims surface) | `grep -n "LEFT JOIN cert.certificate" src/calx/sql/40_cert.sql` | 1 match | | |
40
+ | 1.2 | Step-79 guard present (empty ≠ refuted) | `grep -n "v_empty\|v_violated" src/calx/sql/79_cert_kan_engines.sql` | ≥3 matches | | |
41
+ | 1.3 | Step-90 verifiers present | `ls src/calx/sql/90_cert_equip_probes.sql && grep -c "law_view_holds\|is_perfect" src/calx/sql/90_cert_equip_probes.sql` | file exists, ≥2 | | |
42
+ | 1.4 | Release history | `git log --oneline -6` | shows v0.2.4, equip, empty-engine guard, v0.2.3, cert.standing | | |
43
+ | 1.5 | No probe touches `COALESCE(...,FALSE)` collapse | `grep -rn "COALESCE(v_rowok, FALSE)" src/calx/sql/` | **0 matches** (the bug is gone) | | |
44
+
45
+ ---
46
+
47
+ ## 2. Ledger state (reproduce, then question it)
48
+
49
+ | # | Objective | Command (SQL) | Expected (ref) | Actual | P/F |
50
+ |---|---|---|---|---|---|
51
+ | 2.1 | Standing breakdown | `SELECT status, count(*) FROM cert.standing GROUP BY status ORDER BY 2 DESC;` | valid 154, unverified 14, refuted 8, pass 1, error 1 | | |
52
+ | 2.2 | Every claim appears in standing (LEFT JOIN works) | `SELECT (SELECT count(*) FROM cert.claim) = (SELECT count(*) FROM cert.standing);` | `t` | | |
53
+ | 2.3 | No claim is silently absent | `SELECT count(*) FROM cert.claim c LEFT JOIN cert.standing s ON s.claim_id=c.id WHERE s.claim_id IS NULL;` | `0` | | |
54
+
55
+ ---
56
+
57
+ ## 3. Contradiction soundness — **the core invariant**
58
+
59
+ The central claim under audit: *every `refuted` is a genuine violation; no `refuted`
60
+ is manufactured by an empty/unpopulated engine.*
61
+
62
+ | # | Objective | Command (SQL) | Expected | Actual | P/F |
63
+ |---|---|---|---|---|---|
64
+ | 3.1 | Enumerate refutations + evidence | `SELECT s.claim_id, cl.subject_kind, left(s.evidence::text,80) FROM cert.standing s JOIN cert.claim cl ON cl.id=s.claim_id WHERE s.status='refuted' ORDER BY 1;` | ~8 rows, each with a concrete defect (NaN/Inf/negative/wrong-count) | | |
65
+ | 3.2 | Engine bridge is NOT refuted on emptiness | `SELECT ok, evidence->>'violations' v, evidence->>'engines_empty' e FROM cert.kan_engines_all_true();` | `ok` is NULL or TRUE, `violations=0` | | |
66
+ | 3.3 | Soundness regression guard (claim 238) | `SELECT status FROM cert.standing WHERE claim_id=238;` | `valid` | | |
67
+ | 3.4 | **Adversarial:** force an empty engine, confirm it reports *unverified*, not *refuted* | see §3-ADV below | unverified | | |
68
+
69
+ **§3-ADV (tamper test — do in a throwaway transaction, ROLLBACK after):**
70
+ ```sql
71
+ BEGIN;
72
+ CREATE OR REPLACE VIEW kan.audit_probe_laws AS SELECT NULL::boolean AS some_law WHERE false;
73
+ SELECT ok, evidence FROM cert.law_view_holds('audit_probe_laws'); -- expect ok = NULL (unverified)
74
+ ROLLBACK;
75
+ ```
76
+ A return of `ok = FALSE` here would mean the empty≠refuted guard is broken → **fail**.
77
+
78
+ ---
79
+
80
+ ## 4. Verifier correctness (don't trust the functions — probe them)
81
+
82
+ | # | Objective | Command (SQL) | Expected | Actual | P/F |
83
+ |---|---|---|---|---|---|
84
+ | 4.1 | `is_perfect(28)` true | `SELECT ok, evidence FROM cert.is_perfect(28);` | `t`, aliquot_sum 28 | | |
85
+ | 4.2 | **Negative control:** `is_perfect(12)` false | `SELECT ok FROM cert.is_perfect(12);` | `f` (12's aliquot sum = 16) | | |
86
+ | 4.3 | **Negative control:** `is_perfect(6)` true | `SELECT ok FROM cert.is_perfect(6);` | `t` | | |
87
+ | 4.4 | Independent recompute (outside the DB) | `python -c "n=28;print(sum(d for d in range(1,n) if n%d==0)==n)"` | `True` | | |
88
+ | 4.5 | `law_view_holds` on a populated engine | `SELECT ok FROM cert.law_view_holds('strata_tower_laws');` | `t` | | |
89
+ | 4.6 | `law_view_holds` on a nonexistent view | `SELECT ok, evidence->>'error' FROM cert.law_view_holds('does_not_exist_laws');` | NULL + error string | | |
90
+
91
+ ---
92
+
93
+ ## 5. Formal tier (hash-pinned artifacts + drift detection)
94
+
95
+ | # | Objective | Command | Expected | Actual | P/F |
96
+ |---|---|---|---|---|---|
97
+ | 5.1 | Pinned artifacts exist | `SELECT claim_id, left(sha256,12), path FROM cert.artifact ORDER BY claim_id;` | rows for claims 7, 8, 11, 31 | | |
98
+ | 5.2 | Re-run harness is idempotent & re-verifies | `CALX_DSN=... python tools/cert_formal.py` | claims 7,8,11,31 → valid; ~16 `[ERR artifact missing]` | | |
99
+ | 5.3 | **Tamper test:** mutate a proof, confirm drift caught | append a comment to `proofs/perfect_28.py`, re-run 5.2 | hash mismatch flagged (NOT silently valid); **restore the file after** | | |
100
+ | 5.4 | Missing-checker manifest is honest | from 5.2 output, list the `[ERR artifact missing]` files | matches absent `proofs/*.py` (9,10,13 unbacked) | | |
101
+
102
+ ---
103
+
104
+ ## 6. Engine population (claims outrun data → now partially closed)
105
+
106
+ | # | Objective | Command (SQL) | Expected | Actual | P/F |
107
+ |---|---|---|---|---|---|
108
+ | 6.1 | Engines populated | `SELECT evidence->>'engines_checked' checked, evidence->>'engines_empty' empty FROM cert.kan_engines_all_true();` | checked 10, empty 4 | | |
109
+ | 6.2 | Base data loaded | `SELECT (SELECT count(*) FROM calx.sequences), (SELECT count(*) FROM kan.sequence_terms);` | ~29, ~1611 (>0) | | |
110
+ | 6.3 | Empty engines report unverified, not refuted | `SELECT cl.subject_kind, s.status FROM cert.standing s JOIN cert.claim cl ON cl.id=s.claim_id WHERE cl.subject_kind IN ('grading','lithon','identity_decomposition');` | all `unverified` | | |
111
+ | 6.4 | Known build failures reproducible | `python tools/build_grading.py` ; `python tools/build_lithon.py` | grading: FK `category seq`; lithon: `ModuleNotFoundError: core` | | |
112
+
113
+ ---
114
+
115
+ ## 7. Append-only provenance (cert is a ledger, not a mutable cell)
116
+
117
+ | # | Objective | Command (SQL) | Expected | Actual | P/F |
118
+ |---|---|---|---|---|---|
119
+ | 7.1 | History retained across status flips | `SELECT claim_id, seq, status FROM cert.certificate WHERE claim_id=234 ORDER BY seq;` | ≥2 rows (sidecar: refuted→valid both kept) | | |
120
+ | 7.2 | Re-check appends, never mutates | run `SELECT cert.check(7);` twice; `SELECT count(*) FROM cert.certificate WHERE claim_id=7;` | count **increases** by 1 each run | | |
121
+ | 7.3 | Session attestations present | `SELECT id, subject_kind FROM cert.claim WHERE id IN (235,236,237,238,239,240);` | 6 rows (repo_layout/trunkit_method/cert_soundness) | | |
122
+
123
+ ---
124
+
125
+ ## 8. Independent end-to-end recomputation (trust nothing)
126
+
127
+ Pick **3 `valid` comp_sql claims at random** and, for each, read its `probe_sql`,
128
+ run that SQL yourself, and confirm `ok = TRUE` independently of `cert.standing`:
129
+ ```sql
130
+ SELECT id, probe_sql FROM cert.claim WHERE id = <random valid id>;
131
+ -- then paste and run the probe_sql; confirm ok = true
132
+ ```
133
+ Pick **2 `refuted` claims** and confirm the defect is real (e.g. open the cited
134
+ experiment file, or recompute the statistic) — not a stale/aspirational threshold.
135
+
136
+ | Claim id | Tier | Independent result | Matches ledger? |
137
+ |---|---|---|---|
138
+ | | | | |
139
+ | | | | |
140
+ | | | | |
141
+ | (refuted) | | | |
142
+ | (refuted) | | | |
143
+
144
+ ---
145
+
146
+ ## 9. Adversarial / CWE checks (Phase-1 security)
147
+
148
+ > Tests the hardening from `SECURITY.md`. Until probe-sandbox (design A) and
149
+ > ledger-signing (design B) land, the **Expected** column states the *current*
150
+ > behaviour and flags it as a **KNOWN GAP**; after they land, re-run and the
151
+ > Expected becomes the enforced behaviour. A gap you can reproduce is a finding,
152
+ > not a pass — but a *self-reported, documented* gap is honest, not a failure.
153
+
154
+ ### 9A. CWE-89/94 — probe is code execution (the P0 surface)
155
+
156
+ | # | Objective | Command (SQL) | Expected | Actual | P/F |
157
+ |---|---|---|---|---|---|
158
+ | 9A.1 | Enumerate every probe-EXECUTE site | `grep -rn "EXECUTE v_claim.probe_sql" src/calx/sql/` | 4 sites: 40_cert:101, 86_cert_verify:32, 88_cert_witness_carry:56, 94_cert_kernel:485 | | |
159
+ | 9A.2 | **Adversarial probe — filesystem read.** Insert a claim whose probe calls `pg_read_file`, then verify it. *Throwaway tx; ROLLBACK.* | see §9A-ADV | **pre-hardening: KNOWN GAP** (probe runs as caller; may read files). **post-A: denied / sandboxed** (role lacks `pg_read_file`; → `error`/`unverified`, never `valid`) | | |
160
+ | 9A.3 | **Adversarial probe — write attempt.** Probe does `INSERT INTO curry.constants ...`. | post-A: fails on `default_transaction_read_only` / role grant → `error`, no row written | | |
161
+ | 9A.4 | **Runaway probe.** Probe is `SELECT pg_sleep(60), ...`. | post-A: killed by `statement_timeout` (~5s) → `error`, not a hang | | |
162
+ | 9A.5 | Policy invariant: untrusted facts use `cert_kernel`, not `probe_sql` | `SELECT count(*) FROM cert.claim WHERE method='cert_kernel' AND probe_sql IS NOT NULL;` | `0` (kernel claims carry **data** witnesses, never code) | | |
163
+
164
+ **§9A-ADV (do in a throwaway transaction, ROLLBACK after):**
165
+ ```sql
166
+ BEGIN;
167
+ INSERT INTO cert.claim (subject_kind, subject_ref, statement, claim_kind, method, probe_sql)
168
+ VALUES ('adversarial','{}','ADV pg_read_file probe (audit only)','computational','comp_sql',
169
+ $p$ SELECT (pg_read_file('/etc/hostname') IS NOT NULL) AS ok,
170
+ jsonb_build_object('leak', left(pg_read_file('/etc/hostname'),0)) AS evidence $p$);
171
+ SELECT status, left(evidence::text,60) FROM cert.check(
172
+ (SELECT id FROM cert.claim WHERE statement='ADV pg_read_file probe (audit only)'));
173
+ ROLLBACK;
174
+ ```
175
+ *Pre-hardening this may return `valid` — that is the documented CWE-89 gap, the
176
+ reason Phase-2 (VEX) is blocked until design A lands. Post-hardening it must be
177
+ `error`/`unverified`.*
178
+
179
+ ### 9B. CWE-345/347 — integrity vs authenticity
180
+
181
+ | # | Objective | Command (SQL) | Expected | Actual | P/F |
182
+ |---|---|---|---|---|---|
183
+ | 9B.1 | Chain integrity holds | `SELECT ok, reason FROM cert.verify_chain();` | `ok=t`, "chain intact" | | |
184
+ | 9B.2 | **In-place tamper is caught.** Forge `evidence` on one cert via a superuser side-channel (triggers block normal UPDATE). | `verify_chain` → `ok=f`, "content hash mismatch at certificate id N" | | |
185
+ | 9B.3 | **Forged chain is NOT distinguishable yet.** Recompute a fully valid chain from public inputs in a scratch schema. | **pre-hardening: KNOWN GAP** — recomputed chain also passes `verify_chain` (no signature). **post-B: fails signature** (no `cert.signer` key) | | |
186
+ | 9B.4 | Append-only law (CWE-915) still enforced | `UPDATE cert.certificate SET status='valid' WHERE id=1;` | raises *"append-only ledger"* exception | | |
187
+ | 9B.5 | External anchor recorded | `SELECT count(*) FROM cert.external_anchor;` ; `SELECT cert.ledger_root();` | anchor rows present; root = latest `row_hash` | | |
188
+
189
+ ### 9C. CWE-862 — DB-level authorization
190
+
191
+ | # | Objective | Command | Expected | Actual | P/F |
192
+ |---|---|---|---|---|---|
193
+ | 9C.1 | Consumer/prover split is DB-enforced, not just CLI | `\du` / check for a read-only role | **pre-hardening: KNOWN GAP** (CLI convention only). **post: consumer role cannot INSERT cert.claim** | | |
194
+
195
+ ### 9D. Spectre scope (no claim of mitigation)
196
+
197
+ | # | Objective | Check | Expected | Actual | P/F |
198
+ |---|---|---|---|---|---|
199
+ | 9D.1 | Trunkit makes no Spectre-mitigation claim | `grep -ni "mitigat" SECURITY.md` | §6 states "does not mitigate, must not claim to" | | |
200
+ | 9D.2 | Untrusted path is data, not code (the in-model Spectre lesson) | review `cert_kernel` checkers take JSONB witnesses, no caller SQL | confirmed: `kernel_*` never `EXECUTE` caller input | | |
201
+
202
+ ---
203
+
204
+ ## 10. Findings & sign-off
205
+
206
+ **Counts:** Pass ____ / Fail ____ / N/A ____ out of the procedures above.
207
+
208
+ **Material findings (any Fail, or any green you could not independently reproduce):**
209
+ 1. ________________________________________________________________
210
+ 2. ________________________________________________________________
211
+ 3. ________________________________________________________________
212
+
213
+ **Known-accepted gaps (already self-reported by the system — not findings):**
214
+ - 4/14 kan engines unpopulated (grading, lithon, identity_decomposition + 1); honestly `unverified`.
215
+ - 3 formal claims (9, 10, 13) lack `proofs/*.py` checkers; honestly `unverified`.
216
+ - 8 genuine `refuted` data-quality contradictions in external experiment files (Feigenbaum/MDL/BIC) — *expected* to be red.
217
+
218
+ **Auditor opinion** (circle): SOUND / SOUND-WITH-EXCEPTIONS / UNSOUND
219
+
220
+ **Signature:** ____________________________ **Date:** ____________
221
+
222
+ ---
223
+ *Generated 2026-05-29 against Trunkit v0.2.4. Reference counts reflect the live
224
+ federation DB at that time; the soundness invariants (§3, §4.2, §5.3, §6.3) are
225
+ state-independent and must hold for any honest snapshot. §9 (adversarial/CWE)
226
+ added 2026-05-30 alongside `SECURITY.md`; its **KNOWN GAP** rows are expected to
227
+ be red until probe-sandbox (design A) and ledger-signing (design B) land.*
@@ -1,18 +1,18 @@
1
- FROM python:3.12-slim
2
-
3
- RUN apt-get update \
4
- && apt-get install -y --no-install-recommends \
5
- primesieve \
6
- libpq5 \
7
- && rm -rf /var/lib/apt/lists/*
8
-
9
- WORKDIR /app
10
-
11
- COPY pyproject.toml README.md ./
12
- COPY src ./src
13
-
14
- RUN pip install --no-cache-dir .
15
-
16
- # Default entrypoint for the nerode CLI; override to 'trunk' for Trunkit
17
- ENTRYPOINT ["nerode"]
18
- CMD ["--help"]
1
+ FROM python:3.12-slim
2
+
3
+ RUN apt-get update \
4
+ && apt-get install -y --no-install-recommends \
5
+ primesieve \
6
+ libpq5 \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
+ WORKDIR /app
10
+
11
+ COPY pyproject.toml README.md ./
12
+ COPY src ./src
13
+
14
+ RUN pip install --no-cache-dir .
15
+
16
+ # Default entrypoint for the nerode CLI; override to 'trunk' for Trunkit
17
+ ENTRYPOINT ["nerode"]
18
+ CMD ["--help"]
@@ -1,82 +1,82 @@
1
- TRUNK_DSN ?= postgresql://trunk:trunk@localhost:5434/trunk
2
- NERODE_DSN ?= postgresql://nerode:nerode@localhost:5435/nerode
3
-
4
- .PHONY: up down apply apply-trunkit apply-nerode check check-trunkit check-nerode \
5
- install dev-install test test-network lint build reset-trunkit reset-nerode
6
-
7
- ## Start both PostgreSQL instances via Docker Compose
8
- up:
9
- docker compose up -d db-trunkit db-nerode
10
-
11
- ## Stop and remove containers
12
- down:
13
- docker compose down
14
-
15
- ## Apply Trunkit (calx/kan/curry/cert) schemas — idempotent
16
- apply-trunkit:
17
- @for f in $$(ls src/calx/sql/*.sql | sort); do \
18
- echo " $$f"; \
19
- psql "$(TRUNK_DSN)" -f "$$f" -q; \
20
- done
21
- @echo "Trunkit schema applied."
22
-
23
- ## Apply Nerode (automata/session/porter) schemas — idempotent
24
- apply-nerode:
25
- @for f in $$(ls src/nerode/sql/*.sql | sort); do \
26
- echo " $$f"; \
27
- psql "$(NERODE_DSN)" -f "$$f" -q; \
28
- done
29
- @echo "Nerode schema applied."
30
-
31
- ## Apply all schemas for both databases
32
- apply: apply-trunkit apply-nerode
33
-
34
- ## Trunkit smoke check: populate integers and run reflexive closure
35
- check-trunkit:
36
- python tools/kan_in_kan.py
37
-
38
- ## Nerode smoke check: build a minimal DFA from a*b+ and run it
39
- check-nerode:
40
- nerode build --regex "a*b+" --dsn "$(NERODE_DSN)"
41
- nerode run --input "aaab" --dsn "$(NERODE_DSN)" --id 1
42
-
43
- ## Run all checks
44
- check: check-trunkit check-nerode
45
-
46
- ## Full local bootstrap: up -> apply -> check
47
- install: up
48
- @echo "Waiting for databases to be ready..."
49
- @sleep 3
50
- $(MAKE) apply
51
- $(MAKE) check
52
-
53
- ## Install Python packages in editable/dev mode
54
- dev-install:
55
- pip install -e ".[dev]"
56
-
57
- ## Run tests
58
- test:
59
- pytest -v
60
-
61
- ## Network tests (real HTTP — weather, tickers, HN)
62
- test-network:
63
- pytest tests/test_sources.py -m network -v
64
-
65
- ## Lint
66
- lint:
67
- ruff check src tests
68
-
69
- ## Build wheel
70
- build:
71
- python -m build
72
-
73
- ## Drop Trunkit schemas and start fresh (destructive)
74
- reset-trunkit:
75
- psql "$(TRUNK_DSN)" -c "DROP SCHEMA IF EXISTS cert, kan, curry, calx CASCADE;"
76
- $(MAKE) apply-trunkit
77
- $(MAKE) check-trunkit
78
-
79
- ## Drop Nerode schemas and start fresh (destructive)
80
- reset-nerode:
81
- psql "$(NERODE_DSN)" -c "DROP SCHEMA IF EXISTS nerode CASCADE;"
82
- $(MAKE) apply-nerode
1
+ TRUNK_DSN ?= postgresql://trunk:trunk@localhost:5434/trunk
2
+ NERODE_DSN ?= postgresql://nerode:nerode@localhost:5435/nerode
3
+
4
+ .PHONY: up down apply apply-trunkit apply-nerode check check-trunkit check-nerode \
5
+ install dev-install test test-network lint build reset-trunkit reset-nerode
6
+
7
+ ## Start both PostgreSQL instances via Docker Compose
8
+ up:
9
+ docker compose up -d db-trunkit db-nerode
10
+
11
+ ## Stop and remove containers
12
+ down:
13
+ docker compose down
14
+
15
+ ## Apply Trunkit (calx/kan/curry/cert) schemas — idempotent
16
+ apply-trunkit:
17
+ @for f in $$(ls src/calx/sql/*.sql | sort); do \
18
+ echo " $$f"; \
19
+ psql "$(TRUNK_DSN)" -f "$$f" -q; \
20
+ done
21
+ @echo "Trunkit schema applied."
22
+
23
+ ## Apply Nerode (automata/session/porter) schemas — idempotent
24
+ apply-nerode:
25
+ @for f in $$(ls src/nerode/sql/*.sql | sort); do \
26
+ echo " $$f"; \
27
+ psql "$(NERODE_DSN)" -f "$$f" -q; \
28
+ done
29
+ @echo "Nerode schema applied."
30
+
31
+ ## Apply all schemas for both databases
32
+ apply: apply-trunkit apply-nerode
33
+
34
+ ## Trunkit smoke check: populate integers and run reflexive closure
35
+ check-trunkit:
36
+ python tools/kan_in_kan.py
37
+
38
+ ## Nerode smoke check: build a minimal DFA from a*b+ and run it
39
+ check-nerode:
40
+ nerode build --regex "a*b+" --dsn "$(NERODE_DSN)"
41
+ nerode run --input "aaab" --dsn "$(NERODE_DSN)" --id 1
42
+
43
+ ## Run all checks
44
+ check: check-trunkit check-nerode
45
+
46
+ ## Full local bootstrap: up -> apply -> check
47
+ install: up
48
+ @echo "Waiting for databases to be ready..."
49
+ @sleep 3
50
+ $(MAKE) apply
51
+ $(MAKE) check
52
+
53
+ ## Install Python packages in editable/dev mode
54
+ dev-install:
55
+ pip install -e ".[dev]"
56
+
57
+ ## Run tests
58
+ test:
59
+ pytest -v
60
+
61
+ ## Network tests (real HTTP — weather, tickers, HN)
62
+ test-network:
63
+ pytest tests/test_sources.py -m network -v
64
+
65
+ ## Lint
66
+ lint:
67
+ ruff check src tests
68
+
69
+ ## Build wheel
70
+ build:
71
+ python -m build
72
+
73
+ ## Drop Trunkit schemas and start fresh (destructive)
74
+ reset-trunkit:
75
+ psql "$(TRUNK_DSN)" -c "DROP SCHEMA IF EXISTS cert, kan, curry, calx CASCADE;"
76
+ $(MAKE) apply-trunkit
77
+ $(MAKE) check-trunkit
78
+
79
+ ## Drop Nerode schemas and start fresh (destructive)
80
+ reset-nerode:
81
+ psql "$(NERODE_DSN)" -c "DROP SCHEMA IF EXISTS nerode CASCADE;"
82
+ $(MAKE) apply-nerode
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trunkit
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Trunkit — proof-carrying code and deterministic automata middleware on PostgreSQL, with Porter agent context handoff
5
5
  Project-URL: Homepage, https://github.com/Athena-Pro/Trunkit
6
6
  Project-URL: Repository, https://github.com/Athena-Pro/Trunkit
@@ -76,11 +76,39 @@ Just PostgreSQL, Python, and ~1.5 MB of schemas.
76
76
  |-------|------|
77
77
  | **calx** | Dense prime factorisation of ℤ[1..N]; aliquot/derivative dynamics; CRT; OEIS sequence matching |
78
78
  | **curry** | Immutable versioned constants and functions; append-only computational provenance |
79
- | **kan** | Category-theory meta-layer: base categories monoidal NTs Kan extensions enrichment profunctors adjunctions |
79
+ | **kan** | Category-*structured* meta-layer: reflects Postgres FK graphs into objects/morphisms and checks **structural invariants** (triangle commutativity, product universal property, naturality, epi classification) as re-runnable probes — see the caveat below |
80
80
  | **cert** | Proof-carrying attestation: five method tiers, structured witness storage, proof composition DAG, portable bundle export, consumer re-verification |
81
81
  | **Nerode** | DFA/automata engine on PostgreSQL: construction, minimization, product, session DFAs, sequence cache, certified handoff envelopes |
82
82
  | **Porter** | Agent context handoff: pre-pack external data, certify session boundaries, hand verified context to a new model with zero tool calls |
83
83
 
84
+ > **What "kan" does and does not claim.** kan performs *structural invariant
85
+ > checking*, **not formal proof**. A claim like "the calx → curry functor is
86
+ > faithful" is attested by a SQL probe that checks the **current database state**
87
+ > (e.g. the morphism map is injective on the rows present) — it is re-runnable
88
+ > evidence, not a machine-checked theorem about all inputs. Real proof lives in
89
+ > external Lean/Agda artifacts (the `formal_external` tier) or in the
90
+ > independent `cert_kernel` checkers. Treat `struct_kan` as "this categorical
91
+ > invariant holds over the data we have," with the same three-valued honesty
92
+ > (`valid`/`refuted`/`unverified`) as everywhere else.
93
+
94
+ ### Why two databases?
95
+
96
+ Trunkit (calx/curry/kan/cert) and Nerode (automata/porter) run as **separate
97
+ PostgreSQL instances** by design, not by accident:
98
+
99
+ - **Failure & trust isolation** — the proof ledger (append-only, hash-chained;
100
+ see `SECURITY.md`) must not share a backend with the automata/agent-handoff
101
+ workload, which ingests external data and runs untrusted-ish session traces.
102
+ - **Independent lifecycle** — Nerode can be reset/rebuilt (it's a cache + DFA
103
+ workspace) without touching the immutable cert ledger.
104
+ - **Cross-instance entanglement is by value, not by FK** — a Porter envelope
105
+ embeds `cert.ledger_root()` and the cert side records the envelope hash via
106
+ `cert.anchor_external`, so the two are cryptographically linked without a
107
+ shared transaction (a single physical chain can't span two instances anyway).
108
+
109
+ The cost is real (two DSNs, two `apply` targets); the benefit is that a
110
+ compromised or wiped Nerode cannot corrupt or rewrite proof history.
111
+
84
112
  ---
85
113
 
86
114
  ## Quick start
@@ -102,8 +130,7 @@ python scripts/morning_brief_demo.py
102
130
 
103
131
  ```bash
104
132
  # Install
105
- pip install trunkit # proof kernel
106
- pip install nerode # automata + porter layer
133
+ pip install trunkit # installs both the trunkit and nerode CLIs
107
134
  ```
108
135
 
109
136
  Environment variable: `CALX_DSN=postgresql://trunk:trunk@localhost:5434/trunk`
@@ -267,13 +294,19 @@ conn.execute(
267
294
 
268
295
  | Component | Files | Size |
269
296
  |-----------|-------|------|
270
- | SQL (94 files, 00–97) | 94 | ~534 KB |
271
- | Python tools | 39 | ~342 KB |
297
+ | SQL (00–96) | 99 | ~603 KB |
298
+ | Python tools | 47 | ~393 KB |
272
299
  | Proof scripts | 4 | ~23 KB |
273
- | Src + tests + config | ~58 | ~483 KB |
274
- | **Total (no virtualenv)** | **~199** | **~1.4 MB** |
275
-
276
- Compare: Lean 4 toolchain ≈ 2.9 GB per version; Mathlib compiled ≈ 4–10 GB per project.
300
+ | Src + tests + config | ~69 | ~558 KB |
301
+ | **Total (no virtualenv)** | **~219** | **~1.5 MB** |
302
+
303
+ For scale only (not a capability comparison): a Lean 4 toolchain is ≈ 2.9 GB
304
+ per version and a compiled Mathlib ≈ 4–10 GB per project. **Trunkit is not a
305
+ substitute for a proof assistant** — Lean/Mathlib verify arbitrary
306
+ human-authored theorems, whereas Trunkit re-checks a fixed, small set of
307
+ certificate schemas (factorization, CRT, Egyptian fractions, matrix words) plus
308
+ re-runnable in-DB probes. The size figures say only that Trunkit fits in a
309
+ database you already run; they do **not** imply equivalent verification power.
277
310
 
278
311
  ---
279
312