diff --git a/.github/actions/daily-test-improver/coverage-steps/action.yml b/.github/actions/daily-test-improver/coverage-steps/action.yml index fa336194e2..ce5820134c 100644 --- a/.github/actions/daily-test-improver/coverage-steps/action.yml +++ b/.github/actions/daily-test-improver/coverage-steps/action.yml @@ -66,7 +66,6 @@ runs: cd build ninja c_example || echo "c_example build failed, continuing" >> ../coverage-steps.log ninja cpp_example || echo "cpp_example build failed, continuing" >> ../coverage-steps.log - ninja z3_tptp5 || echo "z3_tptp5 build failed, continuing" >> ../coverage-steps.log ninja c_maxsat_example || echo "c_maxsat_example build failed, continuing" >> ../coverage-steps.log echo "Examples build completed" >> ../coverage-steps.log cd .. @@ -113,9 +112,6 @@ runs: if [ -f "build/examples/cpp_example_build_dir/cpp_example" ]; then ./build/examples/cpp_example_build_dir/cpp_example 2>&1 | tee -a coverage-steps.log || echo "cpp_example execution failed" >> coverage-steps.log fi - if [ -f "build/examples/tptp_build_dir/z3_tptp5" ]; then - ./build/examples/tptp_build_dir/z3_tptp5 --help 2>&1 | tee -a coverage-steps.log || echo "z3_tptp5 execution failed" >> coverage-steps.log - fi if [ -f "build/examples/c_maxsat_example_build_dir/c_maxsat_example" ] && [ -f "examples/maxsat/ex.smt" ]; then ./build/examples/c_maxsat_example_build_dir/c_maxsat_example examples/maxsat/ex.smt 2>&1 | tee -a coverage-steps.log || echo "c_maxsat_example execution failed" >> coverage-steps.log fi diff --git a/.github/aw/actions-lock.json b/.github/aw/actions-lock.json index 6f2049b5b6..9fc7b46d2a 100644 --- a/.github/aw/actions-lock.json +++ b/.github/aw/actions-lock.json @@ -34,6 +34,11 @@ "repo": "actions/upload-artifact", "version": "v7.0.1", "sha": "043fb46d1a93c77aae656e7c1c64a875d1fc6a0a" + }, + "github/gh-aw-actions/setup@v0.81.6": { + "repo": "github/gh-aw-actions/setup", + "version": "v0.81.6", + "sha": "ba6380cc6e5be5d21677bebe04d52fb48e3abec7" } }, "containers": { diff --git a/.github/workflows/Windows.yml b/.github/workflows/Windows.yml index bf346b00a9..e91e4edbf6 100644 --- a/.github/workflows/Windows.yml +++ b/.github/workflows/Windows.yml @@ -11,6 +11,33 @@ concurrency: cancel-in-progress: true jobs: + mingw-build: + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v7.0.1 + - name: Setup MSYS2 (UCRT64 / MinGW-w64) + uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + update: true + install: >- + mingw-w64-ucrt-x86_64-gcc + mingw-w64-ucrt-x86_64-cmake + mingw-w64-ucrt-x86_64-ninja + python3 + - name: Build Z3 with MinGW + shell: msys2 {0} + run: | + mkdir build && cd build + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. + ninja -j$(nproc) shell test-z3 + - name: Run unit tests + shell: msys2 {0} + run: | + cd build + ./test-z3.exe /a + build: strategy: matrix: @@ -28,7 +55,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v3 - run: | diff --git a/.github/workflows/a3-python.lock.yml b/.github/workflows/a3-python.lock.yml index e28e9c1384..985f7a9f7b 100644 --- a/.github/workflows/a3-python.lock.yml +++ b/.github/workflows/a3-python.lock.yml @@ -1,5 +1,5 @@ # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"dd63b4d66cd714e87c81488d3486e3a850e458a916995cdf5bc03156d94a72b3","body_hash":"665495c4ed6e3e1026d2af08b3c91602776ca76d61b3e2e02ea01e12e120261c","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -41,7 +41,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -54,7 +54,7 @@ name: "A3 Python Code Analysis" on: schedule: - - cron: "11 14 * * 0" + - cron: "35 8 * * 0" # Friendly format: weekly on sunday (scattered) workflow_dispatch: inputs: @@ -97,7 +97,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -412,7 +412,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1006,7 +1006,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1250,7 +1250,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1518,7 +1518,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/academic-citation-tracker.lock.yml b/.github/workflows/academic-citation-tracker.lock.yml index 9c82872929..3d4b9a9d49 100644 --- a/.github/workflows/academic-citation-tracker.lock.yml +++ b/.github/workflows/academic-citation-tracker.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"480bf21bcee3122e341b8d9cc8b19279eaa3c25109c5268eb353b9cf2a749663","body_hash":"05745b276b67f33e54e95f20396a0d79e1bf2384cd2d43bc3b31b6ca3ddae969","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"ac5c516750ec0894a784c69854f091e1abc930abf3e5158c06b0c0338d0154a9","body_hash":"05745b276b67f33e54e95f20396a0d79e1bf2384cd2d43bc3b31b6ca3ddae969","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} +# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -26,7 +26,6 @@ # Monthly Academic Citation & Research Trend Tracker for Z3. Searches arXiv, Semantic Scholar, and GitHub for recent papers and projects using Z3, analyses which Z3 features they rely on, and identifies the functionality — features or performance — most important to address next. # # Secrets used: -# - COPILOT_GITHUB_TOKEN # - GH_AW_GITHUB_MCP_SERVER_TOKEN # - GH_AW_GITHUB_TOKEN # - GITHUB_TOKEN @@ -41,7 +40,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -88,7 +87,6 @@ jobs: engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} model: ${{ steps.generate_aw_info.outputs.model }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} @@ -96,7 +94,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -177,11 +175,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs'); await main(); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Checkout .github and .agents folders uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -385,7 +378,11 @@ jobs: needs: activation if: needs.activation.outputs.daily_ai_credits_exceeded != 'true' runs-on: ubuntu-latest - permissions: read-all + permissions: + contents: read + copilot-requests: write + issues: read + pull-requests: read concurrency: group: "gh-aw-copilot-${{ github.workflow }}" queue: max @@ -420,7 +417,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -819,7 +816,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} @@ -843,6 +840,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Detect agent errors if: always() @@ -878,8 +876,7 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); await main(); env: - GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' - SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_SECRET_NAMES: 'GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -1044,7 +1041,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1235,7 +1232,6 @@ jobs: GH_AW_WORKFLOW_ID: "academic-citation-tracker" GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" GH_AW_ENGINE_ID: "copilot" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }} @@ -1279,6 +1275,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + copilot-requests: write env: GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} outputs: @@ -1289,7 +1286,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1441,7 +1438,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }} @@ -1463,6 +1460,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Parse threat detection token usage for step summary id: parse_detection_token_usage @@ -1555,7 +1553,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1631,7 +1629,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/academic-citation-tracker.md b/.github/workflows/academic-citation-tracker.md index 60e15136e0..5b4fa5e086 100644 --- a/.github/workflows/academic-citation-tracker.md +++ b/.github/workflows/academic-citation-tracker.md @@ -12,7 +12,11 @@ on: timeout-minutes: 60 -permissions: read-all +permissions: + contents: read + issues: read + pull-requests: read + copilot-requests: write network: allowed: diff --git a/.github/workflows/agentics-maintenance.yml b/.github/workflows/agentics-maintenance.yml index 139263fb9c..b9e427e71d 100644 --- a/.github/workflows/agentics-maintenance.yml +++ b/.github/workflows/agentics-maintenance.yml @@ -96,7 +96,7 @@ jobs: pull-requests: write steps: - name: Setup Scripts - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions @@ -134,7 +134,7 @@ jobs: actions: write steps: - name: Setup Scripts - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions @@ -163,7 +163,7 @@ jobs: persist-credentials: false - name: Setup Scripts - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions @@ -178,7 +178,7 @@ jobs: await main(); - name: Install gh-aw - uses: github/gh-aw-actions/setup-cli@v0.81.6 + uses: github/gh-aw-actions/setup-cli@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: version: v0.81.6 @@ -210,7 +210,7 @@ jobs: pull-requests: write steps: - name: Setup Scripts - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions @@ -256,7 +256,7 @@ jobs: persist-credentials: false - name: Setup Scripts - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions @@ -302,7 +302,7 @@ jobs: persist-credentials: false - name: Setup Scripts - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions @@ -317,7 +317,7 @@ jobs: await main(); - name: Install gh-aw - uses: github/gh-aw-actions/setup-cli@v0.81.6 + uses: github/gh-aw-actions/setup-cli@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: version: v0.81.6 @@ -348,7 +348,7 @@ jobs: persist-credentials: false - name: Setup Scripts - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions @@ -363,7 +363,7 @@ jobs: await main(); - name: Install gh-aw - uses: github/gh-aw-actions/setup-cli@v0.81.6 + uses: github/gh-aw-actions/setup-cli@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: version: v0.81.6 @@ -453,7 +453,7 @@ jobs: persist-credentials: false - name: Setup Scripts - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions @@ -468,7 +468,7 @@ jobs: await main(); - name: Install gh-aw - uses: github/gh-aw-actions/setup-cli@v0.81.6 + uses: github/gh-aw-actions/setup-cli@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: version: v0.81.6 @@ -545,7 +545,7 @@ jobs: issues: write steps: - name: Setup Scripts - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions @@ -582,7 +582,7 @@ jobs: persist-credentials: false - name: Setup Scripts - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions @@ -597,7 +597,7 @@ jobs: await main(); - name: Install gh-aw - uses: github/gh-aw-actions/setup-cli@v0.81.6 + uses: github/gh-aw-actions/setup-cli@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: version: v0.81.6 diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 6eac0e3ab8..6a24de1a9f 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Configure CMake and build run: | diff --git a/.github/workflows/api-coherence-checker.lock.yml b/.github/workflows/api-coherence-checker.lock.yml index 7bc2e90df9..bd9ada92cf 100644 --- a/.github/workflows/api-coherence-checker.lock.yml +++ b/.github/workflows/api-coherence-checker.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"834e887ef6def1de97d035da77ac91ab4abdaa02e16edd0e7437f6df4fd4fdc7","body_hash":"a3ec39bff49a3afd8f6e9c2bfdb45095d580f2933ae084824133687c651fd10a","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"0c1cd7c9176bb5199e12b016c97a8abfb1ca577d208719430da180c40fb495b1","body_hash":"a3ec39bff49a3afd8f6e9c2bfdb45095d580f2933ae084824133687c651fd10a","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} +# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -26,7 +26,6 @@ # Daily API coherence checker across Z3's multi-language bindings including Rust # # Secrets used: -# - COPILOT_GITHUB_TOKEN # - GH_AW_GITHUB_MCP_SERVER_TOKEN # - GH_AW_GITHUB_TOKEN # - GITHUB_TOKEN @@ -41,7 +40,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -89,7 +88,6 @@ jobs: engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} model: ${{ steps.generate_aw_info.outputs.model }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} @@ -97,7 +95,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -178,11 +176,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs'); await main(); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Checkout .github and .agents folders uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -386,7 +379,11 @@ jobs: needs: activation if: needs.activation.outputs.daily_ai_credits_exceeded != 'true' runs-on: ubuntu-latest - permissions: read-all + permissions: + contents: read + copilot-requests: write + issues: read + pull-requests: read concurrency: group: "gh-aw-copilot-${{ github.workflow }}" queue: max @@ -421,7 +418,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -818,7 +815,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} @@ -842,6 +839,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Detect agent errors if: always() @@ -877,8 +875,7 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); await main(); env: - GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' - SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_SECRET_NAMES: 'GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -1042,7 +1039,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1232,7 +1229,6 @@ jobs: GH_AW_WORKFLOW_ID: "api-coherence-checker" GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" GH_AW_ENGINE_ID: "copilot" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }} @@ -1276,6 +1272,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + copilot-requests: write env: GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} outputs: @@ -1286,7 +1283,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1438,7 +1435,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }} @@ -1460,6 +1457,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Parse threat detection token usage for step summary id: parse_detection_token_usage @@ -1552,7 +1550,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1628,7 +1626,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/api-coherence-checker.md b/.github/workflows/api-coherence-checker.md index fc904822a4..d99fb6f902 100644 --- a/.github/workflows/api-coherence-checker.md +++ b/.github/workflows/api-coherence-checker.md @@ -7,7 +7,11 @@ on: timeout-minutes: 30 -permissions: read-all +permissions: + contents: read + issues: read + pull-requests: read + copilot-requests: write network: defaults diff --git a/.github/workflows/build-warning-fixer.lock.yml b/.github/workflows/build-warning-fixer.lock.yml index 5c5ba17f62..68edc77fd1 100644 --- a/.github/workflows/build-warning-fixer.lock.yml +++ b/.github/workflows/build-warning-fixer.lock.yml @@ -1,5 +1,5 @@ # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"8e86ba4261f8c71ab0e24c7d0bc7edf67727e4be5859ff2fdaf6678076207eab","body_hash":"8922ba3a21444e84982af2576e34d4b4ef553ca0655a384c58f9d05712e92a11","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -42,7 +42,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -55,7 +55,7 @@ name: "Build Warning Fixer" on: schedule: - - cron: "51 9 * * *" + - cron: "41 9 * * *" # Friendly format: daily (scattered) workflow_dispatch: inputs: @@ -98,7 +98,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -411,7 +411,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1010,7 +1010,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1252,7 +1252,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1520,7 +1520,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/build-z3-cache.yml b/.github/workflows/build-z3-cache.yml index 74b91750a8..5255ffff88 100644 --- a/.github/workflows/build-z3-cache.yml +++ b/.github/workflows/build-z3-cache.yml @@ -29,10 +29,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67ed3e4796..b7c31f0d2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,10 +38,10 @@ jobs: runRegressions: false steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -81,7 +81,7 @@ jobs: container: "quay.io/pypa/manylinux_2_34_x86_64:latest" steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Select Python run: | @@ -121,7 +121,7 @@ jobs: container: quay.io/pypa/manylinux_2_28_x86_64:latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download ARM toolchain run: curl -L -o /tmp/arm-toolchain.tar.xz 'https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz' @@ -165,7 +165,7 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup OCaml uses: ocaml/setup-ocaml@v3 @@ -220,7 +220,7 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup OCaml uses: ocaml/setup-ocaml@v3 @@ -326,10 +326,10 @@ jobs: runTests: false steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -337,7 +337,7 @@ jobs: run: sudo apt-get update && sudo apt-get install -y ninja-build - name: Setup Go - uses: actions/setup-go@v6 + uses: actions/setup-go@v7 with: go-version: '1.20' @@ -377,11 +377,9 @@ jobs: cd build ninja c_example ninja cpp_example - ninja z3_tptp5 ninja c_maxsat_example examples/c_example_build_dir/c_example examples/cpp_example_build_dir/cpp_example - examples/tptp_build_dir/z3_tptp5 -help examples/c_maxsat_example_build_dir/c_maxsat_example ../examples/maxsat/ex.smt cd .. @@ -416,10 +414,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -465,10 +463,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -506,10 +504,10 @@ jobs: timeout-minutes: 10 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -526,10 +524,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' diff --git a/.github/workflows/code-conventions-analyzer.lock.yml b/.github/workflows/code-conventions-analyzer.lock.yml index 73c5eb562e..bb004ef395 100644 --- a/.github/workflows/code-conventions-analyzer.lock.yml +++ b/.github/workflows/code-conventions-analyzer.lock.yml @@ -1,5 +1,5 @@ # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"a1e7df27a986a57ddd77f861fa68976adbc3681d7cc69d0e43c810f7b792c2ce","body_hash":"786421ca60f296f148d0061dfa650e680d6fb50909bb376ab32449451f308862","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -41,7 +41,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -54,7 +54,7 @@ name: "Code Conventions Analyzer" on: schedule: - - cron: "8 3 * * *" + - cron: "35 22 * * *" # Friendly format: daily (scattered) workflow_dispatch: inputs: @@ -97,7 +97,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -416,7 +416,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1095,7 +1095,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1340,7 +1340,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1608,7 +1608,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1684,7 +1684,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/code-simplifier.lock.yml b/.github/workflows/code-simplifier.lock.yml index 1152ef3637..792d1a552a 100644 --- a/.github/workflows/code-simplifier.lock.yml +++ b/.github/workflows/code-simplifier.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"43d46b9fb0525b484e4cd15d3251010e0b2b854cb91a250eb32c44c5402c5985","body_hash":"368645de189baaa1bf33102a20d4c9ea646e5ed15d3d2bffaf4b221f6c97b73b","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"b196a87f54c704ce6876e6644e13357cf08061fffb0bdea4475dec8486daffc7","body_hash":"368645de189baaa1bf33102a20d4c9ea646e5ed15d3d2bffaf4b221f6c97b73b","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} +# gh-aw-manifest: {"version":1,"secrets":["GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -28,7 +28,6 @@ # Source: github/gh-aw/.github/workflows/code-simplifier.md@6762bfba6ae426a03aac46e8f68701461c667404 # # Secrets used: -# - COPILOT_GITHUB_TOKEN # - GH_AW_CI_TRIGGER_TOKEN # - GH_AW_GITHUB_MCP_SERVER_TOKEN # - GH_AW_GITHUB_TOKEN @@ -44,7 +43,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -57,7 +56,7 @@ name: "Code Simplifier" on: schedule: - - cron: "10 4 * * *" + - cron: "22 21 * * *" # Friendly format: daily (scattered) # skip-if-match: is:pr is:open in:title "[code-simplifier]" # Skip-if-match processed as search check in pre-activation job workflow_dispatch: @@ -95,7 +94,6 @@ jobs: engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} model: ${{ steps.generate_aw_info.outputs.model }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} @@ -103,7 +101,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -189,11 +187,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs'); await main(); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Checkout .github and .agents folders uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -394,6 +387,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + copilot-requests: write issues: read pull-requests: read concurrency: @@ -428,7 +422,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -823,7 +817,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} @@ -847,6 +841,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Detect agent errors if: always() @@ -882,8 +877,7 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); await main(); env: - GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' - SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_SECRET_NAMES: 'GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -1028,7 +1022,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1229,7 +1223,6 @@ jobs: GH_AW_WORKFLOW_ID: "code-simplifier" GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" GH_AW_ENGINE_ID: "copilot" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }} @@ -1270,6 +1263,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + copilot-requests: write env: GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} outputs: @@ -1280,7 +1274,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1433,7 +1427,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }} @@ -1455,6 +1449,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Parse threat detection token usage for step summary id: parse_detection_token_usage @@ -1522,7 +1517,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1601,7 +1596,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/code-simplifier.md b/.github/workflows/code-simplifier.md index 58b64b595d..3b737bfaf5 100644 --- a/.github/workflows/code-simplifier.md +++ b/.github/workflows/code-simplifier.md @@ -9,6 +9,7 @@ permissions: contents: read issues: read pull-requests: read + copilot-requests: write tracker-id: code-simplifier diff --git a/.github/workflows/compare-stats-anomaly-reporter.lock.yml b/.github/workflows/compare-stats-anomaly-reporter.lock.yml index 65f4744737..9747d4b80b 100644 --- a/.github/workflows/compare-stats-anomaly-reporter.lock.yml +++ b/.github/workflows/compare-stats-anomaly-reporter.lock.yml @@ -1,5 +1,5 @@ # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"e17bfc6c2c8616cac5f5715bd9b9b7969773b859cfc3496b9aede51ca7061d76","body_hash":"ae9e7f7b5dc15964bef5c1eff99e32d68349ddce23011669b2497881b2a5c58b","compiler_version":"v0.81.6","agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -41,7 +41,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -96,7 +96,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -417,7 +417,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1002,7 +1002,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1244,7 +1244,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1510,7 +1510,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a2742f2d9f..e0809f4ab7 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -19,7 +19,7 @@ jobs: COV_DETAILS_PATH: ${{github.workspace}}/cov-details steps: - - uses: actions/checkout@v7.0.0 + - uses: actions/checkout@v7.0.1 - name: Setup run: | @@ -41,7 +41,6 @@ jobs: run: | cmake --build ${{github.workspace}}/build --target c_example cmake --build ${{github.workspace}}/build --target cpp_example - cmake --build ${{github.workspace}}/build --target z3_tptp5 cmake --build ${{github.workspace}}/build --target c_maxsat_example - name: Clone z3test @@ -59,7 +58,6 @@ jobs: - name: Run examples run: | ${{github.workspace}}/build/examples/cpp_example_build_dir/cpp_example - ${{github.workspace}}/build/examples/tptp_build_dir/z3_tptp5 --help ${{github.workspace}}/build/examples/c_maxsat_example_build_dir/c_maxsat_example ${{github.workspace}}/examples/maxsat/ex.smt - name: Run regressions diff --git a/.github/workflows/cross-build.yml b/.github/workflows/cross-build.yml index 49eb7f1819..f3ef5b851d 100644 --- a/.github/workflows/cross-build.yml +++ b/.github/workflows/cross-build.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Install cross build tools run: apt update && apt install -y ninja-build cmake python3 g++-13-${{ matrix.arch }}-linux-gnu diff --git a/.github/workflows/csa-analysis.lock.yml b/.github/workflows/csa-analysis.lock.yml index 6029438fe9..520855015c 100644 --- a/.github/workflows/csa-analysis.lock.yml +++ b/.github/workflows/csa-analysis.lock.yml @@ -1,5 +1,5 @@ # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"921c82afd93af5f7d8ff2beb5cba8b71448c7fa58d4344906c25fdb5db93a6d2","body_hash":"7bd8b9447fe00aa65ec93cc2395383cc140747c7afce9a58d4f6f87e4d2c59a5","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -41,7 +41,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -54,7 +54,7 @@ name: "Clang Static Analyzer (CSA) Report" on: schedule: - - cron: "41 2 * * 0" + - cron: "9 13 * * 5" # Friendly format: weekly (scattered) workflow_dispatch: inputs: @@ -97,7 +97,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -421,7 +421,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1042,7 +1042,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1287,7 +1287,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1553,7 +1553,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1629,7 +1629,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 153a6ee5dc..0437468178 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -21,10 +21,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Go - uses: actions/setup-go@v6 + uses: actions/setup-go@v7 with: go-version: '1.21' @@ -46,10 +46,10 @@ jobs: needs: build-go-docs steps: - name: Checkout - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup node - uses: actions/setup-node@v6 + uses: actions/setup-node@v7 with: node-version: "lts/*" diff --git a/.github/workflows/fstar-master-build.yml b/.github/workflows/fstar-master-build.yml index fe229a153d..8b844e33c7 100644 --- a/.github/workflows/fstar-master-build.yml +++ b/.github/workflows/fstar-master-build.yml @@ -16,11 +16,11 @@ on: z3_runtime_args: description: "Extra Z3 runtime args (example: smt.ho_matching=true)" required: false - default: "smt.ho_matching=true" + default: "smt.ho_matching=false" fstar_ref: description: FStar ref to checkout and build required: false - default: _nik_higher_order_smt + default: master fstar_opam_switch: description: OCaml switch for FStar build required: false @@ -29,6 +29,10 @@ on: description: "Extra FStar OTHERFLAGS" required: false default: "--split_queries on_failure --log_failing_queries --ext higher_order_smt --proof_recovery" + fstar_run_tests: + description: "Run the FStar test suite (make test) after the build" + required: false + default: "true" discussion_category: description: Discussion category name required: false @@ -49,14 +53,15 @@ jobs: env: Z3_REF: ${{ github.event.inputs.z3_ref || 'master' }} Z3_CMAKE_ARGS: ${{ github.event.inputs.z3_cmake_args || '' }} - Z3_RUNTIME_ARGS: ${{ github.event.inputs.z3_runtime_args || 'smt.ho_matching=true' }} + Z3_RUNTIME_ARGS: ${{ github.event.inputs.z3_runtime_args || 'smt.ho_matching=false' }} FSTAR_REF: ${{ github.event.inputs.fstar_ref || 'master' }} FSTAR_OPAM_SWITCH: ${{ github.event.inputs.fstar_opam_switch || '4.14.2' }} - FSTAR_OTHERFLAGS: ${{ github.event.inputs.fstar_otherflags || '' }} + FSTAR_OTHERFLAGS: ${{ github.event.inputs.fstar_otherflags || '--split_queries on_failure --log_failing_queries --ext higher_order_smt --proof_recovery' }} + FSTAR_RUN_TESTS: ${{ github.event.inputs.fstar_run_tests || 'true' }} DISCUSSION_CATEGORY: ${{ github.event.inputs.discussion_category || 'Agentic Workflows' }} steps: - name: Checkout Z3 - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 with: ref: ${{ env.Z3_REF }} fetch-depth: 1 @@ -107,6 +112,20 @@ jobs: test -x /tmp/gh-aw/agent/FStar/out/bin/fstar.exe || { echo "Error: FStar binary not found or not executable at /tmp/gh-aw/agent/FStar/out/bin/fstar.exe"; exit 1; } /tmp/gh-aw/agent/FStar/out/bin/fstar.exe --version | tee /tmp/gh-aw/agent/fstar-version.txt + - name: Run FStar test suite + id: test_fstar + if: env.FSTAR_RUN_TESTS == 'true' && steps.build_fstar.outcome == 'success' + continue-on-error: true + run: | + set -euo pipefail + cd /tmp/gh-aw/agent/FStar + eval "$(opam env --switch="$FSTAR_OPAM_SWITCH")" + + Z3_VERSION="$(sed -E -n 's/^Z3 version ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' /tmp/gh-aw/agent/z3-version.txt | head -1)" + test -n "$Z3_VERSION" || { echo "Error: Failed to extract Z3 version from /tmp/gh-aw/agent/z3-version.txt (expected: 'Z3 version X.Y.Z')"; exit 1; } + + PATH="/tmp/gh-aw/agent/z3-bin:$PATH" OTHERFLAGS="--z3version $Z3_VERSION $FSTAR_OTHERFLAGS" make -j"$(nproc)" -k test 2>&1 | tee /tmp/gh-aw/agent/fstar-test.log + - name: Collect generated SMT2 files id: collect_smt2 if: always() @@ -160,6 +179,7 @@ jobs: env: RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} FSTAR_BUILD_OUTCOME: ${{ steps.build_fstar.outcome }} + FSTAR_TEST_OUTCOME: ${{ steps.test_fstar.outcome }} SMT2_ARTIFACT_ID: ${{ steps.upload_smt2.outputs.artifact-id }} with: script: | @@ -176,10 +196,31 @@ jobs: const fstarStatus = fstarBuildSucceeded ? '✅ FStar build completed' : `⚠️ FStar build ${fstarBuildOutcome} (pipeline continued)`; + const fstarTestOutcome = process.env.FSTAR_TEST_OUTCOME || 'skipped'; + const fstarTestStatus = fstarTestOutcome === 'success' + ? '✅ FStar test suite (`make test`) passed' + : fstarTestOutcome === 'skipped' + ? 'ℹ️ FStar test suite (`make test`) skipped' + : `⚠️ FStar test suite (\`make test\`) ${fstarTestOutcome} (pipeline continued)`; + const testLog = readIfExists('/tmp/gh-aw/agent/fstar-test.log') ?? ''; + const maxTestLogChars = 8000; + let testLogTail = testLog ? testLog.split('\n').slice(-200).join('\n') : ''; + if (testLogTail.length > maxTestLogChars) { + testLogTail = `... (truncated)\n${testLogTail.slice(-maxTestLogChars)}`; + } + const testSection = testLog + ? [ + `### FStar test suite (last 200 log lines)`, + ``, + '```', + testLogTail, + '```' + ].join('\n') + : ''; const smt2ArtifactId = (process.env.SMT2_ARTIFACT_ID || '').trim(); const smt2ArtifactUrl = smt2ArtifactId ? `${process.env.RUN_URL}/artifacts/${smt2ArtifactId}` : ''; const smt2PreviewFile = '/tmp/gh-aw/agent/smt2-preview.md'; - const maxPreviewChars = 55000; // Keep below GitHub's 65536-character discussion body limit, leaving room for non-preview sections. + const maxPreviewChars = 45000; // Keep below GitHub's 65536-character discussion body limit, leaving room for the test log tail and other sections. let smt2Preview = readIfExists(smt2PreviewFile) ?? ''; const smt2PreviewChars = Array.from(smt2Preview); if (smt2PreviewChars.length > maxPreviewChars) { @@ -227,6 +268,7 @@ jobs: `### Build status`, `- ✅ Z3 build completed`, `- ${fstarStatus}`, + `- ${fstarTestStatus}`, ``, `### Inputs used`, `- z3_ref: \`${process.env.Z3_REF}\``, @@ -235,6 +277,7 @@ jobs: `- fstar_ref: \`${process.env.FSTAR_REF}\``, `- fstar_opam_switch: \`${process.env.FSTAR_OPAM_SWITCH}\``, `- fstar_otherflags: \`${process.env.FSTAR_OTHERFLAGS}\``, + `- fstar_run_tests: \`${process.env.FSTAR_RUN_TESTS}\``, ``, `### Produced versions`, `- Z3: \`${z3VersionText}\``, @@ -243,6 +286,8 @@ jobs: ``, smt2Section, ``, + testSection, + ``, `### Run`, `- Workflow run: ${process.env.RUN_URL}` ].join('\n'); diff --git a/.github/workflows/issue-backlog-processor.lock.yml b/.github/workflows/issue-backlog-processor.lock.yml index 4e3ef8b588..2b852a3aed 100644 --- a/.github/workflows/issue-backlog-processor.lock.yml +++ b/.github/workflows/issue-backlog-processor.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"7671ab751a3f717291cd8f191c4619897acdb7e712fc38c87b9806d95f2b1e0f","body_hash":"0c085cd0722df29959ce10ad54f82dea6ecc84782a1f749d14ad8c1d000b7a6f","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"3d3c5b7851167f298294e9fd54c9f35abf4d43afab31d72ada8ed671fb766a49","body_hash":"0c085cd0722df29959ce10ad54f82dea6ecc84782a1f749d14ad8c1d000b7a6f","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} +# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -26,7 +26,6 @@ # Processes the backlog of open issues every second day, creates a discussion with findings, and comments on relevant issues # # Secrets used: -# - COPILOT_GITHUB_TOKEN # - GH_AW_GITHUB_MCP_SERVER_TOKEN # - GH_AW_GITHUB_TOKEN # - GITHUB_TOKEN @@ -41,7 +40,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -89,7 +88,6 @@ jobs: engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} model: ${{ steps.generate_aw_info.outputs.model }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} @@ -97,7 +95,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -178,11 +176,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs'); await main(); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Checkout .github and .agents folders uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -386,7 +379,12 @@ jobs: needs: activation if: needs.activation.outputs.daily_ai_credits_exceeded != 'true' runs-on: ubuntu-latest - permissions: read-all + permissions: + contents: read + copilot-requests: write + discussions: read + issues: read + pull-requests: read concurrency: group: "gh-aw-copilot-${{ github.workflow }}" queue: max @@ -421,7 +419,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -840,7 +838,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} @@ -864,6 +862,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Detect agent errors if: always() @@ -899,8 +898,7 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); await main(); env: - GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' - SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_SECRET_NAMES: 'GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -1065,7 +1063,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1255,7 +1253,6 @@ jobs: GH_AW_WORKFLOW_ID: "issue-backlog-processor" GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" GH_AW_ENGINE_ID: "copilot" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }} @@ -1299,6 +1296,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + copilot-requests: write env: GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} outputs: @@ -1309,7 +1307,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1461,7 +1459,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }} @@ -1483,6 +1481,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Parse threat detection token usage for step summary id: parse_detection_token_usage @@ -1578,7 +1577,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1654,7 +1653,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/issue-backlog-processor.md b/.github/workflows/issue-backlog-processor.md index 741dc3a2be..a2ce534a96 100644 --- a/.github/workflows/issue-backlog-processor.md +++ b/.github/workflows/issue-backlog-processor.md @@ -5,7 +5,12 @@ on: schedule: every 2 days workflow_dispatch: -permissions: read-all +permissions: + contents: read + issues: read + pull-requests: read + discussions: read + copilot-requests: write tools: cache-memory: true diff --git a/.github/workflows/memory-safety-report.lock.yml b/.github/workflows/memory-safety-report.lock.yml index 0c03c3a0dc..8835d8e17b 100644 --- a/.github/workflows/memory-safety-report.lock.yml +++ b/.github/workflows/memory-safety-report.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"bf4e07c175bf2df0066b9ef403e92420d018538f3b995eb46400085af5355060","body_hash":"f43683a4995003e2678ccce2706b639eb627b48daeafc7f9dded40d4508ef26c","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"ed2a6bc12ab729225e9004d05fcb1fd8e3740220824c281cf4a54f7bc0ee7f81","body_hash":"f43683a4995003e2678ccce2706b639eb627b48daeafc7f9dded40d4508ef26c","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} +# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -29,7 +29,6 @@ # - GH_TOKEN: (main workflow) # # Secrets used: -# - COPILOT_GITHUB_TOKEN # - GH_AW_GITHUB_MCP_SERVER_TOKEN # - GH_AW_GITHUB_TOKEN # - GITHUB_TOKEN @@ -44,7 +43,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -105,7 +104,6 @@ jobs: engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} model: ${{ steps.generate_aw_info.outputs.model }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} @@ -113,7 +111,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -196,11 +194,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs'); await main(); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Checkout .github and .agents folders uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -413,6 +406,7 @@ jobs: permissions: actions: read contents: read + copilot-requests: write issues: read pull-requests: read concurrency: @@ -449,7 +443,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -859,7 +853,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} @@ -883,6 +877,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Detect agent errors if: always() @@ -918,8 +913,7 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); await main(); env: - GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' - SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_SECRET_NAMES: 'GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -1083,7 +1077,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1274,7 +1268,6 @@ jobs: GH_AW_WORKFLOW_ID: "memory-safety-report" GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" GH_AW_ENGINE_ID: "copilot" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }} @@ -1316,6 +1309,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + copilot-requests: write env: GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} outputs: @@ -1326,7 +1320,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1478,7 +1472,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }} @@ -1500,6 +1494,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Parse threat detection token usage for step summary id: parse_detection_token_usage @@ -1567,7 +1562,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1629,7 +1624,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1705,7 +1700,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/memory-safety-report.md b/.github/workflows/memory-safety-report.md index 8e31ea64f3..74999516ca 100644 --- a/.github/workflows/memory-safety-report.md +++ b/.github/workflows/memory-safety-report.md @@ -18,6 +18,7 @@ permissions: contents: read issues: read pull-requests: read + copilot-requests: write env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/memory-safety.yml b/.github/workflows/memory-safety.yml index 6c62a93d2d..c2b9674d05 100644 --- a/.github/workflows/memory-safety.yml +++ b/.github/workflows/memory-safety.yml @@ -31,10 +31,10 @@ jobs: ASAN_OPTIONS: "detect_leaks=1:halt_on_error=0:print_stats=1:log_path=/tmp/asan" steps: - name: Checkout repository - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -121,10 +121,10 @@ jobs: UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=0:log_path=/tmp/ubsan" steps: - name: Checkout repository - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' diff --git a/.github/workflows/msvc-static-build-clang-cl.yml b/.github/workflows/msvc-static-build-clang-cl.yml index c2ba9b901a..8e647fc320 100644 --- a/.github/workflows/msvc-static-build-clang-cl.yml +++ b/.github/workflows/msvc-static-build-clang-cl.yml @@ -14,7 +14,7 @@ jobs: BUILD_TYPE: Release steps: - name: Checkout Repo - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Build run: | diff --git a/.github/workflows/msvc-static-build.yml b/.github/workflows/msvc-static-build.yml index 3bca31eb2b..5ca6d64438 100644 --- a/.github/workflows/msvc-static-build.yml +++ b/.github/workflows/msvc-static-build.yml @@ -14,7 +14,7 @@ jobs: BUILD_TYPE: Release steps: - name: Checkout Repo - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Build run: | diff --git a/.github/workflows/nightly-validation.yml b/.github/workflows/nightly-validation.yml index f252f1a4a0..1107bd99c7 100644 --- a/.github/workflows/nightly-validation.yml +++ b/.github/workflows/nightly-validation.yml @@ -27,10 +27,10 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup .NET - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@v6 with: dotnet-version: '8.x' @@ -87,10 +87,10 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup .NET - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@v6 with: dotnet-version: '8.x' @@ -142,10 +142,10 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup .NET - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@v6 with: dotnet-version: '8.x' @@ -197,10 +197,10 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup .NET - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@v6 with: dotnet-version: '8.x' @@ -256,7 +256,7 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download Windows x64 build from release env: @@ -292,7 +292,7 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download Windows x86 build from release env: @@ -328,7 +328,7 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download Ubuntu x64 build from release env: @@ -361,7 +361,7 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download macOS x64 build from release env: @@ -394,7 +394,7 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download macOS ARM64 build from release env: @@ -431,10 +431,10 @@ jobs: timeout-minutes: 60 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -470,10 +470,10 @@ jobs: timeout-minutes: 60 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -510,10 +510,10 @@ jobs: timeout-minutes: 60 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -553,10 +553,10 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -582,10 +582,10 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -601,6 +601,14 @@ jobs: - name: Install and test wheel run: | + # Nightly wheels are tagged with the exact deployment target (e.g. + # macosx_13_3), but pip only recognizes major.0 platform tags such as + # macosx_13_0. Rewrite the unsupported minor version so the wheel is + # installable, mirroring the rename done in nightly.yml. + for whl in wheels/*-macosx_13_3_*.whl; do + [ -e "$whl" ] || continue + mv "$whl" "${whl/macosx_13_3_/macosx_13_0_}" + done pip install wheels/*.whl python -c "import z3; x = z3.Int('x'); s = z3.Solver(); s.add(x > 0); print('Result:', s.check()); print('Model:', s.model())" @@ -611,10 +619,10 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -630,6 +638,14 @@ jobs: - name: Install and test wheel run: | + # Nightly wheels are tagged with the exact deployment target (e.g. + # macosx_13_3), but pip only recognizes major.0 platform tags such as + # macosx_13_0. Rewrite the unsupported minor version so the wheel is + # installable, mirroring the rename done in nightly.yml. + for whl in wheels/*-macosx_13_3_*.whl; do + [ -e "$whl" ] || continue + mv "$whl" "${whl/macosx_13_3_/macosx_13_0_}" + done pip install wheels/*.whl python -c "import z3; x = z3.Int('x'); s = z3.Solver(); s.add(x > 0); print('Result:', s.check()); print('Model:', s.model())" @@ -640,10 +656,10 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -672,10 +688,10 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -727,7 +743,7 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download macOS x64 build from release env: @@ -779,7 +795,7 @@ jobs: timeout-minutes: 30 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download macOS ARM64 build from release env: @@ -835,10 +851,10 @@ jobs: timeout-minutes: 10 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -856,7 +872,7 @@ jobs: timeout-minutes: 15 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download NuGet package from release env: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b3d1b318a0..95f31dd5c0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -24,9 +24,9 @@ permissions: contents: write env: - MAJOR: '4' - MINOR: '17' - PATCH: '1' + MAJOR: '5' + MINOR: '0' + PATCH: '0' jobs: # ============================================================================ @@ -41,10 +41,10 @@ jobs: MACOSX_DEPLOYMENT_TARGET: "13.3" steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -79,10 +79,10 @@ jobs: MACOSX_DEPLOYMENT_TARGET: "13.3" steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -120,7 +120,7 @@ jobs: timeout-minutes: 15 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download macOS x64 Build uses: actions/download-artifact@v8.0.1 @@ -179,7 +179,7 @@ jobs: timeout-minutes: 15 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download macOS ARM64 Build uses: actions/download-artifact@v8.0.1 @@ -237,10 +237,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -266,10 +266,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -301,10 +301,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -357,7 +357,7 @@ jobs: container: quay.io/pypa/manylinux_2_28_x86_64:latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Select Python run: | @@ -395,7 +395,7 @@ jobs: container: quay.io/pypa/manylinux_2_28_x86_64:latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download ARM toolchain run: curl -L -o /tmp/arm-toolchain.tar.xz 'https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz' @@ -443,7 +443,7 @@ jobs: container: quay.io/pypa/manylinux_2_28_x86_64:latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download RISC-V toolchain run: curl -L -o /tmp/riscv-toolchain.tar.gz 'https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.09.03/riscv64-glibc-ubuntu-20.04-gcc-nightly-2024.09.03-nightly.tar.gz' @@ -497,10 +497,10 @@ jobs: timeout-minutes: 120 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -524,10 +524,10 @@ jobs: timeout-minutes: 120 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -551,10 +551,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -582,10 +582,10 @@ jobs: runs-on: windows-latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -657,10 +657,10 @@ jobs: runs-on: windows-latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -702,10 +702,10 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -817,7 +817,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download all artifacts uses: actions/download-artifact@v8.0.1 diff --git a/.github/workflows/nuget-build.yml b/.github/workflows/nuget-build.yml deleted file mode 100644 index 20f19afb59..0000000000 --- a/.github/workflows/nuget-build.yml +++ /dev/null @@ -1,260 +0,0 @@ -name: Build NuGet Package - -on: - workflow_dispatch: - inputs: - version: - description: 'Version number for the NuGet package (e.g., 4.17.1)' - required: true - default: '4.17.1' - push: - tags: - - 'z3-*' - -permissions: - contents: write - -jobs: - # Build Windows binaries - build-windows-x64: - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v7.0.0 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.x' - - - name: Build Windows x64 - shell: cmd - run: | - for /f "usebackq delims=" %%i in (`"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSPATH=%%i" - call "%VSPATH%\VC\Auxiliary\Build\vcvarsall.bat" x64 || exit /b 1 - python scripts\mk_win_dist.py --x64-only --dotnet-key=%GITHUB_WORKSPACE%\resources\z3.snk --assembly-version=${{ github.event.inputs.version || '4.17.1' }} --zip - - - name: Upload Windows x64 artifact - uses: actions/upload-artifact@v7 - with: - name: windows-x64 - path: dist/*.zip - retention-days: 1 - - build-windows-x86: - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v7.0.0 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.x' - - - name: Build Windows x86 - shell: cmd - run: | - for /f "usebackq delims=" %%i in (`"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSPATH=%%i" - call "%VSPATH%\VC\Auxiliary\Build\vcvarsall.bat" x86 || exit /b 1 - python scripts\mk_win_dist.py --x86-only --dotnet-key=%GITHUB_WORKSPACE%\resources\z3.snk --assembly-version=${{ github.event.inputs.version || '4.17.1' }} --zip - - - name: Upload Windows x86 artifact - uses: actions/upload-artifact@v7 - with: - name: windows-x86 - path: dist/*.zip - retention-days: 1 - - build-windows-arm64: - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v7.0.0 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.x' - - - name: Build Windows ARM64 - shell: cmd - run: | - for /f "usebackq delims=" %%i in (`"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSPATH=%%i" - call "%VSPATH%\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64 || exit /b 1 - python scripts\mk_win_dist_cmake.py --arm64-only --dotnet-key=%GITHUB_WORKSPACE%\resources\z3.snk --assembly-version=${{ github.event.inputs.version || '4.17.1' }} --zip - - - name: Upload Windows ARM64 artifact - uses: actions/upload-artifact@v7 - with: - name: windows-arm64 - path: build-dist\arm64\dist\*.zip - retention-days: 1 - - build-ubuntu: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v7.0.0 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.x' - - - name: Build Ubuntu - run: python scripts/mk_unix_dist.py --dotnet-key=$GITHUB_WORKSPACE/resources/z3.snk - - - name: Upload Ubuntu artifact - uses: actions/upload-artifact@v7 - with: - name: ubuntu - path: dist/*.zip - retention-days: 1 - - build-macos-x64: - runs-on: macos-14 - steps: - - name: Checkout code - uses: actions/checkout@v7.0.0 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.x' - - - name: Build macOS x64 - run: python scripts/mk_unix_dist.py --dotnet-key=$GITHUB_WORKSPACE/resources/z3.snk - - - name: Upload macOS x64 artifact - uses: actions/upload-artifact@v7 - with: - name: macos-x64 - path: dist/*.zip - retention-days: 1 - - build-macos-arm64: - runs-on: macos-14 - steps: - - name: Checkout code - uses: actions/checkout@v7.0.0 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.x' - - - name: Build macOS ARM64 - run: python scripts/mk_unix_dist.py --dotnet-key=$GITHUB_WORKSPACE/resources/z3.snk --arch=arm64 - - - name: Upload macOS ARM64 artifact - uses: actions/upload-artifact@v7 - with: - name: macos-arm64 - path: dist/*.zip - retention-days: 1 - - # Package NuGet x64 (includes all platforms except x86) - package-nuget-x64: - needs: [build-windows-x64, build-windows-arm64, build-ubuntu, build-macos-x64, build-macos-arm64] - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v7.0.0 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.x' - - - name: Download all artifacts - uses: actions/download-artifact@v8.0.1 - with: - path: packages - - - name: List downloaded artifacts - shell: bash - run: find packages -type f - - - name: Move artifacts to flat directory - shell: bash - run: | - mkdir -p package-files - find packages -name "*.zip" -exec cp {} package-files/ \; - ls -la package-files/ - - - name: Setup NuGet - uses: nuget/setup-nuget@v4 - with: - nuget-version: 'latest' - - - name: Assemble NuGet package - shell: cmd - run: | - cd package-files - python ..\scripts\mk_nuget_task.py . ${{ github.event.inputs.version || '4.17.1' }} https://github.com/Z3Prover/z3 ${{ github.ref_name }} ${{ github.sha }} ${{ github.workspace }} symbols - - - name: Pack NuGet package - shell: cmd - run: | - cd package-files - nuget pack out\Microsoft.Z3.sym.nuspec -OutputDirectory . -Verbosity detailed -Symbols -SymbolPackageFormat snupkg -BasePath out - - - name: Upload NuGet package - uses: actions/upload-artifact@v7 - with: - name: nuget-x64 - path: | - package-files/*.nupkg - package-files/*.snupkg - retention-days: 30 - - # Package NuGet x86 - package-nuget-x86: - needs: [build-windows-x86] - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v7.0.0 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.x' - - - name: Download x86 artifact - uses: actions/download-artifact@v8.0.1 - with: - name: windows-x86 - path: packages - - - name: List downloaded artifacts - shell: bash - run: find packages -type f - - - name: Setup NuGet - uses: nuget/setup-nuget@v4 - with: - nuget-version: 'latest' - - - name: Assemble NuGet package - shell: cmd - run: | - cd packages - python ..\scripts\mk_nuget_task.py . ${{ github.event.inputs.version || '4.17.1' }} https://github.com/Z3Prover/z3 ${{ github.ref_name }} ${{ github.sha }} ${{ github.workspace }} symbols x86 - - - name: Pack NuGet package - shell: cmd - run: | - cd packages - nuget pack out\Microsoft.Z3.x86.sym.nuspec -OutputDirectory . -Verbosity detailed -Symbols -SymbolPackageFormat snupkg -BasePath out - - - name: Upload NuGet package - uses: actions/upload-artifact@v7 - with: - name: nuget-x86 - path: | - packages/*.nupkg - packages/*.snupkg - retention-days: 30 - diff --git a/.github/workflows/ocaml.yaml b/.github/workflows/ocaml.yaml index 243a342268..0d61c4a72c 100644 --- a/.github/workflows/ocaml.yaml +++ b/.github/workflows/ocaml.yaml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 # Cache ccache (shared across runs) - name: Cache ccache diff --git a/.github/workflows/ostrich-benchmark.lock.yml b/.github/workflows/ostrich-benchmark.lock.yml index da1919de6d..6819c843da 100644 --- a/.github/workflows/ostrich-benchmark.lock.yml +++ b/.github/workflows/ostrich-benchmark.lock.yml @@ -1,5 +1,5 @@ # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"78d9be12902490ac2e6792e6c0b0cbdc0007a49a6b5b27de7043d7e5f5917cfd","body_hash":"c57d701ac052e7a63092ff6b17a06bdb4588fd7ac8c1d366bfc2995f72a1b379","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -41,7 +41,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -96,7 +96,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -408,7 +408,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -996,7 +996,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1238,7 +1238,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1504,7 +1504,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/pyodide-pypi.yml b/.github/workflows/pyodide-pypi.yml index 8ae3f6f16d..4f77d96257 100644 --- a/.github/workflows/pyodide-pypi.yml +++ b/.github/workflows/pyodide-pypi.yml @@ -18,7 +18,7 @@ jobs: build-pyodide: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v7.0.0 + - uses: actions/checkout@v7.0.1 - name: Build Pyodide wheel uses: pypa/cibuildwheel@v4.1.0 diff --git a/.github/workflows/qf-s-benchmark.lock.yml b/.github/workflows/qf-s-benchmark.lock.yml deleted file mode 100644 index 1923215976..0000000000 --- a/.github/workflows/qf-s-benchmark.lock.yml +++ /dev/null @@ -1,1572 +0,0 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"d46f6f1f939df67ce5b7bf1e8073ba03c5631381df51d9711a1c2091400233f7","body_hash":"31e198b5f33dc3ac3830a2e6f90bb70ca3e7947b5ba4ee113ca0fdab61ac0467","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} -# This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md -# -# ___ _ _ -# / _ \ | | (_) -# | |_| | __ _ ___ _ __ | |_ _ ___ -# | _ |/ _` |/ _ \ '_ \| __| |/ __| -# | | | | (_| | __/ | | | |_| | (__ -# \_| |_/\__, |\___|_| |_|\__|_|\___| -# __/ | -# _ _ |___/ -# | | | | / _| | -# | | | | ___ _ __ _ __| |_| | _____ ____ -# | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___| -# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \ -# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/ -# -# -# To update this file, edit the corresponding .md file and run: -# gh aw compile -# Not all edits will cause changes to this file. -# -# For more information: https://github.github.com/gh-aw/introduction/overview/ -# -# Benchmark Z3 seq vs nseq string solvers on QF_S test suite from the c3 branch and post results as a GitHub discussion -# -# Secrets used: -# - COPILOT_GITHUB_TOKEN -# - GH_AW_GITHUB_MCP_SERVER_TOKEN -# - GH_AW_GITHUB_TOKEN -# - GITHUB_TOKEN -# -# Custom actions used: -# - actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 -# - actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 -# - actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 -# - actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 -# - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 -# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 -# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) -# - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 -# - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 -# -# Container images used: -# - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 -# - ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d -# - ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d -# - ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be -# - ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b -# - ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036 - -name: "QF_S String Solver Benchmark" -on: - schedule: - - cron: "0 0,12 * * *" - workflow_dispatch: - inputs: - aw_context: - default: "" - description: "Agent caller context (used internally by Agentic Workflows)." - required: false - type: string - -permissions: {} - -concurrency: - group: "gh-aw-${{ github.workflow }}" - -run-name: "QF_S String Solver Benchmark" - -jobs: - activation: - runs-on: ubuntu-slim - permissions: - actions: read - contents: read - env: - GH_AW_MAX_DAILY_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_DAILY_AI_CREDITS || '5000' }} - GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} - outputs: - comment_id: "" - comment_repo: "" - daily_ai_credits_exceeded: ${{ steps.daily-effective-workflow-guardrail.outputs.daily_ai_credits_exceeded == 'true' }} - daily_ai_credits_threshold: ${{ steps.daily-effective-workflow-guardrail.outputs.daily_ai_credits_threshold || '' }} - daily_ai_credits_total_effective_tokens: ${{ steps.daily-effective-workflow-guardrail.outputs.daily_ai_credits_total_effective_tokens || '' }} - engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} - lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} - model: ${{ steps.generate_aw_info.outputs.model }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} - setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} - setup-span-id: ${{ steps.setup.outputs.span-id }} - setup-trace-id: ${{ steps.setup.outputs.trace-id }} - stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }} - steps: - - name: Setup Scripts - id: setup - uses: github/gh-aw-actions/setup@v0.81.6 - with: - destination: ${{ runner.temp }}/gh-aw/actions - job-name: ${{ github.job }} - safe-output-artifact-client: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} - env: - GH_AW_SETUP_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/qf-s-benchmark.lock.yml@${{ github.ref }} - GH_AW_INFO_VERSION: "1.0.65" - GH_AW_INFO_AWF_VERSION: "v0.27.11" - GH_AW_INFO_ENGINE_ID: "copilot" - - name: Generate agentic run info - id: generate_aw_info - env: - GH_AW_INFO_ENGINE_ID: "copilot" - GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI" - GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} - GH_AW_INFO_VERSION: "1.0.65" - GH_AW_INFO_AGENT_VERSION: "1.0.65" - GH_AW_INFO_CLI_VERSION: "v0.81.6" - GH_AW_INFO_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_INFO_EXPERIMENTAL: "false" - GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true" - GH_AW_INFO_STAGED: "false" - GH_AW_INFO_ALLOWED_DOMAINS: '["defaults"]' - GH_AW_INFO_FIREWALL_ENABLED: "true" - GH_AW_INFO_AWF_VERSION: "v0.27.11" - GH_AW_INFO_AWMG_VERSION: "" - GH_AW_INFO_FIREWALL_TYPE: "squid" - GH_AW_COMPILED_STRICT: "true" - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_aw_info.cjs'); - await main(core, context); - - name: Restore daily AIC usage cache - id: restore-daily-aic-cache - if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} - continue-on-error: true - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - key: agentic-workflow-usage-qfsbenchmark-${{ github.run_id }} - restore-keys: agentic-workflow-usage-qfsbenchmark- - path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl - - name: Restore daily AIC usage cache (artifact fallback) - id: restore-daily-aic-cache-fallback - if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} - continue-on-error: true - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }} - GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }} - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/restore_aic_usage_cache_fallback.cjs'); - await main(); - - name: Check daily workflow token guardrail - id: daily-effective-workflow-guardrail - if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_WORKFLOW_ID: "qf-s-benchmark" - GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - GH_AW_WORKFLOW_DISPATCH_AW_CONTEXT: ${{ github.event.inputs.aw_context || '' }} - GH_AW_HAS_SLASH_COMMAND: "false" - GH_AW_HAS_LABEL_COMMAND: "false" - GH_AW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_AW_MAX_DAILY_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_DAILY_AI_CREDITS || '5000' }} - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs'); - await main(); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - - name: Checkout .github and .agents folders - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - sparse-checkout: | - .github - .agents - .antigravity - .claude - .codex - .crush - .gemini - .opencode - .pi - sparse-checkout-cone-mode: true - fetch-depth: 1 - - name: Save agent config folders for base branch restoration - env: - GH_AW_AGENT_FOLDERS: ".agents .antigravity .claude .codex .crush .gemini .github .opencode .pi" - GH_AW_AGENT_FILES: ".crush.json AGENTS.md ANTIGRAVITY.md CLAUDE.md GEMINI.md PI.md opencode.jsonc" - # poutine:ignore untrusted_checkout_exec - run: bash "${RUNNER_TEMP}/gh-aw/actions/save_base_github_folders.sh" - - name: Check workflow lock file - id: check-lock-file - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_WORKFLOW_FILE: "qf-s-benchmark.lock.yml" - GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}" - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/check_workflow_timestamp_api.cjs'); - await main(); - - name: Check compile-agentic version - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_COMPILED_VERSION: "v0.81.6" - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/check_version_updates.cjs'); - await main(); - - name: Log runtime features - if: ${{ contains(toJSON(vars), '"GH_AW_RUNTIME_FEATURES":') }} - run: bash "${RUNNER_TEMP}/gh-aw/actions/log_runtime_features_summary.sh" - - name: Create prompt with built-in context - env: - GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt - GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl - GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} - GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} - GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} - GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }} - GH_AW_GITHUB_ACTOR: ${{ github.actor }} - GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} - GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} - GH_AW_GITHUB_WORKFLOW: ${{ github.workflow }} - GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} - # poutine:ignore untrusted_checkout_exec - run: | - bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" - { - cat << 'GH_AW_PROMPT_5a6a0f70a2d06d17_EOF' - - GH_AW_PROMPT_5a6a0f70a2d06d17_EOF - cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" - cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" - cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" - cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_5a6a0f70a2d06d17_EOF' - - Tools: create_discussion, missing_tool, missing_data, noop - - GH_AW_PROMPT_5a6a0f70a2d06d17_EOF - cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md" - cat << 'GH_AW_PROMPT_5a6a0f70a2d06d17_EOF' - - The following GitHub context information is available for this workflow: - {{#if github.actor}} - - **actor**: __GH_AW_GITHUB_ACTOR__ - {{/if}} - {{#if github.repository}} - - **repository**: __GH_AW_GITHUB_REPOSITORY__ - {{/if}} - {{#if github.workspace}} - - **workspace**: __GH_AW_GITHUB_WORKSPACE__ - {{/if}} - {{#if github.event.issue.number || (github.aw.context.item_type == 'issue' && github.aw.context.item_number)}} - - **issue-number**: #__GH_AW_EXPR_802A9F6A__ - {{/if}} - {{#if github.event.discussion.number || (github.aw.context.item_type == 'discussion' && github.aw.context.item_number)}} - - **discussion-number**: #__GH_AW_EXPR_1A3A194A__ - {{/if}} - {{#if github.event.pull_request.number || (github.aw.context.item_type == 'pull_request' && github.aw.context.item_number)}} - - **pull-request-number**: #__GH_AW_EXPR_463A214A__ - {{/if}} - {{#if github.event.comment.id || github.aw.context.comment_id}} - - **comment-id**: __GH_AW_EXPR_FF1D34CE__ - {{/if}} - {{#if github.run_id}} - - **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__ - {{/if}} - - - GH_AW_PROMPT_5a6a0f70a2d06d17_EOF - cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_5a6a0f70a2d06d17_EOF' - - {{#runtime-import .github/workflows/qf-s-benchmark.md}} - GH_AW_PROMPT_5a6a0f70a2d06d17_EOF - } > "$GH_AW_PROMPT" - - name: Interpolate variables and render templates - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt - GH_AW_ENGINE_ID: "copilot" - GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} - GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} - GH_AW_GITHUB_WORKFLOW: ${{ github.workflow }} - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/interpolate_prompt.cjs'); - await main(); - - name: Substitute placeholders - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt - GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} - GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} - GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} - GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }} - GH_AW_GITHUB_ACTOR: ${{ github.actor }} - GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} - GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} - GH_AW_GITHUB_WORKFLOW: ${{ github.workflow }} - GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} - GH_AW_MCP_CLI_SERVERS_LIST: '- `safeoutputs` — run `safeoutputs --help` to see available tools' - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - - const substitutePlaceholders = require('${{ runner.temp }}/gh-aw/actions/substitute_placeholders.cjs'); - - // Call the substitution function - return await substitutePlaceholders({ - file: process.env.GH_AW_PROMPT, - substitutions: { - GH_AW_EXPR_1A3A194A: process.env.GH_AW_EXPR_1A3A194A, - GH_AW_EXPR_463A214A: process.env.GH_AW_EXPR_463A214A, - GH_AW_EXPR_802A9F6A: process.env.GH_AW_EXPR_802A9F6A, - GH_AW_EXPR_FF1D34CE: process.env.GH_AW_EXPR_FF1D34CE, - GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR, - GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY, - GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID, - GH_AW_GITHUB_WORKFLOW: process.env.GH_AW_GITHUB_WORKFLOW, - GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE, - GH_AW_MCP_CLI_SERVERS_LIST: process.env.GH_AW_MCP_CLI_SERVERS_LIST - } - }); - - name: Validate prompt placeholders - env: - GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt - # poutine:ignore untrusted_checkout_exec - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_prompt_placeholders.sh" - - name: Print prompt - env: - GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt - # poutine:ignore untrusted_checkout_exec - run: bash "${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh" - - name: Upload activation artifact - if: success() - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: activation - include-hidden-files: true - path: | - /tmp/gh-aw/aw_info.json - /tmp/gh-aw/models.json - /tmp/gh-aw/aw-prompts/prompt.txt - /tmp/gh-aw/aw-prompts/prompt-template.txt - /tmp/gh-aw/aw-prompts/prompt-import-tree.json - /tmp/gh-aw/github_rate_limits.jsonl - /tmp/gh-aw/base - /tmp/gh-aw/.github/agents - /tmp/gh-aw/.github/skills - if-no-files-found: ignore - retention-days: 1 - - agent: - needs: activation - if: needs.activation.outputs.daily_ai_credits_exceeded != 'true' - runs-on: ubuntu-latest - permissions: read-all - concurrency: - group: "gh-aw-copilot-${{ github.workflow }}" - queue: max - env: - DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} - GH_AW_ASSETS_ALLOWED_EXTS: "" - GH_AW_ASSETS_BRANCH: "" - GH_AW_ASSETS_MAX_SIZE_KB: 0 - GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs - GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} - GH_AW_WORKFLOW_ID_SANITIZED: qfsbenchmark - outputs: - agentic_engine_timeout: ${{ steps.detect-agent-errors.outputs.agentic_engine_timeout || 'false' }} - ai_credits_rate_limit_error: ${{ steps.parse-mcp-gateway.outputs.ai_credits_rate_limit_error || 'false' }} - aic: ${{ steps.parse-mcp-gateway.outputs.aic }} - ambient_context: ${{ steps.parse-mcp-gateway.outputs.ambient_context }} - checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }} - effective_tokens: ${{ steps.parse-mcp-gateway.outputs.effective_tokens }} - has_patch: ${{ steps.collect_output.outputs.has_patch }} - inference_access_error: ${{ steps.detect-agent-errors.outputs.inference_access_error || 'false' }} - mcp_policy_error: ${{ steps.detect-agent-errors.outputs.mcp_policy_error || 'false' }} - model: ${{ needs.activation.outputs.model }} - model_not_supported_error: ${{ steps.detect-agent-errors.outputs.model_not_supported_error || 'false' }} - output: ${{ steps.collect_output.outputs.output }} - output_types: ${{ steps.collect_output.outputs.output_types }} - setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} - setup-span-id: ${{ steps.setup.outputs.span-id }} - setup-trace-id: ${{ steps.setup.outputs.trace-id }} - unknown_model_ai_credits: ${{ steps.parse-mcp-gateway.outputs.unknown_model_ai_credits || 'false' }} - steps: - - name: Setup Scripts - id: setup - uses: github/gh-aw-actions/setup@v0.81.6 - with: - destination: ${{ runner.temp }}/gh-aw/actions - job-name: ${{ github.job }} - trace-id: ${{ needs.activation.outputs.setup-trace-id }} - parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} - env: - GH_AW_SETUP_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/qf-s-benchmark.lock.yml@${{ github.ref }} - GH_AW_INFO_VERSION: "1.0.65" - GH_AW_INFO_AWF_VERSION: "v0.27.11" - GH_AW_INFO_ENGINE_ID: "copilot" - - name: Set runtime paths - id: set-runtime-paths - run: | - { - echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl" - echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" - echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json" - } >> "$GITHUB_OUTPUT" - - name: Create gh-aw temp directory - run: bash "${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh" - - name: Configure gh CLI for GitHub Enterprise - run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh" - env: - GH_TOKEN: ${{ github.token }} - - name: Checkout c3 branch - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 1 - persist-credentials: false - ref: c3 - - - name: Configure Git credentials - env: - GITHUB_REPOSITORY: ${{ github.repository }} - GITHUB_SERVER_URL: ${{ github.server_url }} - GITHUB_TOKEN: ${{ github.token }} - run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh" - - name: Checkout PR branch - id: checkout-pr - if: | - github.event.pull_request || github.event.issue.pull_request || github.event_name == 'workflow_dispatch' && fromJSON(github.event.inputs.aw_context || '{}').item_type == 'pull_request' - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - with: - github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/checkout_pr_branch.cjs'); - await main(); - - name: Install GitHub Copilot CLI - run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.65 - env: - GH_HOST: github.com - - name: Install AWF binary - run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.27.11 - - name: Determine automatic lockdown mode for GitHub MCP Server - id: determine-automatic-lockdown - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) - env: - GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} - GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} - with: - script: | - const determineAutomaticLockdown = require('${{ runner.temp }}/gh-aw/actions/determine_automatic_lockdown.cjs'); - await determineAutomaticLockdown(github, context, core); - - name: Download activation artifact - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: activation - path: /tmp/gh-aw - - name: Restore agent config folders from base branch - if: steps.checkout-pr.outcome == 'success' - env: - GH_AW_AGENT_FOLDERS: ".agents .antigravity .claude .codex .crush .gemini .github .opencode .pi" - GH_AW_AGENT_FILES: ".crush.json AGENTS.md ANTIGRAVITY.md CLAUDE.md GEMINI.md PI.md opencode.jsonc" - run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_base_github_folders.sh" - - name: Restore inline sub-agents from activation artifact - env: - GH_AW_SUB_AGENT_DIR: ".github/agents" - GH_AW_SUB_AGENT_EXT: ".agent.md" - run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_sub_agents.sh" - - name: Restore inline skills from activation artifact - env: - GH_AW_SKILL_DIR: ".github/skills" - run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_skills.sh" - - name: Download container images - run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036 - - name: Generate Safe Outputs Config - run: | - mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" - mkdir -p /tmp/gh-aw/safeoutputs - mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs - cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_1bab4c882b24ea44_EOF' - {"create_discussion":{"category":"agentic workflows","close_older_discussions":true,"expires":168,"fallback_to_issue":true,"max":1,"title_prefix":"[QF_S Benchmark] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"false"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_1bab4c882b24ea44_EOF - - name: Generate Safe Outputs Tools - env: - GH_AW_TOOLS_META_JSON: | - { - "description_suffixes": { - "create_discussion": " CONSTRAINTS: Maximum 1 discussion(s) can be created. Title will be prefixed with \"[QF_S Benchmark] \". Discussions will be created in category \"agentic workflows\"." - }, - "repo_params": {}, - "dynamic_tools": [] - } - GH_AW_VALIDATION_JSON: | - { - "create_discussion": { - "defaultMax": 1, - "fields": { - "body": { - "required": true, - "type": "string", - "sanitize": true, - "maxLength": 65000, - "minLength": 64 - }, - "category": { - "type": "string", - "sanitize": true, - "maxLength": 128 - }, - "repo": { - "type": "string", - "maxLength": 256 - }, - "title": { - "required": true, - "type": "string", - "sanitize": true, - "maxLength": 128 - } - } - }, - "missing_data": { - "defaultMax": 20, - "fields": { - "alternatives": { - "type": "string", - "sanitize": true, - "maxLength": 256 - }, - "context": { - "type": "string", - "sanitize": true, - "maxLength": 256 - }, - "data_type": { - "type": "string", - "sanitize": true, - "maxLength": 128 - }, - "reason": { - "type": "string", - "sanitize": true, - "maxLength": 256 - } - } - }, - "missing_tool": { - "defaultMax": 20, - "fields": { - "alternatives": { - "type": "string", - "sanitize": true, - "maxLength": 512 - }, - "reason": { - "required": true, - "type": "string", - "sanitize": true, - "maxLength": 256 - }, - "tool": { - "type": "string", - "sanitize": true, - "maxLength": 128 - } - } - }, - "noop": { - "defaultMax": 1, - "fields": { - "message": { - "required": true, - "type": "string", - "sanitize": true, - "maxLength": 65000 - } - } - }, - "report_incomplete": { - "defaultMax": 5, - "fields": { - "details": { - "type": "string", - "sanitize": true, - "maxLength": 65000 - }, - "reason": { - "required": true, - "type": "string", - "sanitize": true, - "maxLength": 1024 - } - } - } - } - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_safe_outputs_tools.cjs'); - await main(); - - name: Start MCP Gateway - id: start-mcp-gateway - env: - GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST: ${{ vars.GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST || 'true' }} - GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} - GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS_CONFIG_PATH }} - GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS_TOOLS_PATH }} - GITHUB_MCP_GUARD_MIN_INTEGRITY: ${{ steps.determine-automatic-lockdown.outputs.min_integrity }} - GITHUB_MCP_GUARD_REPOS: ${{ steps.determine-automatic-lockdown.outputs.repos }} - GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -eo pipefail - mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config" - - # Export gateway environment variables for MCP config and gateway script - export MCP_GATEWAY_PORT="8080" - export MCP_GATEWAY_DOMAIN="host.docker.internal" - export MCP_GATEWAY_HOST_DOMAIN="localhost" - MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') - echo "::add-mask::${MCP_GATEWAY_API_KEY}" - export MCP_GATEWAY_API_KEY - export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads" - mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}" - export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288" - export DEBUG="*" - - export GH_AW_ENGINE="copilot" - MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0') - MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0') - case "${DOCKER_HOST:-}" in - unix://* ) DOCKER_SOCK_PATH="${DOCKER_HOST#unix://}" ;; - /* ) DOCKER_SOCK_PATH="$DOCKER_HOST" ;; - * ) DOCKER_SOCK_PATH=/var/run/docker.sock ;; - esac - DOCKER_SOCK_GID=$(stat -c '%g' "$DOCKER_SOCK_PATH" 2>/dev/null || echo '0') - export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host --name awmg-mcpg --add-host host.docker.internal:127.0.0.1 --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v '"${DOCKER_SOCK_PATH}"':/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DOCKER_HOST=unix:///var/run/docker.sock -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e RUNNER_TEMP -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw -v '"${RUNNER_TEMP}"'/gh-aw/safeoutputs:'"${RUNNER_TEMP}"'/gh-aw/safeoutputs:rw ghcr.io/github/gh-aw-mcpg:v0.3.30' - - mkdir -p "$HOME/.copilot" - GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node) - cat << GH_AW_MCP_CONFIG_f014db59cae17bc3_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" - { - "mcpServers": { - "github": { - "type": "stdio", - "container": "ghcr.io/github/github-mcp-server:v1.4.0", - "env": { - "GITHUB_HOST": "${GITHUB_SERVER_URL}", - "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_MCP_SERVER_TOKEN}", - "GITHUB_READ_ONLY": "1", - "GITHUB_TOOLSETS": "context,repos,issues,pull_requests" - }, - "guard-policies": { - "allow-only": { - "min-integrity": "$GITHUB_MCP_GUARD_MIN_INTEGRITY", - "repos": "$GITHUB_MCP_GUARD_REPOS" - } - } - }, - "safeoutputs": { - "type": "stdio", - "container": "ghcr.io/github/gh-aw-node", - "mounts": ["\${GITHUB_WORKSPACE}:\${GITHUB_WORKSPACE}:rw", "${RUNNER_TEMP}/gh-aw/safeoutputs:${RUNNER_TEMP}/gh-aw/safeoutputs:rw", "/tmp/gh-aw:/tmp/gh-aw:rw"], - "args": ["-w", "\${GITHUB_WORKSPACE}"], - "entrypoint": "sh", - "entrypointArgs": ["-c", "sh ${RUNNER_TEMP}/gh-aw/safeoutputs/start_safe_outputs_mcp.sh"], - "env": { - "DEBUG": "*", - "DEFAULT_BRANCH": "\${DEFAULT_BRANCH}", - "GH_AW_ASSETS_ALLOWED_EXTS": "\${GH_AW_ASSETS_ALLOWED_EXTS}", - "GH_AW_ASSETS_BRANCH": "\${GH_AW_ASSETS_BRANCH}", - "GH_AW_ASSETS_MAX_SIZE_KB": "\${GH_AW_ASSETS_MAX_SIZE_KB}", - "GH_AW_MCP_LOG_DIR": "\${GH_AW_MCP_LOG_DIR}", - "GH_AW_SAFE_OUTPUTS": "\${GH_AW_SAFE_OUTPUTS}", - "GH_AW_SAFE_OUTPUTS_CONFIG_PATH": "\${GH_AW_SAFE_OUTPUTS_CONFIG_PATH}", - "GH_AW_SAFE_OUTPUTS_TOOLS_PATH": "\${GH_AW_SAFE_OUTPUTS_TOOLS_PATH}", - "GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST": "\${GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST}", - "GITHUB_REPOSITORY": "\${GITHUB_REPOSITORY}", - "GITHUB_TOKEN": "\${GITHUB_TOKEN}", - "GITHUB_WORKSPACE": "\${GITHUB_WORKSPACE}", - "RUNNER_TEMP": "\${RUNNER_TEMP}" - }, - "guard-policies": { - "write-sink": { - "accept": [ - "*" - ] - } - } - } - }, - "gateway": { - "port": $MCP_GATEWAY_PORT, - "domain": "${MCP_GATEWAY_DOMAIN}", - "apiKey": "${MCP_GATEWAY_API_KEY}", - "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" - } - } - GH_AW_MCP_CONFIG_f014db59cae17bc3_EOF - - name: Mount MCP servers as CLIs - id: mount-mcp-clis - continue-on-error: true - env: - MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }} - MCP_GATEWAY_DOMAIN: ${{ steps.start-mcp-gateway.outputs.gateway-domain }} - MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }} - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io); - const { main } = require('${{ runner.temp }}/gh-aw/actions/mount_mcp_as_cli.cjs'); - await main(); - - name: Clean credentials - continue-on-error: true - run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh" - - name: Audit pre-agent workspace - id: pre_agent_audit - continue-on-error: true - run: bash "${RUNNER_TEMP}/gh-aw/actions/audit_pre_agent_workspace.sh" - - name: Execute GitHub Copilot CLI - id: agentic_execution - # Copilot CLI tool arguments (sorted): - timeout-minutes: 120 - run: | - set -o pipefail - printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt - trap 'rm -f "$HOME/.copilot/settings.json"' EXIT - mkdir -p "$HOME/.copilot" - printf '%s' '{"builtInAgents":{"rubberDuck":false}}' > "$HOME/.copilot/settings.json" - export XDG_CONFIG_HOME="$HOME" - export GH_AW_MCP_CONFIG="$HOME/.copilot/mcp-config.json" - touch /tmp/gh-aw/agent-step-summary.md - GH_AW_NODE_BIN=$(command -v node 2>/dev/null || true) - export GH_AW_NODE_BIN - export COPILOT_API_KEY="$COPILOT_DUMMY_BYOK" - (umask 177 && touch /tmp/gh-aw/agent-stdio.log) - GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-1000}" - printf '%s\n' "{\"\$schema\":\"https://github.com/github/gh-aw-firewall/releases/download/v0.27.11/awf-config.schema.json\",\"network\":{\"allowDomains\":[\"api.business.githubcopilot.com\",\"api.enterprise.githubcopilot.com\",\"api.github.com\",\"api.githubcopilot.com\",\"api.individual.githubcopilot.com\",\"api.snapcraft.io\",\"archive.ubuntu.com\",\"azure.archive.ubuntu.com\",\"crl.geotrust.com\",\"crl.globalsign.com\",\"crl.identrust.com\",\"crl.sectigo.com\",\"crl.thawte.com\",\"crl.usertrust.com\",\"crl.verisign.com\",\"crl3.digicert.com\",\"crl4.digicert.com\",\"crls.ssl.com\",\"github.com\",\"host.docker.internal\",\"json-schema.org\",\"json.schemastore.org\",\"keyserver.ubuntu.com\",\"ocsp.digicert.com\",\"ocsp.geotrust.com\",\"ocsp.globalsign.com\",\"ocsp.identrust.com\",\"ocsp.sectigo.com\",\"ocsp.ssl.com\",\"ocsp.thawte.com\",\"ocsp.usertrust.com\",\"ocsp.verisign.com\",\"packagecloud.io\",\"packages.cloud.google.com\",\"packages.microsoft.com\",\"ppa.launchpad.net\",\"raw.githubusercontent.com\",\"registry.npmjs.org\",\"s.symcb.com\",\"s.symcd.com\",\"security.ubuntu.com\",\"telemetry.enterprise.githubcopilot.com\",\"ts-crl.ws.symantec.com\",\"ts-ocsp.ws.symantec.com\",\"www.googleapis.com\"]},\"apiProxy\":{\"enabled\":true,\"enableTokenSteering\":true,\"maxRuns\":500,\"maxAiCredits\":${GH_AW_MAX_AI_CREDITS},\"maxCacheMisses\":5,\"models\":{\"agent\":[\"sonnet-6x\",\"gpt-5.5\",\"gpt-5.4\",\"gpt-5.3\",\"gemini-pro\",\"any\"],\"antigravity\":[\"copilot/antigravity*\",\"google/antigravity*\",\"gemini/antigravity*\"],\"any\":[\"copilot/*\",\"anthropic/*\",\"openai/*\",\"google/*\",\"gemini/*\"],\"claude\":[\"agent\"],\"codex\":[\"agent\"],\"coding\":[\"copilot/gpt-5*codex*\",\"openai/gpt-5*codex*\",\"gpt-5-codex\"],\"computer-use\":[\"copilot/*computer-use*\",\"google/*computer-use*\",\"gemini/*computer-use*\",\"openai/*computer-use*\"],\"copilot\":[\"agent\"],\"deep-research\":[\"copilot/deep-research*\",\"copilot/o3-deep-research*\",\"copilot/o4-mini-deep-research*\",\"google/deep-research*\",\"gemini/deep-research*\",\"openai/o3-deep-research*\",\"openai/o4-mini-deep-research*\"],\"gemini\":[\"agent\"],\"gemini-3-flash\":[\"copilot/gemini-3*flash*\",\"google/gemini-3*flash*\",\"gemini/gemini-3*flash*\"],\"gemini-3-pro\":[\"copilot/gemini-3*pro*\",\"google/gemini-3*pro*\",\"google/nano-banana*\",\"gemini/gemini-3*pro*\"],\"gemini-3.1-flash\":[\"copilot/gemini-3.1*flash*\",\"google/gemini-3.1*flash*\",\"gemini/gemini-3.1*flash*\"],\"gemini-3.1-pro\":[\"copilot/gemini-3.1*pro*\",\"google/gemini-3.1*pro*\",\"gemini/gemini-3.1*pro*\"],\"gemini-3.5-flash\":[\"copilot/gemini-3.5*flash*\",\"google/gemini-3.5*flash*\",\"gemini/gemini-3.5*flash*\"],\"gemini-flash\":[\"copilot/gemini-*flash*\",\"google/gemini-*flash*\",\"gemini/gemini-*flash*\"],\"gemini-flash-lite\":[\"copilot/gemini-*flash*lite*\",\"google/gemini-*flash*lite*\",\"gemini/gemini-*flash*lite*\"],\"gemini-pro\":[\"copilot/gemini-*pro*\",\"google/gemini-*pro*\",\"gemini/gemini-*pro*\"],\"gemma\":[\"copilot/gemma*\",\"google/gemma*\",\"gemini/gemma*\"],\"gpt-5\":[\"copilot/gpt-5*\",\"openai/gpt-5*\"],\"gpt-5-codex\":[\"copilot/gpt-5*codex*\",\"openai/gpt-5*codex*\"],\"gpt-5-mini\":[\"copilot/gpt-5*mini*\",\"openai/gpt-5*mini*\"],\"gpt-5-nano\":[\"copilot/gpt-5*nano*\",\"openai/gpt-5*nano*\"],\"gpt-5-pro\":[\"copilot/gpt-5*pro*\",\"openai/gpt-5*pro*\"],\"gpt-5.1\":[\"copilot/gpt-5.1*\",\"openai/gpt-5.1*\"],\"gpt-5.2\":[\"copilot/gpt-5.2*\",\"openai/gpt-5.2*\"],\"gpt-5.3\":[\"copilot/gpt-5.3*\",\"openai/gpt-5.3*\"],\"gpt-5.4\":[\"copilot/gpt-5.4*\",\"openai/gpt-5.4*\"],\"gpt-5.5\":[\"copilot/gpt-5.5*\",\"openai/gpt-5.5*\"],\"haiku\":[\"copilot/*haiku*\",\"anthropic/*haiku*\"],\"image-generation\":[\"copilot/gpt-image*\",\"openai/gpt-image*\",\"openai/chatgpt-image*\",\"copilot/gemini-*image*\",\"google/gemini-*image*\",\"gemini/gemini-*image*\",\"google/imagen*\"],\"large\":[\"sonnet\",\"gpt-5-pro\",\"gpt-5\",\"gemini-pro\"],\"mai-code\":[\"copilot/MAI-Code*\",\"copilot/mai-code*\",\"openai/MAI-Code*\"],\"mini\":[\"haiku\",\"gpt-5-mini\",\"gpt-5-nano\",\"gemini-flash-lite\"],\"nano-banana\":[\"copilot/nano-banana*\",\"google/nano-banana*\",\"gemini/nano-banana*\"],\"opus\":[\"copilot/*opus*\",\"anthropic/*opus*\"],\"opusplan\":[\"opus?effort=high\"],\"reasoning\":[\"copilot/o1*\",\"copilot/o3*\",\"copilot/o4*\",\"openai/o1*\",\"openai/o3*\",\"openai/o4*\"],\"robotics\":[\"copilot/*robotics*\",\"google/*robotics*\",\"gemini/*robotics*\"],\"small\":[\"mini\"],\"small-agent\":[\"haiku\",\"gpt-5-mini\",\"gemini-flash\"],\"sonnet\":[\"copilot/*sonnet*\",\"anthropic/*sonnet*\"],\"sonnet-6x\":[\"copilot/*sonnet-4.5*\",\"copilot/*sonnet-4.6*\",\"copilot/*sonnet-4-5-*\",\"anthropic/*sonnet-4-5-*\",\"copilot/*sonnet-4-6*\",\"anthropic/*sonnet-4-6*\"],\"summarization\":[\"haiku\",\"gpt-5-mini\",\"gemini-flash-lite\",\"mini\"],\"vision\":[\"copilot/gemini-*image*\",\"google/gemini-*image*\",\"gemini/gemini-*image*\",\"copilot/gemini-*flash*\",\"google/gemini-*flash*\",\"gemini/gemini-*flash*\"]}},\"container\":{\"imageTag\":\"0.27.11,squid=sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d,agent=sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7,api-proxy=sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d\"}}" > "${RUNNER_TEMP}/gh-aw/awf-config.json" - cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json - export GH_AW_MODELS_JSON_PATH="/tmp/gh-aw/models.json" - GH_AW_DOCKER_HOST="" - if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then - GH_AW_DOCKER_HOST="${DOCKER_HOST}" - fi - GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="" - if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then - GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="--docker-host-path-prefix /tmp/gh-aw" - GH_AW_CHROOT_BINARIES_SOURCE_PATH=/tmp/gh-aw GH_AW_CHROOT_IDENTITY_HOME=/tmp/gh-aw/home node "${RUNNER_TEMP}/gh-aw/actions/patch_awf_chroot_config.cjs" - fi - GH_AW_TOOL_CACHE_MOUNT="" - GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}" - if [ -d "$GH_AW_TOOL_CACHE" ]; then - if [[ "$GH_AW_TOOL_CACHE" != /opt/* ]]; then - GH_AW_TOOL_CACHE_MOUNT="$GH_AW_TOOL_CACHE:$GH_AW_TOOL_CACHE:ro" - fi - fi - # shellcheck disable=SC1003,SC2086 - sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \ - -- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; export PATH="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log - env: - AWF_REFLECT_ENABLED: 1 - COPILOT_AGENT_RUNNER_TYPE: STANDALONE - COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} - GH_AW_LLM_PROVIDER: github - GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} - GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }} - GH_AW_PHASE: agent - GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt - GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} - GH_AW_TIMEOUT_MINUTES: 120 - GH_AW_VERSION: v0.81.6 - GITHUB_API_URL: ${{ github.api_url }} - GITHUB_AW: true - GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows - GITHUB_HEAD_REF: ${{ github.head_ref }} - GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SERVER_URL: ${{ github.server_url }} - GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md - GITHUB_WORKSPACE: ${{ github.workspace }} - GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com - GIT_AUTHOR_NAME: github-actions[bot] - GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com - GIT_COMMITTER_NAME: github-actions[bot] - RUNNER_TEMP: ${{ runner.temp }} - TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - - name: Detect agent errors - if: always() - id: detect-agent-errors - continue-on-error: true - run: node "${RUNNER_TEMP}/gh-aw/actions/detect_agent_errors.cjs" - - name: Configure Git credentials - env: - GITHUB_REPOSITORY: ${{ github.repository }} - GITHUB_SERVER_URL: ${{ github.server_url }} - GITHUB_TOKEN: ${{ github.token }} - run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh" - - name: Copy Copilot session state files to logs - if: always() - continue-on-error: true - run: bash "${RUNNER_TEMP}/gh-aw/actions/copy_copilot_session_state.sh" - - name: Stop MCP Gateway - if: always() - continue-on-error: true - env: - MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }} - MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }} - GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }} - run: | - bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID" - - name: Redact secrets in logs - if: always() - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); - await main(); - env: - GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' - SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} - SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} - SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Append agent step summary - if: always() - run: bash "${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh" - - name: Copy Safe Outputs - if: always() - env: - GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} - run: | - mkdir -p /tmp/gh-aw - cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true - - name: Ingest agent output - id: collect_output - if: always() - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} - GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" - GITHUB_SERVER_URL: ${{ github.server_url }} - GITHUB_API_URL: ${{ github.api_url }} - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/collect_ndjson_output.cjs'); - await main(); - - name: Parse agent logs for step summary - if: always() - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_AGENT_OUTPUT: /tmp/gh-aw/sandbox/agent/logs/ - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_copilot_log.cjs'); - await main(); - - name: Parse MCP Gateway logs for step summary - if: always() - id: parse-mcp-gateway - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_gateway_log.cjs'); - await main(); - - name: Print firewall logs - if: always() - continue-on-error: true - env: - AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs - run: | - # Fix permissions on firewall logs/audit dirs so they can be uploaded as artifacts - # AWF runs with sudo, creating files owned by root - sudo chmod -R a+rX /tmp/gh-aw/sandbox/firewall 2>/dev/null || true - # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step) - if command -v awf &> /dev/null; then - awf logs summary | tee -a "$GITHUB_STEP_SUMMARY" - else - echo 'AWF binary not installed, skipping firewall log summary' - fi - - name: Parse token usage for step summary - if: always() - continue-on-error: true - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_token_usage.cjs'); - await main(); - - name: Print AWF reflect summary - if: always() - continue-on-error: true - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/awf_reflect_summary.cjs'); - await main(); - - name: Write agent output placeholder if missing - if: always() - run: | - if [ ! -f /tmp/gh-aw/agent_output.json ]; then - echo '{"items":[]}' > /tmp/gh-aw/agent_output.json - fi - - name: Upload agent artifacts - if: always() - continue-on-error: true - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: agent - path: | - /tmp/gh-aw/aw-prompts/prompt.txt - /tmp/gh-aw/sandbox/agent/logs/ - /tmp/gh-aw/redacted-urls.log - /tmp/gh-aw/mcp-logs/ - /tmp/gh-aw/agent_usage.json - /tmp/gh-aw/agent-stdio.log - /tmp/gh-aw/pre-agent-audit.txt - /tmp/gh-aw/agent/ - /tmp/gh-aw/github_rate_limits.jsonl - /tmp/gh-aw/safeoutputs.jsonl - /tmp/gh-aw/agent_output.json - /tmp/gh-aw/aw-*.patch - /tmp/gh-aw/aw-*.bundle - /tmp/gh-aw/awf-config.json - /tmp/gh-aw/sandbox/firewall/logs/ - /tmp/gh-aw/sandbox/firewall/audit/ - /tmp/gh-aw/sandbox/firewall/awf-reflect.json - if-no-files-found: ignore - - conclusion: - needs: - - activation - - agent - - detection - - safe_outputs - if: > - always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' || - needs.activation.outputs.stale_lock_file_failed == 'true' || needs.activation.outputs.daily_ai_credits_exceeded == 'true') - runs-on: ubuntu-slim - permissions: - contents: read - discussions: write - issues: write - concurrency: - group: "gh-aw-conclusion-qf-s-benchmark" - cancel-in-progress: false - queue: max - env: - GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} - outputs: - incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }} - noop_message: ${{ steps.noop.outputs.noop_message }} - tools_reported: ${{ steps.missing_tool.outputs.tools_reported }} - total_count: ${{ steps.missing_tool.outputs.total_count }} - steps: - - name: Setup Scripts - id: setup - uses: github/gh-aw-actions/setup@v0.81.6 - with: - destination: ${{ runner.temp }}/gh-aw/actions - job-name: ${{ github.job }} - trace-id: ${{ needs.activation.outputs.setup-trace-id }} - parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} - env: - GH_AW_SETUP_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/qf-s-benchmark.lock.yml@${{ github.ref }} - GH_AW_INFO_VERSION: "1.0.65" - GH_AW_INFO_AWF_VERSION: "v0.27.11" - GH_AW_INFO_ENGINE_ID: "copilot" - - name: Download agent output artifact - id: download-agent-output - continue-on-error: true - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: agent - path: /tmp/gh-aw/ - - name: Setup agent output environment variable - id: setup-agent-output-env - if: steps.download-agent-output.outcome == 'success' - run: | - mkdir -p /tmp/gh-aw/ - find "/tmp/gh-aw/" -type f -print - echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" - - name: Collect usage artifact files - if: always() - continue-on-error: true - run: | - mkdir -p /tmp/gh-aw/usage/agent /tmp/gh-aw/usage/detection - echo "Usage artifact source file status:" - for file in /tmp/gh-aw/aw_info.json /tmp/gh-aw/aw-info.jsonl /tmp/gh-aw/agent_usage.json /tmp/gh-aw/agent_usage.jsonl /tmp/gh-aw/detection_usage.jsonl /tmp/gh-aw/github_rate_limits.jsonl /tmp/gh-aw/sandbox/firewall-audit-logs/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/sandbox/firewall/audit/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/threat-detection/sandbox/firewall-audit-logs/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/threat-detection/sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/threat-detection/sandbox/firewall/audit/api-proxy-logs/token-usage.jsonl; do - [ -f "$file" ] && echo "FOUND: $file" || echo "MISSING: $file" - done - [ -f /tmp/gh-aw/aw_info.json ] && cp /tmp/gh-aw/aw_info.json /tmp/gh-aw/usage/aw_info.json || true - [ -f /tmp/gh-aw/aw-info.jsonl ] && cp /tmp/gh-aw/aw-info.jsonl /tmp/gh-aw/usage/aw-info.jsonl || true - [ -f /tmp/gh-aw/agent_usage.json ] && cp /tmp/gh-aw/agent_usage.json /tmp/gh-aw/usage/agent_usage.json || true - [ -f /tmp/gh-aw/agent_usage.jsonl ] && cp /tmp/gh-aw/agent_usage.jsonl /tmp/gh-aw/usage/agent_usage.jsonl || true - [ -f /tmp/gh-aw/detection_usage.jsonl ] && cp /tmp/gh-aw/detection_usage.jsonl /tmp/gh-aw/usage/detection_usage.jsonl || true - [ -f /tmp/gh-aw/github_rate_limits.jsonl ] && cp /tmp/gh-aw/github_rate_limits.jsonl /tmp/gh-aw/usage/github_rate_limits.jsonl || true - [ -s /tmp/gh-aw/sandbox/firewall-audit-logs/api-proxy-logs/token-usage.jsonl ] && cp /tmp/gh-aw/sandbox/firewall-audit-logs/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/usage/agent/token_usage.jsonl || true - [ -s /tmp/gh-aw/sandbox/firewall/audit/api-proxy-logs/token-usage.jsonl ] && cp /tmp/gh-aw/sandbox/firewall/audit/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/usage/agent/token_usage.jsonl || true - [ -s /tmp/gh-aw/sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl ] && cp /tmp/gh-aw/sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/usage/agent/token_usage.jsonl || true - [ -s /tmp/gh-aw/threat-detection/sandbox/firewall-audit-logs/api-proxy-logs/token-usage.jsonl ] && cp /tmp/gh-aw/threat-detection/sandbox/firewall-audit-logs/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/usage/detection/token_usage.jsonl || true - [ -s /tmp/gh-aw/threat-detection/sandbox/firewall/audit/api-proxy-logs/token-usage.jsonl ] && cp /tmp/gh-aw/threat-detection/sandbox/firewall/audit/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/usage/detection/token_usage.jsonl || true - [ -s /tmp/gh-aw/threat-detection/sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl ] && cp /tmp/gh-aw/threat-detection/sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl /tmp/gh-aw/usage/detection/token_usage.jsonl || true - [ -f /tmp/gh-aw/usage/agent/token_usage.jsonl ] || : > /tmp/gh-aw/usage/agent/token_usage.jsonl - [ -f /tmp/gh-aw/usage/detection/token_usage.jsonl ] || : > /tmp/gh-aw/usage/detection/token_usage.jsonl - mkdir -p /tmp/gh-aw/usage/activity - node ${{ runner.temp }}/gh-aw/actions/generate_usage_activity_summary.cjs - find /tmp/gh-aw/usage -type f -print | sort - - name: Upload usage artifact - if: always() - continue-on-error: true - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: usage - path: | - /tmp/gh-aw/usage/aw_info.json - /tmp/gh-aw/usage/aw-info.jsonl - /tmp/gh-aw/usage/agent_usage.json - /tmp/gh-aw/usage/agent_usage.jsonl - /tmp/gh-aw/usage/detection_usage.jsonl - /tmp/gh-aw/usage/github_rate_limits.jsonl - /tmp/gh-aw/usage/agent/token_usage.jsonl - /tmp/gh-aw/usage/detection/token_usage.jsonl - /tmp/gh-aw/usage/activity/summary.json - if-no-files-found: ignore - - name: Restore daily AIC usage cache - id: restore-daily-aic-cache-conclusion - if: always() - continue-on-error: true - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - key: agentic-workflow-usage-qfsbenchmark-${{ github.run_id }} - restore-keys: agentic-workflow-usage-qfsbenchmark- - path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl - - name: Write daily AIC usage cache entry - id: write-daily-aic-cache - if: always() - continue-on-error: true - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - github-token: ${{ github.token }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context); - const { main } = require('${{ runner.temp }}/gh-aw/actions/write_daily_aic_usage_cache.cjs'); - await main(); - - name: Save daily AIC usage cache - id: save-daily-aic-cache - if: always() - continue-on-error: true - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - key: agentic-workflow-usage-qfsbenchmark-${{ github.run_id }} - path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl - - name: Upload daily AIC usage cache artifact - id: upload-daily-aic-cache - if: always() - continue-on-error: true - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: aic-usage-cache - path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl - if-no-files-found: ignore - retention-days: 7 - - name: Process no-op messages - id: noop - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} - GH_AW_NOOP_MAX: "1" - GH_AW_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/qf-s-benchmark.md" - GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} - GH_AW_NOOP_REPORT_AS_ISSUE: "false" - GH_AW_AIC: ${{ needs.agent.outputs.aic }} - GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }} - GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }} - GH_AW_WORKFLOW_ID: "qf-s-benchmark" - with: - github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_noop_message.cjs'); - await main(); - - name: Log detection run - id: detection_runs - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} - GH_AW_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/qf-s-benchmark.md" - GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} - GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }} - with: - github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_detection_runs.cjs'); - await main(); - - name: Record missing tool - id: missing_tool - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} - GH_AW_MISSING_TOOL_CREATE_ISSUE: "true" - GH_AW_MISSING_TOOL_TITLE_PREFIX: "[missing tool]" - GH_AW_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/qf-s-benchmark.md" - with: - github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/missing_tool.cjs'); - await main(); - - name: Record incomplete - id: report_incomplete - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} - GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true" - GH_AW_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/qf-s-benchmark.md" - with: - github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/report_incomplete_handler.cjs'); - await main(); - - name: Handle agent failure - id: handle_agent_failure - if: always() - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} - GH_AW_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/qf-s-benchmark.md" - GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} - GH_AW_WORKFLOW_ID: "qf-s-benchmark" - GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" - GH_AW_ENGINE_ID: "copilot" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} - GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} - GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} - GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }} - GH_AW_UNKNOWN_MODEL_AI_CREDITS: ${{ needs.agent.outputs.unknown_model_ai_credits || 'false' }} - GH_AW_AIC: ${{ needs.agent.outputs.aic }} - GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }} - GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} - GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }} - GH_AW_MCP_POLICY_ERROR: ${{ needs.agent.outputs.mcp_policy_error }} - GH_AW_AGENTIC_ENGINE_TIMEOUT: ${{ needs.agent.outputs.agentic_engine_timeout }} - GH_AW_MODEL_NOT_SUPPORTED_ERROR: ${{ needs.agent.outputs.model_not_supported_error }} - GH_AW_ENGINE_API_HOSTS: "api.enterprise.githubcopilot.com,api.githubcopilot.com,api.business.githubcopilot.com,api.individual.githubcopilot.com" - GH_AW_CREATE_DISCUSSION_ERRORS: ${{ needs.safe_outputs.outputs.create_discussion_errors }} - GH_AW_CREATE_DISCUSSION_ERROR_COUNT: ${{ needs.safe_outputs.outputs.create_discussion_error_count }} - GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }} - GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }} - GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }} - GH_AW_DAILY_AI_CREDITS_TOTAL_EFFECTIVE_TOKENS: ${{ needs.activation.outputs.daily_ai_credits_total_effective_tokens }} - GH_AW_DAILY_AI_CREDITS_THRESHOLD: ${{ needs.activation.outputs.daily_ai_credits_threshold }} - GH_AW_GROUP_REPORTS: "false" - GH_AW_FAILURE_REPORT_AS_ISSUE: "false" - GH_AW_MISSING_TOOL_REPORT_AS_FAILURE: "true" - GH_AW_MISSING_DATA_REPORT_AS_FAILURE: "true" - GH_AW_TIMEOUT_MINUTES: "120" - with: - github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_agent_failure.cjs'); - await main(); - - detection: - needs: - - activation - - agent - if: always() && needs.agent.result != 'skipped' - runs-on: ubuntu-latest - permissions: - contents: read - env: - GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} - outputs: - aic: ${{ steps.parse_detection_token_usage.outputs.aic }} - detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }} - detection_reason: ${{ steps.detection_conclusion.outputs.reason }} - detection_success: ${{ steps.detection_conclusion.outputs.success }} - steps: - - name: Setup Scripts - id: setup - uses: github/gh-aw-actions/setup@v0.81.6 - with: - destination: ${{ runner.temp }}/gh-aw/actions - job-name: ${{ github.job }} - trace-id: ${{ needs.activation.outputs.setup-trace-id }} - parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} - env: - GH_AW_SETUP_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/qf-s-benchmark.lock.yml@${{ github.ref }} - GH_AW_INFO_VERSION: "1.0.65" - GH_AW_INFO_AWF_VERSION: "v0.27.11" - GH_AW_INFO_ENGINE_ID: "copilot" - - name: Download agent output artifact - id: download-agent-output - continue-on-error: true - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: agent - path: /tmp/gh-aw/ - - name: Setup agent output environment variable - id: setup-agent-output-env - if: steps.download-agent-output.outcome == 'success' - run: | - mkdir -p /tmp/gh-aw/ - find "/tmp/gh-aw/" -type f -print - echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" - - name: Checkout repository for patch context - if: needs.agent.outputs.has_patch == 'true' - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - with: - persist-credentials: false - # --- Threat Detection --- - - name: Clean stale firewall files from agent artifact - run: | - rm -rf /tmp/gh-aw/sandbox/firewall/logs - rm -rf /tmp/gh-aw/sandbox/firewall/audit - - name: Download container images - run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d - - name: Check if detection needed - id: detection_guard - if: always() - env: - OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }} - HAS_PATCH: ${{ needs.agent.outputs.has_patch }} - run: | - if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then - echo "run_detection=true" >> "$GITHUB_OUTPUT" - echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH" - else - echo "run_detection=false" >> "$GITHUB_OUTPUT" - echo "Detection skipped: no agent outputs or patches to analyze" - fi - - name: Clear MCP Config for detection - if: always() && steps.detection_guard.outputs.run_detection == 'true' - run: | - rm -f "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json" - rm -f "$HOME/.copilot/mcp-config.json" - rm -f "$GITHUB_WORKSPACE/.gemini/settings.json" - - name: Prepare threat detection files - if: always() && steps.detection_guard.outputs.run_detection == 'true' - run: | - mkdir -p /tmp/gh-aw/threat-detection/aw-prompts - rm -f /tmp/gh-aw/agent_usage.json - cp /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt 2>/dev/null || true - if [ ! -s /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt ]; then - echo "::warning::ERR_VALIDATION: Missing or empty detection context prompt at /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt. Ensure the agent artifact includes /tmp/gh-aw/aw-prompts/prompt.txt. Detection will continue with fallback workflow context." - fi - cp /tmp/gh-aw/agent_output.json /tmp/gh-aw/threat-detection/agent_output.json 2>/dev/null || true - for f in /tmp/gh-aw/aw-*.patch; do - [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true - done - for f in /tmp/gh-aw/aw-*.bundle; do - [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true - done - echo "Prepared threat detection files:" - ls -la /tmp/gh-aw/threat-detection/ 2>/dev/null || true - - name: Setup threat detection - if: always() && steps.detection_guard.outputs.run_detection == 'true' - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - WORKFLOW_NAME: "QF_S String Solver Benchmark" - WORKFLOW_DESCRIPTION: "Benchmark Z3 seq vs nseq string solvers on QF_S test suite from the c3 branch and post results as a GitHub discussion" - HAS_PATCH: ${{ needs.agent.outputs.has_patch }} - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/setup_threat_detection.cjs'); - await main(); - - name: Ensure threat-detection directory and log - if: always() && steps.detection_guard.outputs.run_detection == 'true' - run: | - mkdir -p /tmp/gh-aw/threat-detection - touch /tmp/gh-aw/threat-detection/detection.log - - name: Setup Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: '24' - package-manager-cache: false - - name: Install GitHub Copilot CLI - run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.65 - env: - GH_HOST: github.com - - name: Install AWF binary - run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.27.11 - - name: Execute GitHub Copilot CLI - if: always() && steps.detection_guard.outputs.run_detection == 'true' - continue-on-error: true - id: detection_agentic_execution - # Copilot CLI tool arguments (sorted): - timeout-minutes: 20 - run: | - set -o pipefail - printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt - trap 'rm -f "$HOME/.copilot/settings.json"' EXIT - mkdir -p "$HOME/.copilot" - printf '%s' '{"builtInAgents":{"rubberDuck":false}}' > "$HOME/.copilot/settings.json" - export XDG_CONFIG_HOME="$HOME" - touch /tmp/gh-aw/agent-step-summary.md - GH_AW_NODE_BIN=$(command -v node 2>/dev/null || true) - export GH_AW_NODE_BIN - export COPILOT_API_KEY="$COPILOT_DUMMY_BYOK" - (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log) - GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}" - printf '%s\n' "{\"\$schema\":\"https://github.com/github/gh-aw-firewall/releases/download/v0.27.11/awf-config.schema.json\",\"network\":{\"allowDomains\":[\"api.business.githubcopilot.com\",\"api.enterprise.githubcopilot.com\",\"api.github.com\",\"api.githubcopilot.com\",\"api.individual.githubcopilot.com\",\"github.com\",\"host.docker.internal\",\"registry.npmjs.org\",\"telemetry.enterprise.githubcopilot.com\"]},\"apiProxy\":{\"enabled\":true,\"enableTokenSteering\":true,\"maxRuns\":500,\"maxAiCredits\":${GH_AW_MAX_AI_CREDITS},\"maxCacheMisses\":5},\"container\":{\"imageTag\":\"0.27.11,squid=sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d,agent=sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7,api-proxy=sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d\"}}" > "${RUNNER_TEMP}/gh-aw/awf-config.json" - cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json - export GH_AW_MODELS_JSON_PATH="/tmp/gh-aw/models.json" - GH_AW_DOCKER_HOST="" - if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then - GH_AW_DOCKER_HOST="${DOCKER_HOST}" - fi - GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="" - if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then - GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="--docker-host-path-prefix /tmp/gh-aw" - _GH_AW_CHROOT_JSON=$(jq -c --arg src /tmp/gh-aw --arg user "$(id -un)" --argjson uid "$(id -u)" --argjson gid "$(id -g)" --arg home /tmp/gh-aw/home '.chroot={"binariesSourcePath":$src,"identity":{"user":$user,"uid":$uid,"gid":$gid,"home":$home}}' "${RUNNER_TEMP}/gh-aw/awf-config.json") || { echo "chroot config patch failed" >&2; exit 1; } - printf '%s\n' "$_GH_AW_CHROOT_JSON" > "${RUNNER_TEMP}/gh-aw/awf-config.json" - printf '%s\n' "$_GH_AW_CHROOT_JSON" > "/tmp/gh-aw/awf-config.json" - fi - GH_AW_TOOL_CACHE_MOUNT="" - GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}" - if [ -d "$GH_AW_TOOL_CACHE" ]; then - if [[ "$GH_AW_TOOL_CACHE" != /opt/* ]]; then - GH_AW_TOOL_CACHE_MOUNT="$GH_AW_TOOL_CACHE:$GH_AW_TOOL_CACHE:ro" - fi - fi - # shellcheck disable=SC1003,SC2086 - sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env COPILOT_GITHUB_TOKEN --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \ - -- /bin/bash -c 'set +o histexpand; : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; export PATH="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log - env: - AWF_REFLECT_ENABLED: 1 - COPILOT_AGENT_RUNNER_TYPE: STANDALONE - COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} - GH_AW_LLM_PROVIDER: github - GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }} - GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }} - GH_AW_PHASE: detection - GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt - GH_AW_TIMEOUT_MINUTES: 20 - GH_AW_VERSION: v0.81.6 - GITHUB_API_URL: ${{ github.api_url }} - GITHUB_AW: true - GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows - GITHUB_HEAD_REF: ${{ github.head_ref }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_SERVER_URL: ${{ github.server_url }} - GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md - GITHUB_WORKSPACE: ${{ github.workspace }} - GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com - GIT_AUTHOR_NAME: github-actions[bot] - GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com - GIT_COMMITTER_NAME: github-actions[bot] - RUNNER_TEMP: ${{ runner.temp }} - TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - - name: Parse threat detection token usage for step summary - id: parse_detection_token_usage - if: always() - continue-on-error: true - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_TOKEN_USAGE_SUMMARY_TITLE: Threat Detection Token Usage - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_token_usage.cjs'); - await main(); - - name: Upload threat detection log - if: always() && steps.detection_guard.outputs.run_detection == 'true' - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: detection - path: /tmp/gh-aw/threat-detection/detection.log - if-no-files-found: ignore - - name: Parse and conclude threat detection - id: detection_conclusion - if: always() - continue-on-error: true - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }} - DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }} - GH_AW_DETECTION_CONTINUE_ON_ERROR: "true" - with: - script: | - try { - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs'); - await main(); - } catch (loadErr) { - const continueOnError = process.env.GH_AW_DETECTION_CONTINUE_ON_ERROR !== 'false'; - const detectionExecutionFailed = process.env.DETECTION_AGENTIC_EXECUTION_OUTCOME === 'failure'; - const msg = 'ERR_SYSTEM: \u274C Unexpected error loading threat detection module: ' + (loadErr && loadErr.message ? loadErr.message : String(loadErr)); - core.error(msg); - core.setOutput('reason', 'parse_error'); - if (continueOnError && !detectionExecutionFailed) { - core.warning('\u26A0\uFE0F ' + msg); - core.setOutput('conclusion', 'warning'); - core.setOutput('success', 'false'); - } else { - core.setOutput('conclusion', 'failure'); - core.setOutput('success', 'false'); - core.setFailed(msg); - } - } - - safe_outputs: - needs: - - activation - - agent - - detection - if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success' - runs-on: ubuntu-slim - permissions: - contents: read - discussions: write - issues: write - timeout-minutes: 45 - env: - GH_AW_AGENT_AIC: ${{ needs.agent.outputs.aic }} - GH_AW_AIC: ${{ needs.agent.outputs.aic }} - GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }} - GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/qf-s-benchmark" - GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} - GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }} - GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens }} - GH_AW_ENGINE_ID: "copilot" - GH_AW_ENGINE_MODEL: ${{ needs.agent.outputs.model }} - GH_AW_ENGINE_VERSION: "1.0.65" - GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} - GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }} - GH_AW_WORKFLOW_ID: "qf-s-benchmark" - GH_AW_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/qf-s-benchmark.md" - outputs: - code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }} - code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }} - create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }} - create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }} - process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }} - process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }} - steps: - - name: Setup Scripts - id: setup - uses: github/gh-aw-actions/setup@v0.81.6 - with: - destination: ${{ runner.temp }}/gh-aw/actions - job-name: ${{ github.job }} - trace-id: ${{ needs.activation.outputs.setup-trace-id }} - parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} - env: - GH_AW_SETUP_WORKFLOW_NAME: "QF_S String Solver Benchmark" - GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/qf-s-benchmark.lock.yml@${{ github.ref }} - GH_AW_INFO_VERSION: "1.0.65" - GH_AW_INFO_AWF_VERSION: "v0.27.11" - GH_AW_INFO_ENGINE_ID: "copilot" - - name: Download agent output artifact - id: download-agent-output - continue-on-error: true - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: agent - path: /tmp/gh-aw/ - - name: Setup agent output environment variable - id: setup-agent-output-env - if: steps.download-agent-output.outcome == 'success' - run: | - mkdir -p /tmp/gh-aw/ - find "/tmp/gh-aw/" -type f -print - echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" - - name: Configure GH_HOST for enterprise compatibility - id: ghes-host-config - shell: bash - run: | # zizmor: ignore[github-env] - GITHUB_SERVER_URL is set by GitHub Actions, not user input. - # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct - # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op. - GH_HOST="${GITHUB_SERVER_URL#https://}" - GH_HOST="${GH_HOST#http://}" - echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV" - - name: Process Safe Outputs - id: process_safe_outputs - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} - GH_AW_COMMENT_ID: ${{ needs.activation.outputs.comment_id }} - GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" - GITHUB_SERVER_URL: ${{ github.server_url }} - GITHUB_API_URL: ${{ github.api_url }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_discussion\":{\"category\":\"agentic workflows\",\"close_older_discussions\":true,\"expires\":168,\"fallback_to_issue\":true,\"max\":1,\"title_prefix\":\"[QF_S Benchmark] \"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"report_incomplete\":{}}" - with: - github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/safe_output_handler_manager.cjs'); - await main(); - - name: Upload Safe Outputs Items - if: always() - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: safe-outputs-items - path: | - /tmp/gh-aw/safe-output-items.jsonl - /tmp/gh-aw/temporary-id-map.json - if-no-files-found: ignore - diff --git a/.github/workflows/qf-s-benchmark.md b/.github/workflows/qf-s-benchmark.md deleted file mode 100644 index e57582d264..0000000000 --- a/.github/workflows/qf-s-benchmark.md +++ /dev/null @@ -1,405 +0,0 @@ ---- -description: Benchmark Z3 seq vs nseq string solvers on QF_S test suite from the c3 branch and post results as a GitHub discussion - -on: - schedule: - - cron: "0 0,12 * * *" - workflow_dispatch: - -permissions: read-all - -network: defaults - -tools: - bash: true - github: - toolsets: [default] - -safe-outputs: - report-failure-as-issue: false - create-discussion: - title-prefix: "[QF_S Benchmark] " - category: "Agentic Workflows" - close-older-discussions: true - missing-tool: - create-issue: true - noop: - report-as-issue: false - -timeout-minutes: 120 - -steps: - - name: Checkout c3 branch - uses: actions/checkout@v6.0.2 - with: - ref: c3 - fetch-depth: 1 - persist-credentials: false - ---- - -# QF_S String Solver Benchmark - -## Job Description - -Your name is ${{ github.workflow }}. You are an expert performance analyst for the Z3 theorem prover, specializing in the string/sequence theory. Your task is to benchmark the `seq` solver (classical string theory) against the `nseq` solver (ZIPT-based string theory) on the QF_S test suite from the `c3` branch, and post a structured report as a GitHub Discussion. - -The workspace already contains the `c3` branch (checked out by the preceding workflow step). - -## Phase 1: Set Up the Build Environment - -Install required build tools: - -```bash -sudo apt-get update -y -sudo apt-get install -y cmake ninja-build python3 python3-pip time -``` - -Verify tools: - -```bash -cmake --version -ninja --version -python3 --version -``` - -## Phase 2: Build Z3 in Release Mode - -Build Z3 in Release mode for accurate benchmark performance numbers and lower memory usage. Running `ninja` in the background with `&` is not allowed — concurrent C++ compilation and LLM inference can exhaust available RAM and kill the agent process. - -```bash -mkdir -p /tmp/z3-build -cd /tmp/z3-build -cmake "$GITHUB_WORKSPACE" \ - -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DZ3_BUILD_TEST_EXECUTABLES=OFF \ - 2>&1 | tee /tmp/z3-cmake.log -ninja -j2 z3 2>&1 | tee /tmp/z3-build.log -``` - -Verify the binary was built: - -```bash -/tmp/z3-build/z3 --version -``` - -If the build fails, report it immediately and stop. - -Once the binary is confirmed working, call the `noop` safe-output tool with the message `"Z3 built successfully from the c3 branch. Benchmark starting — results will be posted as a GitHub Discussion once complete."` This keepalive call refreshes the safe-output MCP session before the long benchmark run begins, preventing a session timeout. - -## Phase 3: Discover QF_S Benchmark Files - -Find all `.smt2` benchmark files in the workspace that belong to the QF_S logic: - -```bash -# Search for explicit QF_S logic declarations -grep -rl 'QF_S' "$GITHUB_WORKSPACE" --include='*.smt2' 2>/dev/null > /tmp/qf_s_files.txt - -# Also look in dedicated benchmark directories -find "$GITHUB_WORKSPACE" \ - \( -path "*/QF_S/*" -o -path "*/qf_s/*" -o -path "*/benchmarks/*" \) \ - -name '*.smt2' 2>/dev/null >> /tmp/qf_s_files.txt - -# Deduplicate -sort -u /tmp/qf_s_files.txt -o /tmp/qf_s_files.txt - -TOTAL=$(wc -l < /tmp/qf_s_files.txt) -echo "Found $TOTAL QF_S benchmark files" -head -20 /tmp/qf_s_files.txt -``` - -If fewer than 5 files are found, also scan the entire workspace for any `.smt2` file that exercises string constraints: - -```bash -if [ "$TOTAL" -lt 5 ]; then - grep -rl 'declare.*String\|str\.\|seq\.' "$GITHUB_WORKSPACE" \ - --include='*.smt2' 2>/dev/null >> /tmp/qf_s_files.txt - sort -u /tmp/qf_s_files.txt -o /tmp/qf_s_files.txt - TOTAL=$(wc -l < /tmp/qf_s_files.txt) - echo "After extended search: $TOTAL files" -fi -``` - -Cap the benchmark set to keep total runtime under 60 minutes: - -```bash -# Use at most 300 files; take a random sample if more are available -if [ "$TOTAL" -gt 300 ]; then - shuf -n 300 /tmp/qf_s_files.txt > /tmp/qf_s_sample.txt -else - cp /tmp/qf_s_files.txt /tmp/qf_s_sample.txt -fi -SAMPLE=$(wc -l < /tmp/qf_s_sample.txt) -echo "Running benchmarks on $SAMPLE files" -``` - -## Phase 4: Run Benchmarks — seq vs nseq - -Run each benchmark with both solvers. Use a per-file timeout of 5 seconds. Set Z3's internal timeout to 4 seconds so it exits cleanly before the shell timeout fires. - -```bash -Z3=/tmp/z3-build/z3 -TIMEOUT_SEC=5 -Z3_TIMEOUT_SEC=4 -RESULTS=/tmp/benchmark-results.csv - -echo "file,seq_result,seq_time_ms,nseq_result,nseq_time_ms" > "$RESULTS" - -total=0 -done_count=0 -while IFS= read -r smt_file; do - total=$((total + 1)) - - # Run with seq solver; capture both stdout (z3 output) and stderr (time output) - SEQ_OUT=$({ time timeout "$TIMEOUT_SEC" "$Z3" \ - smt.string_solver=seq \ - -T:"$Z3_TIMEOUT_SEC" \ - "$smt_file" 2>/dev/null; } 2>&1) - SEQ_RESULT=$(echo "$SEQ_OUT" | grep -E '^(sat|unsat|unknown)' | head -1) - SEQ_MS=$(echo "$SEQ_OUT" | grep real | awk '{split($2,a,"m"); split(a[2],b,"s"); printf "%d", (a[1]*60+b[1])*1000}') - [ -z "$SEQ_RESULT" ] && SEQ_RESULT="timeout" - [ -z "$SEQ_MS" ] && SEQ_MS=$((TIMEOUT_SEC * 1000)) - - # Run with nseq solver; same structure - NSEQ_OUT=$({ time timeout "$TIMEOUT_SEC" "$Z3" \ - smt.string_solver=nseq \ - -T:"$Z3_TIMEOUT_SEC" \ - "$smt_file" 2>/dev/null; } 2>&1) - NSEQ_RESULT=$(echo "$NSEQ_OUT" | grep -E '^(sat|unsat|unknown)' | head -1) - NSEQ_MS=$(echo "$NSEQ_OUT" | grep real | awk '{split($2,a,"m"); split(a[2],b,"s"); printf "%d", (a[1]*60+b[1])*1000}') - [ -z "$NSEQ_RESULT" ] && NSEQ_RESULT="timeout" - [ -z "$NSEQ_MS" ] && NSEQ_MS=$((TIMEOUT_SEC * 1000)) - - SHORT=$(basename "$smt_file") - echo "$SHORT,$SEQ_RESULT,$SEQ_MS,$NSEQ_RESULT,$NSEQ_MS" >> "$RESULTS" - - done_count=$((done_count + 1)) - if [ $((done_count % 50)) -eq 0 ]; then - echo "Progress: $done_count / $SAMPLE files completed" - fi -done < /tmp/qf_s_sample.txt - -echo "Benchmark run complete: $done_count files" -``` - -## Phase 5: Collect Seq Traces for Interesting Cases - -For benchmarks where `seq` solves in under 2 s but `nseq` times out (seq-fast/nseq-slow cases), collect a brief `seq` trace to understand what algorithm is used: - -```bash -Z3=/tmp/z3-build/z3 -mkdir -p /tmp/traces - -# Find seq-fast / nseq-slow files: seq solved (sat/unsat) in <2000ms AND nseq timed out -awk -F, 'NR>1 && ($2=="sat"||$2=="unsat") && $3<2000 && $4=="timeout" {print $1}' \ - /tmp/benchmark-results.csv > /tmp/seq_fast_nseq_slow.txt -echo "seq-fast / nseq-slow files: $(wc -l < /tmp/seq_fast_nseq_slow.txt)" - -# Collect traces for at most 5 such cases -head -5 /tmp/seq_fast_nseq_slow.txt | while IFS= read -r short; do - # Find the full path - full=$(grep "/$short$" /tmp/qf_s_sample.txt | head -1) - [ -z "$full" ] && continue - timeout 5 "$Z3" \ - smt.string_solver=seq \ - -tr:seq \ - -T:5 \ - "$full" > "/tmp/traces/${short%.smt2}.seq.trace" 2>&1 || true -done -``` - -## Phase 6: Analyze Results - -Compute summary statistics from the CSV. Save the analysis script to a file and run it: - -```bash -cat > /tmp/analyze_benchmark.py << 'PYEOF' -import csv, sys - -results = [] -with open('/tmp/benchmark-results.csv') as f: - reader = csv.DictReader(f) - for row in reader: - results.append(row) - -total = len(results) -if total == 0: - print("No results found.") - sys.exit(0) - -def is_correct(r, solver): - prefix = 'seq' if solver == 'seq' else 'nseq' - return r[f'{prefix}_result'] in ('sat', 'unsat') - -def timed_out(r, solver): - prefix = 'seq' if solver == 'seq' else 'nseq' - return r[f'{prefix}_result'] == 'timeout' - -seq_solved = sum(1 for r in results if is_correct(r, 'seq')) -nseq_solved = sum(1 for r in results if is_correct(r, 'nseq')) -seq_to = sum(1 for r in results if timed_out(r, 'seq')) -nseq_to = sum(1 for r in results if timed_out(r, 'nseq')) - -seq_times = [int(r['seq_time_ms']) for r in results if is_correct(r, 'seq')] -nseq_times = [int(r['nseq_time_ms']) for r in results if is_correct(r, 'nseq')] - -def median(lst): - s = sorted(lst) - n = len(s) - return s[n//2] if n else 0 - -def mean(lst): - return sum(lst)//len(lst) if lst else 0 - -# Disagreements (sat vs unsat or vice-versa) -disagreements = [ - r for r in results - if r['seq_result'] in ('sat','unsat') - and r['nseq_result'] in ('sat','unsat') - and r['seq_result'] != r['nseq_result'] -] - -# seq-fast / nseq-slow: seq solved in <2s, nseq timed out -seq_fast_nseq_slow = [ - r for r in results - if is_correct(r, 'seq') and int(r['seq_time_ms']) < 2000 and timed_out(r, 'nseq') -] -# nseq-fast / seq-slow: nseq solved in <2s, seq timed out -nseq_fast_seq_slow = [ - r for r in results - if is_correct(r, 'nseq') and int(r['nseq_time_ms']) < 2000 and timed_out(r, 'seq') -] - -print(f"TOTAL={total}") -print(f"SEQ_SOLVED={seq_solved}") -print(f"NSEQ_SOLVED={nseq_solved}") -print(f"SEQ_TIMEOUTS={seq_to}") -print(f"NSEQ_TIMEOUTS={nseq_to}") -print(f"SEQ_MEDIAN_MS={median(seq_times)}") -print(f"NSEQ_MEDIAN_MS={median(nseq_times)}") -print(f"SEQ_MEAN_MS={mean(seq_times)}") -print(f"NSEQ_MEAN_MS={mean(nseq_times)}") -print(f"DISAGREEMENTS={len(disagreements)}") -print(f"SEQ_FAST_NSEQ_SLOW={len(seq_fast_nseq_slow)}") -print(f"NSEQ_FAST_SEQ_SLOW={len(nseq_fast_seq_slow)}") - -# Print top-10 slowest for nseq that seq handles fast -print("\nTOP_SEQ_FAST_NSEQ_SLOW:") -for r in sorted(seq_fast_nseq_slow, key=lambda x: -int(x['nseq_time_ms']))[:10]: - print(f" {r['file']} seq={r['seq_time_ms']}ms nseq={r['nseq_time_ms']}ms seq_result={r['seq_result']} nseq_result={r['nseq_result']}") - -print("\nTOP_NSEQ_FAST_SEQ_SLOW:") -for r in sorted(nseq_fast_seq_slow, key=lambda x: -int(x['seq_time_ms']))[:10]: - print(f" {r['file']} seq={r['seq_time_ms']}ms nseq={r['nseq_time_ms']}ms seq_result={r['seq_result']} nseq_result={r['nseq_result']}") - -if disagreements: - print(f"\nDISAGREEMENTS ({len(disagreements)}):") - for r in disagreements[:10]: - print(f" {r['file']} seq={r['seq_result']} nseq={r['nseq_result']}") -PYEOF - -python3 /tmp/analyze_benchmark.py -``` - -## Phase 7: Create GitHub Discussion - -Use the `create_discussion` safe-output tool to post a structured benchmark report. - -The discussion body should be formatted as follows (fill in real numbers from Phase 6): - -```markdown -# QF_S Benchmark: seq vs nseq - -**Date**: YYYY-MM-DD -**Branch**: c3 -**Commit**: `` -**Workflow Run**: [#](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) -**Files benchmarked**: N (capped at 300, timeout 5 s per file) - ---- - -## Summary - -| Metric | seq | nseq | -|--------|-----|------| -| Files solved (sat/unsat) | SEQ_SOLVED | NSEQ_SOLVED | -| Timeouts | SEQ_TO | NSEQ_TO | -| Median solve time (solved files) | X ms | Y ms | -| Mean solve time (solved files) | X ms | Y ms | -| **Disagreements (sat≠unsat)** | — | N | - ---- - -## Performance Comparison - -### seq-fast / nseq-slow (seq < 2 s, nseq timed out) - -These are benchmarks where the classical `seq` solver is significantly faster. These represent regression risk for `nseq`. - -| File | seq (ms) | nseq (ms) | seq result | nseq result | -|------|----------|-----------|------------|-------------| -[TOP 10 ENTRIES] - -### nseq-fast / seq-slow (nseq < 2 s, seq timed out) - -These are benchmarks where `nseq` shows a performance advantage. - -| File | seq (ms) | nseq (ms) | seq result | nseq result | -|------|----------|-----------|------------|-------------| -[TOP 10 ENTRIES] - ---- - -## Correctness - -**Disagreements** (files where seq says `sat` but nseq says `unsat` or vice versa): N - -[If disagreements exist, list all of them here with file paths and both results] - ---- - -## seq Trace Analysis (seq-fast / nseq-slow cases) - -
-Click to expand trace snippets for top seq-fast/nseq-slow cases - -[Insert trace snippet for each traced file, or "No traces collected" if section was skipped] - -
- ---- - -## Raw Data - -
-Full results CSV (click to expand) - -```csv -[PASTE FIRST 200 LINES OF /tmp/benchmark-results.csv] -``` - -
- ---- - -*Generated by the QF_S Benchmark workflow. To reproduce: build Z3 from the `c3` branch and run `z3 smt.string_solver=seq|nseq -T:10 `.* -``` - -## Edge Cases - -- If the build fails, call `missing_data` explaining the build error and stop. -- If no benchmark files are found at all, call `missing_data` explaining that no QF_S `.smt2` files were found in the `c3` branch. -- If Z3 crashes (segfault) on a file with either solver, record the result as `crash` and continue. -- If the total benchmark set is very small (< 5 files), note this prominently in the discussion and suggest adding more QF_S benchmarks to the `c3` branch. -- If zero disagreements and both solvers time out on the same files, note that the solvers are in agreement. -- If `create_discussion` fails (e.g., MCP session error), call `report_incomplete` with the reason and include the top-line statistics (files solved, timeouts, disagreement count) in the `details` field. - -## Important Notes - -- **DO NOT** modify any source files or create pull requests. -- **DO NOT** run `ninja` or any build command in the background with `&` — concurrent C++ compilation and LLM inference can exhaust available RAM and kill the agent process. Always wait for build commands to complete before proceeding. -- **DO NOT** run benchmarks for longer than 100 minutes total (leave buffer for posting). -- **DO** always report the commit SHA so results can be correlated with specific code versions. -- **DO** close older QF_S Benchmark discussions automatically (configured via `close-older-discussions: true`). -- **DO** highlight disagreements prominently — these are potential correctness bugs. diff --git a/.github/workflows/release-notes-updater.lock.yml b/.github/workflows/release-notes-updater.lock.yml index 5afd2a4ede..29dff97e3e 100644 --- a/.github/workflows/release-notes-updater.lock.yml +++ b/.github/workflows/release-notes-updater.lock.yml @@ -1,5 +1,5 @@ # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"15c4ae64be59716639904f5e3fbb25659a02adf7cca65aacc55dce4b011c4e21","body_hash":"e70834c576df30bc480dabc2d1fd9b9135e45233dc68fc865a8e9f22795e4941","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -40,7 +40,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -53,7 +53,7 @@ name: "Release Notes Updater" on: schedule: - - cron: "52 4 * * 5" + - cron: "34 18 * * 4" # Friendly format: weekly (scattered) workflow_dispatch: inputs: @@ -95,7 +95,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -410,7 +410,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -997,7 +997,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1238,7 +1238,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1505,7 +1505,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 84614da7eb..fac40f184c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ permissions: contents: write env: - RELEASE_VERSION: '4.17.1' + RELEASE_VERSION: '5.0.0' jobs: # ============================================================================ @@ -38,10 +38,10 @@ jobs: MACOSX_DEPLOYMENT_TARGET: "13.3" steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -82,10 +82,10 @@ jobs: MACOSX_DEPLOYMENT_TARGET: "13.3" steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -126,7 +126,7 @@ jobs: timeout-minutes: 15 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download macOS x64 Build uses: actions/download-artifact@v8.0.1 @@ -185,7 +185,7 @@ jobs: timeout-minutes: 15 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download macOS ARM64 Build uses: actions/download-artifact@v8.0.1 @@ -243,10 +243,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -272,10 +272,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -307,10 +307,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -363,7 +363,7 @@ jobs: container: quay.io/pypa/manylinux_2_28_x86_64:latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Select Python run: | @@ -401,7 +401,7 @@ jobs: container: quay.io/pypa/manylinux_2_28_x86_64:latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download ARM toolchain run: curl -L -o /tmp/arm-toolchain.tar.xz 'https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz' @@ -449,7 +449,7 @@ jobs: container: quay.io/pypa/manylinux_2_28_x86_64:latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download RISC-V toolchain run: curl -L -o /tmp/riscv-toolchain.tar.gz 'https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.09.03/riscv64-glibc-ubuntu-20.04-gcc-nightly-2024.09.03-nightly.tar.gz' @@ -503,10 +503,10 @@ jobs: timeout-minutes: 120 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -530,10 +530,10 @@ jobs: timeout-minutes: 120 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -557,10 +557,10 @@ jobs: timeout-minutes: 90 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -588,10 +588,10 @@ jobs: runs-on: windows-latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -663,10 +663,10 @@ jobs: runs-on: windows-latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -708,10 +708,10 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -821,7 +821,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download all artifacts uses: actions/download-artifact@v8.0.1 @@ -877,7 +877,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Download NuGet packages uses: actions/download-artifact@v8.0.1 diff --git a/.github/workflows/smtlib-benchmark-finder.lock.yml b/.github/workflows/smtlib-benchmark-finder.lock.yml index 770d98036b..72833269f1 100644 --- a/.github/workflows/smtlib-benchmark-finder.lock.yml +++ b/.github/workflows/smtlib-benchmark-finder.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"bbc490b217ed529ee9f58d7645e34c9b2bb9d46b3742bce1621e666a6d52d8c0","body_hash":"2b472570491bb4767575994e73f38198393c52deaed2b2751f8146309ad22843","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"df207f4a2ef576f34e072b2145cae9c061565cbb08f979160136bc4ef05053b4","body_hash":"2b472570491bb4767575994e73f38198393c52deaed2b2751f8146309ad22843","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} +# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -26,7 +26,6 @@ # Monthly SMTLIB Benchmark Finder. Searches GitHub for repositories containing SMT-LIB benchmarks (.smt2 files), excludes repositories that belong to the official SMT-LIB benchmark sets (linked from smtlib.org and hosted on Zenodo), and posts a curated summary of community-contributed benchmark links as a GitHub Discussion. # # Secrets used: -# - COPILOT_GITHUB_TOKEN # - GH_AW_GITHUB_MCP_SERVER_TOKEN # - GH_AW_GITHUB_TOKEN # - GITHUB_TOKEN @@ -41,7 +40,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -88,7 +87,6 @@ jobs: engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} model: ${{ steps.generate_aw_info.outputs.model }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} @@ -96,7 +94,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -177,11 +175,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs'); await main(); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Checkout .github and .agents folders uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -385,7 +378,11 @@ jobs: needs: activation if: needs.activation.outputs.daily_ai_credits_exceeded != 'true' runs-on: ubuntu-latest - permissions: read-all + permissions: + contents: read + copilot-requests: write + issues: read + pull-requests: read concurrency: group: "gh-aw-copilot-${{ github.workflow }}" queue: max @@ -420,7 +417,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -819,7 +816,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} @@ -843,6 +840,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Detect agent errors if: always() @@ -878,8 +876,7 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); await main(); env: - GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' - SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_SECRET_NAMES: 'GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -1044,7 +1041,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1235,7 +1232,6 @@ jobs: GH_AW_WORKFLOW_ID: "smtlib-benchmark-finder" GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" GH_AW_ENGINE_ID: "copilot" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }} @@ -1279,6 +1275,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + copilot-requests: write env: GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} outputs: @@ -1289,7 +1286,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1441,7 +1438,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }} @@ -1463,6 +1460,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Parse threat detection token usage for step summary id: parse_detection_token_usage @@ -1555,7 +1553,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1631,7 +1629,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/smtlib-benchmark-finder.md b/.github/workflows/smtlib-benchmark-finder.md index 7b773af064..17848205b1 100644 --- a/.github/workflows/smtlib-benchmark-finder.md +++ b/.github/workflows/smtlib-benchmark-finder.md @@ -13,7 +13,11 @@ on: timeout-minutes: 60 -permissions: read-all +permissions: + contents: read + issues: read + pull-requests: read + copilot-requests: write network: allowed: diff --git a/.github/workflows/specbot-crash-analyzer.lock.yml b/.github/workflows/specbot-crash-analyzer.lock.yml index 28885f9ee9..a8f380a172 100644 --- a/.github/workflows/specbot-crash-analyzer.lock.yml +++ b/.github/workflows/specbot-crash-analyzer.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"e23cf8d980312a03d7f04c460f390cef7137d7995a701661e6c6fce74df245e9","body_hash":"7030f1fac5beec9af23f992361435bd8fc32966ed8d1711e73e230a8f71aaf39","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"75b7aac4b5b7f7d73ab2cbf90b693f26cd644b09210f428a02c15512e1661729","body_hash":"7030f1fac5beec9af23f992361435bd8fc32966ed8d1711e73e230a8f71aaf39","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} +# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -26,7 +26,6 @@ # Build Z3 in debug mode from the c3 branch, compile and run the specbot tests, identify root causes for any crashes, and post findings as a GitHub Discussion. # # Secrets used: -# - COPILOT_GITHUB_TOKEN # - GH_AW_GITHUB_MCP_SERVER_TOKEN # - GH_AW_GITHUB_TOKEN # - GITHUB_TOKEN @@ -41,7 +40,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -86,7 +85,6 @@ jobs: engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} model: ${{ steps.generate_aw_info.outputs.model }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} @@ -94,7 +92,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -175,11 +173,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs'); await main(); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Checkout .github and .agents folders uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -385,7 +378,12 @@ jobs: needs: activation if: needs.activation.outputs.daily_ai_credits_exceeded != 'true' runs-on: ubuntu-latest - permissions: read-all + permissions: + contents: read + copilot-requests: write + discussions: read + issues: read + pull-requests: read env: DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} GH_AW_ASSETS_ALLOWED_EXTS: "" @@ -417,7 +415,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -856,7 +854,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} @@ -880,6 +878,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Detect agent errors if: always() @@ -915,8 +914,7 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); await main(); env: - GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' - SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_SECRET_NAMES: 'GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -1080,7 +1078,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1271,7 +1269,6 @@ jobs: GH_AW_WORKFLOW_ID: "specbot-crash-analyzer" GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" GH_AW_ENGINE_ID: "copilot" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }} @@ -1315,6 +1312,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + copilot-requests: write env: GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} outputs: @@ -1325,7 +1323,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1477,7 +1475,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }} @@ -1499,6 +1497,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Parse threat detection token usage for step summary id: parse_detection_token_usage @@ -1591,7 +1590,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1667,7 +1666,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/specbot-crash-analyzer.md b/.github/workflows/specbot-crash-analyzer.md index 104dc5b3a6..5e63d31d5c 100644 --- a/.github/workflows/specbot-crash-analyzer.md +++ b/.github/workflows/specbot-crash-analyzer.md @@ -8,7 +8,12 @@ on: timeout-minutes: 120 -permissions: read-all +permissions: + contents: read + issues: read + pull-requests: read + discussions: read + copilot-requests: write network: defaults diff --git a/.github/workflows/tactic-to-simplifier.lock.yml b/.github/workflows/tactic-to-simplifier.lock.yml index d70eaf19fe..ea6e080305 100644 --- a/.github/workflows/tactic-to-simplifier.lock.yml +++ b/.github/workflows/tactic-to-simplifier.lock.yml @@ -1,5 +1,5 @@ # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"2ea4f1dabdfaa25670c4eea9c5869bcd1f55b1632124b12a5532760620e3929e","body_hash":"d737b5a4fc4e883ee954743239f36f47a253f2d731d5cfdf409c3311fcf69a83","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -41,7 +41,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -54,7 +54,7 @@ name: "Tactic-to-Simplifier Comparison Agent" on: schedule: - - cron: "20 22 * * 4" + - cron: "34 14 * * 6" # Friendly format: weekly (scattered) workflow_dispatch: inputs: @@ -97,7 +97,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -420,7 +420,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1050,7 +1050,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1292,7 +1292,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1559,7 +1559,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1635,7 +1635,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/tptp-benchmark.lock.yml b/.github/workflows/tptp-benchmark.lock.yml index e0b20c0bab..fa0bd18ec7 100644 --- a/.github/workflows/tptp-benchmark.lock.yml +++ b/.github/workflows/tptp-benchmark.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"a9a6e78bc70c14e8aa4a23ed548ef66ec02caeaae87a8d731b29f69c61526ab2","body_hash":"c8dc70436710705ec44e1f6b0236a2e5b314b3aec02708ef192cab1bb4099dce","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"941a41fa2bca88df96e4dcbd8e0fb4a38b99edad52753933f4f2247270639ade","body_hash":"c8dc70436710705ec44e1f6b0236a2e5b314b3aec02708ef192cab1bb4099dce","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} +# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -26,7 +26,6 @@ # Weekly benchmark of Z3's TPTP front-end against 500 random TPTP problems. Downloads TPTP benchmarks from tptp.org, resolves axiom dependencies, skips large problems, runs each with a 5-second timeout, and posts a discrepancy/crash report as a GitHub discussion. # # Secrets used: -# - COPILOT_GITHUB_TOKEN # - GH_AW_GITHUB_MCP_SERVER_TOKEN # - GH_AW_GITHUB_TOKEN # - GITHUB_TOKEN @@ -41,7 +40,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -88,7 +87,6 @@ jobs: engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} model: ${{ steps.generate_aw_info.outputs.model }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} @@ -96,7 +94,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -177,11 +175,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs'); await main(); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Checkout .github and .agents folders uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -380,7 +373,11 @@ jobs: needs: activation if: needs.activation.outputs.daily_ai_credits_exceeded != 'true' runs-on: ubuntu-latest - permissions: read-all + permissions: + contents: read + copilot-requests: write + issues: read + pull-requests: read concurrency: group: "gh-aw-copilot-${{ github.workflow }}" queue: max @@ -413,7 +410,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -800,7 +797,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} @@ -824,6 +821,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Detect agent errors if: always() @@ -859,8 +857,7 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); await main(); env: - GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' - SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_SECRET_NAMES: 'GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -1005,7 +1002,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1196,7 +1193,6 @@ jobs: GH_AW_WORKFLOW_ID: "tptp-benchmark" GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" GH_AW_ENGINE_ID: "copilot" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }} @@ -1237,6 +1233,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + copilot-requests: write env: GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} outputs: @@ -1247,7 +1244,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1399,7 +1396,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }} @@ -1421,6 +1418,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Parse threat detection token usage for step summary id: parse_detection_token_usage @@ -1513,7 +1511,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/tptp-benchmark.md b/.github/workflows/tptp-benchmark.md index d12252c98c..134d0e7009 100644 --- a/.github/workflows/tptp-benchmark.md +++ b/.github/workflows/tptp-benchmark.md @@ -10,7 +10,11 @@ on: - cron: "0 6 * * 1" workflow_dispatch: -permissions: read-all +permissions: + contents: read + issues: read + pull-requests: read + copilot-requests: write network: allowed: diff --git a/.github/workflows/wasm-release.yml b/.github/workflows/wasm-release.yml index a34346a4f6..5414300d71 100644 --- a/.github/workflows/wasm-release.yml +++ b/.github/workflows/wasm-release.yml @@ -19,14 +19,15 @@ jobs: publish: name: Publish runs-on: ubuntu-latest + environment: release steps: - name: Checkout - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup node - uses: actions/setup-node@v6 + uses: actions/setup-node@v7 with: - node-version: "lts/*" + node-version: "22" registry-url: "https://registry.npmjs.org" - name: Prepare for publish diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index 740b3b7b1a..6d8b38b6da 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -21,12 +21,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v7.0.0 + uses: actions/checkout@v7.0.1 - name: Setup node - uses: actions/setup-node@v6 + uses: actions/setup-node@v7 with: - node-version: "lts/*" + node-version: "22" - name: Setup emscripten uses: mymindstorm/setup-emsdk@v16 diff --git a/.github/workflows/wip.yml b/.github/workflows/wip.yml index 6ed1a79287..9c04da7cef 100644 --- a/.github/workflows/wip.yml +++ b/.github/workflows/wip.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7.0.0 + - uses: actions/checkout@v7.0.1 - name: Configure CMake run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} diff --git a/.github/workflows/workflow-suggestion-agent.lock.yml b/.github/workflows/workflow-suggestion-agent.lock.yml index cfa671ba5b..1d17ada9db 100644 --- a/.github/workflows/workflow-suggestion-agent.lock.yml +++ b/.github/workflows/workflow-suggestion-agent.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"bc4d6c4f7653b2efc986f8098b4a23c0aaf455d6d7fa17516aece23a2ef7cee2","body_hash":"01aef2e3410178a2ec9fa4a4731b68504136f16d352e3498deb2b9a6da385733","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"c48c6dff1b8433d7ba9f89ccedf079c9a906b423711faeb3584f5b61aca1dab3","body_hash":"01aef2e3410178a2ec9fa4a4731b68504136f16d352e3498deb2b9a6da385733","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} +# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -26,7 +26,6 @@ # Weekly agent that suggests which agentic workflow agents should be added to the Z3 repository # # Secrets used: -# - COPILOT_GITHUB_TOKEN # - GH_AW_GITHUB_MCP_SERVER_TOKEN # - GH_AW_GITHUB_TOKEN # - GITHUB_TOKEN @@ -41,7 +40,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -54,7 +53,7 @@ name: "Workflow Suggestion Agent" on: schedule: - - cron: "23 2 * * 0" + - cron: "5 21 * * 5" # Friendly format: weekly (scattered) workflow_dispatch: inputs: @@ -89,7 +88,6 @@ jobs: engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} model: ${{ steps.generate_aw_info.outputs.model }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} @@ -97,7 +95,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -178,11 +176,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs'); await main(); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Checkout .github and .agents folders uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -386,7 +379,12 @@ jobs: needs: activation if: needs.activation.outputs.daily_ai_credits_exceeded != 'true' runs-on: ubuntu-latest - permissions: read-all + permissions: + contents: read + copilot-requests: write + discussions: read + issues: read + pull-requests: read concurrency: group: "gh-aw-copilot-${{ github.workflow }}" queue: max @@ -421,7 +419,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -818,7 +816,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }} @@ -842,6 +840,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Detect agent errors if: always() @@ -877,8 +876,7 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); await main(); env: - GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' - SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_SECRET_NAMES: 'GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -1042,7 +1040,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1232,7 +1230,6 @@ jobs: GH_AW_WORKFLOW_ID: "workflow-suggestion-agent" GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" GH_AW_ENGINE_ID: "copilot" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }} @@ -1276,6 +1273,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + copilot-requests: write env: GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }} outputs: @@ -1286,7 +1284,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1438,7 +1436,7 @@ jobs: AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ github.token }} COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'claude-sonnet-4.6' }} GH_AW_LLM_PROVIDER: github GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }} @@ -1460,6 +1458,7 @@ jobs: GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com GIT_COMMITTER_NAME: github-actions[bot] RUNNER_TEMP: ${{ runner.temp }} + S2STOKENS: true TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} - name: Parse threat detection token usage for step summary id: parse_detection_token_usage @@ -1552,7 +1551,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1628,7 +1627,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/workflow-suggestion-agent.md b/.github/workflows/workflow-suggestion-agent.md index 1990ba95f1..309d1baae0 100644 --- a/.github/workflows/workflow-suggestion-agent.md +++ b/.github/workflows/workflow-suggestion-agent.md @@ -6,7 +6,12 @@ on: timeout-minutes: 30 -permissions: read-all +permissions: + contents: read + issues: read + pull-requests: read + discussions: read + copilot-requests: write network: defaults diff --git a/.github/workflows/zipt-code-reviewer.lock.yml b/.github/workflows/zipt-code-reviewer.lock.yml index 4784de574c..679eafa99e 100644 --- a/.github/workflows/zipt-code-reviewer.lock.yml +++ b/.github/workflows/zipt-code-reviewer.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"c6b62191efdd0d5825930d7812d694eacc699a27a1cf91f03bee4416d314bf7d","body_hash":"8d42996a836cf572c7768349b6475e3d79f2631d070a31d31ac4f7522d617e33","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.81.6","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"90eb42871609810a52a4978e4b7466c07df8df2436b147dc3c7a90af001cae8b","body_hash":"8d42996a836cf572c7768349b6475e3d79f2631d070a31d31ac4f7522d617e33","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.65"}} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]} # This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -41,7 +41,7 @@ # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@v0.81.6 +# - github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 # # Container images used: # - ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7 @@ -54,7 +54,8 @@ name: "ZIPT Code Reviewer" on: schedule: - - cron: "0 0,6,12,18 * * *" + - cron: "37 5 * * *" + # Friendly format: daily (scattered) workflow_dispatch: inputs: aw_context: @@ -96,7 +97,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -417,7 +418,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1070,7 +1071,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1313,7 +1314,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1580,7 +1581,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} @@ -1656,7 +1657,7 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@v0.81.6 + uses: github/gh-aw-actions/setup@ba6380cc6e5be5d21677bebe04d52fb48e3abec7 # v0.81.6 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} diff --git a/.github/workflows/zipt-code-reviewer.md b/.github/workflows/zipt-code-reviewer.md index 788b9cadc1..1ec51eb49f 100644 --- a/.github/workflows/zipt-code-reviewer.md +++ b/.github/workflows/zipt-code-reviewer.md @@ -2,8 +2,7 @@ description: Reviews Z3 string/sequence graph implementation (euf_sgraph, euf_seq_plugin, src/smt/seq) by comparing with the ZIPT reference implementation and reporting improvements as git diffs in GitHub issues on: - schedule: - - cron: "0 0,6,12,18 * * *" + schedule: daily workflow_dispatch: permissions: read-all diff --git a/CMakeLists.txt b/CMakeLists.txt index ae57d5b2f4..aa9bfcad9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,7 +197,11 @@ elseif (WIN32) message(STATUS "Platform: Windows") list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_WINDOWS") # workaround for #7420 - list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR") + list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR") + # dbghelp is used in debug.cpp for stack backtraces on Windows. + # With MSVC this is handled by #pragma comment(lib, "dbghelp.lib") in debug.cpp, + # but MinGW does not support that pragma, so we add it explicitly here. + list(APPEND Z3_DEPENDENT_LIBS dbghelp) elseif (EMSCRIPTEN) message(STATUS "Platform: Emscripten") list(APPEND Z3_DEPENDENT_EXTRA_CXX_LINK_FLAGS diff --git a/MODULE.bazel b/MODULE.bazel index 0d4d442ffc..a05151c9d6 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,6 +1,6 @@ module( name = "z3", - version = "4.17.1", # TODO: Read from VERSION.txt - currently manual sync required + version = "5.0.0", # TODO: Read from VERSION.txt - currently manual sync required bazel_compatibility = [">=7.0.0"], ) diff --git a/README.md b/README.md index ec8342772a..be304de778 100644 --- a/README.md +++ b/README.md @@ -23,18 +23,18 @@ See the [release notes](RELEASE_NOTES.md) for notes on various stable releases o | [![WASM Build](https://github.com/Z3Prover/z3/actions/workflows/wasm.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/wasm.yml) | [![Windows](https://github.com/Z3Prover/z3/actions/workflows/Windows.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/Windows.yml) | [![CI](https://github.com/Z3Prover/z3/actions/workflows/ci.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/ci.yml) | [![OCaml Binding CI](https://github.com/Z3Prover/z3/actions/workflows/ocaml.yaml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/ocaml.yaml) | ### Scheduled Workflows -| Open Bugs | Android Build | Pyodide Wheel (PyPI) | Nightly Build | Cross Build | -| -----------|---------------|---------------|---------------|-------------| -| [![Open Issues](https://github.com/Z3Prover/z3/actions/workflows/wip.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/wip.yml) | [![Android Build](https://github.com/Z3Prover/z3/actions/workflows/android-build.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/android-build.yml) | [![Pyodide Wheel (PyPI)](https://github.com/Z3Prover/z3/actions/workflows/pyodide-pypi.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/pyodide-pypi.yml) | [![Nightly Build](https://github.com/Z3Prover/z3/actions/workflows/nightly.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/nightly.yml) | [![RISC V and PowerPC 64](https://github.com/Z3Prover/z3/actions/workflows/cross-build.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/cross-build.yml) | +| Open Bugs | Android Build | Pyodide Wheel (PyPI) | Nightly Build | Cross Build | F* Master Build | +| -----------|---------------|---------------|---------------|-------------|------------------| +| [![Open Issues](https://github.com/Z3Prover/z3/actions/workflows/wip.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/wip.yml) | [![Android Build](https://github.com/Z3Prover/z3/actions/workflows/android-build.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/android-build.yml) | [![Pyodide Wheel (PyPI)](https://github.com/Z3Prover/z3/actions/workflows/pyodide-pypi.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/pyodide-pypi.yml) | [![Nightly Build](https://github.com/Z3Prover/z3/actions/workflows/nightly.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/nightly.yml) | [![RISC V and PowerPC 64](https://github.com/Z3Prover/z3/actions/workflows/cross-build.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/cross-build.yml) | [![F* Master Build](https://github.com/Z3Prover/z3/actions/workflows/fstar-master-build.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/fstar-master-build.yml) | | MSVC Static | MSVC Clang-CL | Build Z3 Cache | Memory Safety | Mark PRs Ready | |-------------|---------------|----------------|---------------|----------------| | [![MSVC Static Build](https://github.com/Z3Prover/z3/actions/workflows/msvc-static-build.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/msvc-static-build.yml) | [![MSVC Clang-CL Static Build](https://github.com/Z3Prover/z3/actions/workflows/msvc-static-build-clang-cl.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/msvc-static-build-clang-cl.yml) | [![Build and Cache Z3](https://github.com/Z3Prover/z3/actions/workflows/build-z3-cache.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/build-z3-cache.yml) | [![Memory Safety Analysis](https://github.com/Z3Prover/z3/actions/workflows/memory-safety.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/memory-safety.yml) | [![Mark PRs Ready for Review](https://github.com/Z3Prover/z3/actions/workflows/mark-prs-ready-for-review.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/mark-prs-ready-for-review.yml) | ### Manual & Release Workflows -| Documentation | Release Build | WASM Release | NuGet Build | -|---------------|---------------|--------------|-------------| -| [![Documentation](https://github.com/Z3Prover/z3/actions/workflows/docs.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/docs.yml) | [![Release Build](https://github.com/Z3Prover/z3/actions/workflows/release.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/release.yml) | [![WebAssembly Publish](https://github.com/Z3Prover/z3/actions/workflows/wasm-release.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/wasm-release.yml) | [![Build NuGet Package](https://github.com/Z3Prover/z3/actions/workflows/nuget-build.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/nuget-build.yml) | +| Documentation | Release Build | WASM Release | +|---------------|---------------|--------------| +| [![Documentation](https://github.com/Z3Prover/z3/actions/workflows/docs.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/docs.yml) | [![Release Build](https://github.com/Z3Prover/z3/actions/workflows/release.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/release.yml) | [![WebAssembly Publish](https://github.com/Z3Prover/z3/actions/workflows/wasm-release.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/wasm-release.yml) | ### Specialized Workflows | Nightly Validation | Copilot Setup | Agentics Maintenance | @@ -46,9 +46,9 @@ See the [release notes](RELEASE_NOTES.md) for notes on various stable releases o | -------------|-----------------|---------------|---------------------|-------------------| | [![API Coherence Checker](https://github.com/Z3Prover/z3/actions/workflows/api-coherence-checker.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/api-coherence-checker.lock.yml) | [![Code Simplifier](https://github.com/Z3Prover/z3/actions/workflows/code-simplifier.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/code-simplifier.lock.yml) | [![Release Notes Updater](https://github.com/Z3Prover/z3/actions/workflows/release-notes-updater.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/release-notes-updater.lock.yml) | [![Workflow Suggestion Agent](https://github.com/Z3Prover/z3/actions/workflows/workflow-suggestion-agent.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/workflow-suggestion-agent.lock.yml) | [![Academic Citation Tracker](https://github.com/Z3Prover/z3/actions/workflows/academic-citation-tracker.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/academic-citation-tracker.lock.yml) | -| Issue Backlog | Memory Safety Report | QF-S Benchmark | Specbot Crash Analyzer | SMTLIB Benchmark Finder | -| --------------|----------------------|----------------|------------------------|-------------------------| -| [![Issue Backlog Processor](https://github.com/Z3Prover/z3/actions/workflows/issue-backlog-processor.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/issue-backlog-processor.lock.yml) | [![Memory Safety Report](https://github.com/Z3Prover/z3/actions/workflows/memory-safety-report.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/memory-safety-report.lock.yml) | [![ZIPT String Solver Benchmark](https://github.com/Z3Prover/z3/actions/workflows/qf-s-benchmark.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/qf-s-benchmark.lock.yml) | [![Specbot Crash Analyzer](https://github.com/Z3Prover/z3/actions/workflows/specbot-crash-analyzer.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/specbot-crash-analyzer.lock.yml) | [![SMTLIB Benchmark Finder](https://github.com/Z3Prover/z3/actions/workflows/smtlib-benchmark-finder.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/smtlib-benchmark-finder.lock.yml) | +| Issue Backlog | Memory Safety Report | Specbot Crash Analyzer | SMTLIB Benchmark Finder | +| --------------|----------------------|------------------------|-------------------------| +| [![Issue Backlog Processor](https://github.com/Z3Prover/z3/actions/workflows/issue-backlog-processor.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/issue-backlog-processor.lock.yml) | [![Memory Safety Report](https://github.com/Z3Prover/z3/actions/workflows/memory-safety-report.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/memory-safety-report.lock.yml) | [![Specbot Crash Analyzer](https://github.com/Z3Prover/z3/actions/workflows/specbot-crash-analyzer.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/specbot-crash-analyzer.lock.yml) | [![SMTLIB Benchmark Finder](https://github.com/Z3Prover/z3/actions/workflows/smtlib-benchmark-finder.lock.yml/badge.svg)](https://github.com/Z3Prover/z3/actions/workflows/smtlib-benchmark-finder.lock.yml) | | TPTP Benchmark | |----------------| @@ -298,4 +298,3 @@ to Z3's C API. For more information, see [MachineArithmetic/README.md](https://g ## Power Tools * The [Axiom Profiler](https://github.com/viperproject/axiom-profiler-2) currently developed by ETH Zurich - diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 669dfec8a2..361f7a1d96 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,7 +1,7 @@ RELEASE NOTES -Version 4.17.0 +Version 5.0.0 ============== - A FiniteSets theory solver FiniteSets is a theory with a sort (FiniteSet S) for base sort S. diff --git a/agentics/qf-s-benchmark.md b/agentics/qf-s-benchmark.md deleted file mode 100644 index 3ceb8f58e7..0000000000 --- a/agentics/qf-s-benchmark.md +++ /dev/null @@ -1,364 +0,0 @@ -# QF_S String Solver Benchmark - -## Job Description - -Your name is ${{ github.workflow }}. You are an expert performance analyst for the Z3 theorem prover, specializing in the string/sequence theory. Your task is to benchmark the `seq` solver (classical string theory) against the `nseq` solver (ZIPT-based string theory) on the QF_S test suite from the `c3` branch, and post a structured report as a GitHub Discussion. - -The workspace already contains the `c3` branch (checked out by the preceding workflow step). - -## Phase 1: Set Up the Build Environment - -Install required build tools: - -```bash -sudo apt-get update -y -sudo apt-get install -y cmake ninja-build python3 python3-pip time -``` - -Verify tools: - -```bash -cmake --version -ninja --version -python3 --version -``` - -## Phase 2: Build Z3 in Debug Mode with Seq Tracing - -Build Z3 with debug symbols so that tracing and timing data are meaningful. - -```bash -mkdir -p /tmp/z3-build -cd /tmp/z3-build -cmake "$GITHUB_WORKSPACE" \ - -G Ninja \ - -DCMAKE_BUILD_TYPE=Debug \ - -DZ3_BUILD_TEST_EXECUTABLES=OFF \ - 2>&1 | tee /tmp/z3-cmake.log -ninja z3 2>&1 | tee /tmp/z3-build.log -``` - -Verify the binary was built: - -```bash -/tmp/z3-build/z3 --version -``` - -If the build fails, report it immediately and stop. - -## Phase 3: Discover QF_S Benchmark Files - -Find all `.smt2` benchmark files in the workspace that belong to the QF_S logic: - -```bash -# Search for explicit QF_S logic declarations -grep -rl 'QF_S' "$GITHUB_WORKSPACE" --include='*.smt2' 2>/dev/null > /tmp/qf_s_files.txt - -# Also look in dedicated benchmark directories -find "$GITHUB_WORKSPACE" \ - \( -path "*/QF_S/*" -o -path "*/qf_s/*" -o -path "*/benchmarks/*" \) \ - -name '*.smt2' 2>/dev/null >> /tmp/qf_s_files.txt - -# Deduplicate -sort -u /tmp/qf_s_files.txt -o /tmp/qf_s_files.txt - -TOTAL=$(wc -l < /tmp/qf_s_files.txt) -echo "Found $TOTAL QF_S benchmark files" -head -20 /tmp/qf_s_files.txt -``` - -If fewer than 5 files are found, also scan the entire workspace for any `.smt2` file that exercises string constraints: - -```bash -if [ "$TOTAL" -lt 5 ]; then - grep -rl 'declare.*String\|str\.\|seq\.' "$GITHUB_WORKSPACE" \ - --include='*.smt2' 2>/dev/null >> /tmp/qf_s_files.txt - sort -u /tmp/qf_s_files.txt -o /tmp/qf_s_files.txt - TOTAL=$(wc -l < /tmp/qf_s_files.txt) - echo "After extended search: $TOTAL files" -fi -``` - -Cap the benchmark set to keep total runtime under 60 minutes: - -```bash -# Use at most 500 files; take a random sample if more are available -if [ "$TOTAL" -gt 500 ]; then - shuf -n 500 /tmp/qf_s_files.txt > /tmp/qf_s_sample.txt -else - cp /tmp/qf_s_files.txt /tmp/qf_s_sample.txt -fi -SAMPLE=$(wc -l < /tmp/qf_s_sample.txt) -echo "Running benchmarks on $SAMPLE files" -``` - -## Phase 4: Run Benchmarks — seq vs nseq - -Run each benchmark with both solvers. Use a per-file timeout of 10 seconds. Set Z3's internal timeout to 9 seconds so it exits cleanly before the shell timeout fires. - -```bash -Z3=/tmp/z3-build/z3 -TIMEOUT_SEC=10 -Z3_TIMEOUT_SEC=9 -RESULTS=/tmp/benchmark-results.csv - -echo "file,seq_result,seq_time_ms,nseq_result,nseq_time_ms" > "$RESULTS" - -total=0 -done_count=0 -while IFS= read -r smt_file; do - total=$((total + 1)) - - # Run with seq solver; capture both stdout (z3 output) and stderr (time output) - SEQ_OUT=$({ time timeout "$TIMEOUT_SEC" "$Z3" \ - smt.string_solver=seq \ - -T:"$Z3_TIMEOUT_SEC" \ - "$smt_file" 2>/dev/null; } 2>&1) - SEQ_RESULT=$(echo "$SEQ_OUT" | grep -E '^(sat|unsat|unknown)' | head -1) - SEQ_MS=$(echo "$SEQ_OUT" | grep real | awk '{split($2,a,"m"); split(a[2],b,"s"); printf "%d", (a[1]*60+b[1])*1000}') - [ -z "$SEQ_RESULT" ] && SEQ_RESULT="timeout" - [ -z "$SEQ_MS" ] && SEQ_MS=$((TIMEOUT_SEC * 1000)) - - # Run with nseq solver; same structure - NSEQ_OUT=$({ time timeout "$TIMEOUT_SEC" "$Z3" \ - smt.string_solver=nseq \ - -T:"$Z3_TIMEOUT_SEC" \ - "$smt_file" 2>/dev/null; } 2>&1) - NSEQ_RESULT=$(echo "$NSEQ_OUT" | grep -E '^(sat|unsat|unknown)' | head -1) - NSEQ_MS=$(echo "$NSEQ_OUT" | grep real | awk '{split($2,a,"m"); split(a[2],b,"s"); printf "%d", (a[1]*60+b[1])*1000}') - [ -z "$NSEQ_RESULT" ] && NSEQ_RESULT="timeout" - [ -z "$NSEQ_MS" ] && NSEQ_MS=$((TIMEOUT_SEC * 1000)) - - SHORT=$(basename "$smt_file") - echo "$SHORT,$SEQ_RESULT,$SEQ_MS,$NSEQ_RESULT,$NSEQ_MS" >> "$RESULTS" - - done_count=$((done_count + 1)) - if [ $((done_count % 50)) -eq 0 ]; then - echo "Progress: $done_count / $SAMPLE files completed" - fi -done < /tmp/qf_s_sample.txt - -echo "Benchmark run complete: $done_count files" -``` - -## Phase 5: Collect Seq Traces for Interesting Cases - -For benchmarks where `seq` solves in under 2 s but `nseq` times out (seq-fast/nseq-slow cases), collect a brief `seq` trace to understand what algorithm is used: - -```bash -Z3=/tmp/z3-build/z3 -mkdir -p /tmp/traces - -# Find seq-fast / nseq-slow files: seq solved (sat/unsat) in <2000ms AND nseq timed out -awk -F, 'NR>1 && ($2=="sat"||$2=="unsat") && $3<2000 && $4=="timeout" {print $1}' \ - /tmp/benchmark-results.csv > /tmp/seq_fast_nseq_slow.txt -echo "seq-fast / nseq-slow files: $(wc -l < /tmp/seq_fast_nseq_slow.txt)" - -# Collect traces for at most 5 such cases -head -5 /tmp/seq_fast_nseq_slow.txt | while IFS= read -r short; do - # Find the full path - full=$(grep "/$short$" /tmp/qf_s_sample.txt | head -1) - [ -z "$full" ] && continue - timeout 5 "$Z3" \ - smt.string_solver=seq \ - -tr:seq \ - -T:5 \ - "$full" > "/tmp/traces/${short%.smt2}.seq.trace" 2>&1 || true -done -``` - -## Phase 6: Analyze Results - -Compute summary statistics from the CSV: - -```bash -Save the analysis script to a file and run it: - -```bash -cat > /tmp/analyze_benchmark.py << 'PYEOF' -import csv, sys - -results = [] -with open('/tmp/benchmark-results.csv') as f: - reader = csv.DictReader(f) - for row in reader: - results.append(row) - -total = len(results) -if total == 0: - print("No results found.") - sys.exit(0) - -def is_correct(r, solver): - prefix = 'seq' if solver == 'seq' else 'nseq' - return r[f'{prefix}_result'] in ('sat', 'unsat') - -def timed_out(r, solver): - prefix = 'seq' if solver == 'seq' else 'nseq' - return r[f'{prefix}_result'] == 'timeout' - -seq_solved = sum(1 for r in results if is_correct(r, 'seq')) -nseq_solved = sum(1 for r in results if is_correct(r, 'nseq')) -seq_to = sum(1 for r in results if timed_out(r, 'seq')) -nseq_to = sum(1 for r in results if timed_out(r, 'nseq')) - -seq_times = [int(r['seq_time_ms']) for r in results if is_correct(r, 'seq')] -nseq_times = [int(r['nseq_time_ms']) for r in results if is_correct(r, 'nseq')] - -def median(lst): - s = sorted(lst) - n = len(s) - return s[n//2] if n else 0 - -def mean(lst): - return sum(lst)//len(lst) if lst else 0 - -# Disagreements (sat vs unsat or vice-versa) -disagreements = [ - r for r in results - if r['seq_result'] in ('sat','unsat') - and r['nseq_result'] in ('sat','unsat') - and r['seq_result'] != r['nseq_result'] -] - -# seq-fast / nseq-slow: seq solved in <2s, nseq timed out -seq_fast_nseq_slow = [ - r for r in results - if is_correct(r, 'seq') and int(r['seq_time_ms']) < 2000 and timed_out(r, 'nseq') -] -# nseq-fast / seq-slow: nseq solved in <2s, seq timed out -nseq_fast_seq_slow = [ - r for r in results - if is_correct(r, 'nseq') and int(r['nseq_time_ms']) < 2000 and timed_out(r, 'seq') -] - -print(f"TOTAL={total}") -print(f"SEQ_SOLVED={seq_solved}") -print(f"NSEQ_SOLVED={nseq_solved}") -print(f"SEQ_TIMEOUTS={seq_to}") -print(f"NSEQ_TIMEOUTS={nseq_to}") -print(f"SEQ_MEDIAN_MS={median(seq_times)}") -print(f"NSEQ_MEDIAN_MS={median(nseq_times)}") -print(f"SEQ_MEAN_MS={mean(seq_times)}") -print(f"NSEQ_MEAN_MS={mean(nseq_times)}") -print(f"DISAGREEMENTS={len(disagreements)}") -print(f"SEQ_FAST_NSEQ_SLOW={len(seq_fast_nseq_slow)}") -print(f"NSEQ_FAST_SEQ_SLOW={len(nseq_fast_seq_slow)}") - -# Print top-10 slowest for nseq that seq handles fast -print("\nTOP_SEQ_FAST_NSEQ_SLOW:") -for r in sorted(seq_fast_nseq_slow, key=lambda x: -int(x['nseq_time_ms']))[:10]: - print(f" {r['file']} seq={r['seq_time_ms']}ms nseq={r['nseq_time_ms']}ms seq_result={r['seq_result']} nseq_result={r['nseq_result']}") - -print("\nTOP_NSEQ_FAST_SEQ_SLOW:") -for r in sorted(nseq_fast_seq_slow, key=lambda x: -int(x['seq_time_ms']))[:10]: - print(f" {r['file']} seq={r['seq_time_ms']}ms nseq={r['nseq_time_ms']}ms seq_result={r['seq_result']} nseq_result={r['nseq_result']}") - -if disagreements: - print(f"\nDISAGREEMENTS ({len(disagreements)}):") - for r in disagreements[:10]: - print(f" {r['file']} seq={r['seq_result']} nseq={r['nseq_result']}") -PYEOF - -python3 /tmp/analyze_benchmark.py -``` - -## Phase 7: Create GitHub Discussion - -Use the `create_discussion` safe-output tool to post a structured benchmark report. - -The discussion body should be formatted as follows (fill in real numbers from Phase 6): - -```markdown -# QF_S Benchmark: seq vs nseq - -**Date**: YYYY-MM-DD -**Branch**: c3 -**Commit**: `` -**Workflow Run**: [#](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) -**Files benchmarked**: N (capped at 500, timeout 10 s per file) - ---- - -## Summary - -| Metric | seq | nseq | -|--------|-----|------| -| Files solved (sat/unsat) | SEQ_SOLVED | NSEQ_SOLVED | -| Timeouts | SEQ_TO | NSEQ_TO | -| Median solve time (solved files) | X ms | Y ms | -| Mean solve time (solved files) | X ms | Y ms | -| **Disagreements (sat≠unsat)** | — | N | - ---- - -## Performance Comparison - -### seq-fast / nseq-slow (seq < 2 s, nseq timed out) - -These are benchmarks where the classical `seq` solver is significantly faster. These represent regression risk for `nseq`. - -| File | seq (ms) | nseq (ms) | seq result | nseq result | -|------|----------|-----------|------------|-------------| -[TOP 10 ENTRIES] - -### nseq-fast / seq-slow (nseq < 2 s, seq timed out) - -These are benchmarks where `nseq` shows a performance advantage. - -| File | seq (ms) | nseq (ms) | seq result | nseq result | -|------|----------|-----------|------------|-------------| -[TOP 10 ENTRIES] - ---- - -## Correctness - -**Disagreements** (files where seq says `sat` but nseq says `unsat` or vice versa): N - -[If disagreements exist, list all of them here with file paths and both results] - ---- - -## seq Trace Analysis (seq-fast / nseq-slow cases) - -
-Click to expand trace snippets for top seq-fast/nseq-slow cases - -[Insert trace snippet for each traced file, or "No traces collected" if section was skipped] - -
- ---- - -## Raw Data - -
-Full results CSV (click to expand) - -```csv -[PASTE FIRST 200 LINES OF /tmp/benchmark-results.csv] -``` - -
- ---- - -*Generated by the QF_S Benchmark workflow. To reproduce: build Z3 from the `c3` branch and run `z3 smt.string_solver=seq|nseq -T:10 `.* -``` - -## Edge Cases - -- If the build fails, call `missing_data` explaining the build error and stop. -- If no benchmark files are found at all, call `missing_data` explaining that no QF_S `.smt2` files were found in the `c3` branch. -- If Z3 crashes (segfault) on a file with either solver, record the result as `crash` and continue. -- If the total benchmark set is very small (< 5 files), note this prominently in the discussion and suggest adding more QF_S benchmarks to the `c3` branch. -- If zero disagreements and both solvers time out on the same files, note that the solvers are in agreement. - -## Important Notes - -- **DO NOT** modify any source files or create pull requests. -- **DO NOT** run benchmarks for longer than 80 minutes total (leave buffer for posting). -- **DO** always report the commit SHA so results can be correlated with specific code versions. -- **DO** close older ZIPT Benchmark discussions automatically (configured via `close-older-discussions: true`). -- **DO** highlight disagreements prominently — these are potential correctness bugs. diff --git a/cmake/compiler_warnings.cmake b/cmake/compiler_warnings.cmake index 9e11d9082b..b9424e1b25 100644 --- a/cmake/compiler_warnings.cmake +++ b/cmake/compiler_warnings.cmake @@ -25,6 +25,7 @@ set(CLANG_ONLY_WARNINGS "-Winconsistent-missing-override" "-Wno-missing-field-initializers" "-Wcast-qual" + "-Wimplicit-fallthrough" ) set(MSVC_WARNINGS "/W3") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 07a53f8f04..7fb78babd1 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -81,24 +81,6 @@ ExternalProject_Add(cpp_example ) set_target_properties(cpp_example PROPERTIES EXCLUDE_FROM_ALL TRUE) -################################################################################ -# Build example tptp5 project using libz3's C++ API as an external project -################################################################################ -ExternalProject_Add(z3_tptp5 - DEPENDS libz3 - # Configure step - SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tptp" - CMAKE_ARGS - "-DZ3_DIR=${PROJECT_BINARY_DIR}" - "${EXTERNAL_PROJECT_CMAKE_BUILD_TYPE_ARG}" - # Build step - BUILD_ALWAYS ON - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/tptp_build_dir" - # Install Step - INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "" # Dummy command -) -set_target_properties(z3_tptp5 PROPERTIES EXCLUDE_FROM_ALL TRUE) - ################################################################################ # Build example user-propagator project using libz3's C++ API as an external project ################################################################################ diff --git a/examples/tptp/CMakeLists.txt b/examples/tptp/CMakeLists.txt deleted file mode 100644 index 9d4caa1904..0000000000 --- a/examples/tptp/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -################################################################################ -# TPTP example -################################################################################ -project(Z3_TPTP5 CXX) -cmake_minimum_required(VERSION 3.4) -find_package(Z3 - REQUIRED - CONFIG - # `NO_DEFAULT_PATH` is set so that -DZ3_DIR has to be passed to find Z3. - # This should prevent us from accidentally picking up an installed - # copy of Z3. This is here to benefit Z3's build system when building - # this project. When making your own project you probably shouldn't - # use this option. - NO_DEFAULT_PATH -) - -################################################################################ -# Z3 C++ API bindings require C++11 -################################################################################ -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -message(STATUS "Z3_FOUND: ${Z3_FOUND}") -message(STATUS "Found Z3 ${Z3_VERSION_STRING}") -message(STATUS "Z3_DIR: ${Z3_DIR}") - -add_executable(z3_tptp5 tptp5.cpp tptp5.lex.cpp) -target_include_directories(z3_tptp5 PRIVATE ${Z3_CXX_INCLUDE_DIRS}) -target_link_libraries(z3_tptp5 PRIVATE ${Z3_LIBRARIES}) - -if (CMAKE_SYSTEM_NAME MATCHES "[Ww]indows") - # On Windows we need to copy the Z3 libraries - # into the same directory as the executable - # so that they can be found. - foreach (z3_lib ${Z3_LIBRARIES}) - message(STATUS "Adding copy rule for ${z3_lib}") - add_custom_command(TARGET z3_tptp5 - POST_BUILD - COMMAND - ${CMAKE_COMMAND} -E copy_if_different - $ - $ - ) - endforeach() -endif() - diff --git a/examples/tptp/README b/examples/tptp/README deleted file mode 100644 index a6f3636a10..0000000000 --- a/examples/tptp/README +++ /dev/null @@ -1,20 +0,0 @@ -TPTP front-end and utilities as a sample using the C++ bindings. -To build the example execute - make examples -in the build directory. - -This command will create the executable tptp. -On Windows, you can just execute it. -On macOS and Linux, you must install z3 first using - sudo make install -OR update LD_LIBRARY_PATH (Linux) or DYLD_LIBRARY_PATH (macOS) - with the build directory. You need that to be able to - find the Z3 shared library. - -The sample illustrates using Z3 from the TPTP language. -The TPTP language is documented on http://tptp.org -It also exposes utilities for converting between SMT-LIB -and TPTP format. - - - diff --git a/examples/tptp/tptp5.cpp b/examples/tptp/tptp5.cpp deleted file mode 100644 index 5041d0da3a..0000000000 --- a/examples/tptp/tptp5.cpp +++ /dev/null @@ -1,2492 +0,0 @@ - -/*++ -Copyright (c) 2015 Microsoft Corporation - ---*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "z3++.h" - -struct alloc_region { - std::list m_alloc; - - void * allocate(size_t s) { - char * res = new char[s]; - m_alloc.push_back(res); - return res; - } - - ~alloc_region() { - std::list::iterator it = m_alloc.begin(), end = m_alloc.end(); - for (; it != end; ++it) { - delete *it; - } - } -}; - -template -class flet { - T & m_ref; - T m_old; -public: - flet(T& x, T const& y): m_ref(x), m_old(x) { x = y; } - ~flet() { m_ref = m_old; } -}; - -struct symbol_compare { - bool operator()(z3::symbol const& s1, z3::symbol const& s2) const { - return s1 < s2; - }; -}; - - -template -struct symbol_table { - typedef std::map map; - map m_map; - - void insert(z3::symbol s, T val) { - m_map.insert(std::pair(s, val)); - } - - bool find(z3::symbol const& s, T& val) { - typename map::iterator it = m_map.find(s); - if (it == m_map.end()) { - return false; - } - else { - val = it->second; - return true; - } - } -}; - - -typedef std::set symbol_set; - - -struct named_formulas { - std::vector m_formulas; - std::vector m_names; - std::vector m_files; - bool m_has_conjecture; - - named_formulas(): m_has_conjecture(false) {} - - void push_back(z3::expr fml, char const * name, char const* file) { - m_formulas.push_back(fml); - m_names.push_back(name); - m_files.push_back(file); - } - - void set_has_conjecture() { - m_has_conjecture = true; - } - - bool has_conjecture() const { - return m_has_conjecture; - } -}; - -inline void * operator new(size_t s, alloc_region & r) { return r.allocate(s); } - -inline void * operator new[](size_t s, alloc_region & r) { return r.allocate(s); } - -inline void operator delete(void *, alloc_region & ) { /* do nothing */ } - -inline void operator delete[](void *, alloc_region & ) { /* do nothing */ } - -struct failure_ex { - std::string msg; - failure_ex(char const* m):msg(m) {} -}; - - -extern char* tptp_lval[]; -extern int yylex(); - -static char* strdup(alloc_region& r, char const* s) { - size_t l = strlen(s) + 1; - char* result = new (r) char[l]; - memcpy(result, s, l); - return result; -} - -class TreeNode { - char const* m_symbol; - int m_symbol_index; - TreeNode** m_children; - -public: - TreeNode(alloc_region& r, char const* sym, - TreeNode* A, TreeNode* B, TreeNode* C, TreeNode* D, TreeNode* E, - TreeNode* F, TreeNode* G, TreeNode* H, TreeNode* I, TreeNode* J): - m_symbol(strdup(r, sym)), - m_symbol_index(-1) { - m_children = new (r) TreeNode*[10]; - m_children[0] = A; - m_children[1] = B; - m_children[2] = C; - m_children[3] = D; - m_children[4] = E; - m_children[5] = F; - m_children[6] = G; - m_children[7] = H; - m_children[8] = I; - m_children[9] = J; - - } - - char const* symbol() const { return m_symbol; } - TreeNode *const* children() const { return m_children; } - TreeNode* child(unsigned i) const { return m_children[i]; } - int index() const { return m_symbol_index; } - - void set_index(int idx) { m_symbol_index = idx; } -}; - -TreeNode* MkToken(alloc_region& r, char const* token, int symbolIndex) { - TreeNode* ss; - char* symbol = tptp_lval[symbolIndex]; - ss = new (r) TreeNode(r, symbol, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); - ss->set_index(symbolIndex); - return ss; -} - - -// ------------------------------------------------------ -// Build Z3 formulas. - -class env { - z3::context& m_context; - z3::expr_vector m_bound; // vector of bound constants. - z3::sort m_univ; - symbol_table m_decls; - symbol_table m_defined_sorts; - static std::vector* m_nodes; - static alloc_region* m_region; - char const* m_filename; - - - enum binary_connective { - IFF, - IMPLIES, - IMPLIED, - LESS_TILDE_GREATER, - TILDE_VLINE - }; - - void mk_error(TreeNode* f, char const* msg) { - std::ostringstream strm; - strm << "expected: " << msg << "\n"; - strm << "got: " << f->symbol(); - throw failure_ex(strm.str().c_str()); - } - - void mk_not_handled(TreeNode* f, char const* msg) { - std::ostringstream strm; - strm << "Construct " << f->symbol() << " not handled: " << msg; - throw failure_ex(strm.str().c_str()); - } - - void mk_input(TreeNode* f, named_formulas& fmls) { - if (!strcmp(f->symbol(),"annotated_formula")) { - mk_annotated_formula(f->child(0), fmls); - } - else if (!strcmp(f->symbol(),"include")) { - mk_include(f->child(2), f->child(3), fmls); - } - else { - mk_error(f, "annotated formula or include"); - } - } - - void mk_annotated_formula(TreeNode* f, named_formulas& fmls) { - if (!strcmp(f->symbol(),"fof_annotated")) { - fof_annotated(f->child(2), f->child(4), f->child(6), f->child(7), fmls); - } - else if (!strcmp(f->symbol(),"tff_annotated")) { - fof_annotated(f->child(2), f->child(4), f->child(6), f->child(7), fmls); - } - else if (!strcmp(f->symbol(),"cnf_annotated")) { - cnf_annotated(f->child(2), f->child(4), f->child(6), f->child(7), fmls); - } - else if (!strcmp(f->symbol(),"thf_annotated")) { - mk_error(f, "annotated formula (not thf)"); - } - else { - mk_error(f, "annotated formula"); - } - } - - void check_arity(unsigned num_args, unsigned arity) { - if (num_args != arity) { - throw failure_ex("arity mismatch"); - } - } - - void mk_include(TreeNode* file_name, TreeNode* formula_selection, named_formulas& fmls) { - char const* fn = file_name->child(0)->symbol(); - TreeNode* name_list = formula_selection->child(2); - if (name_list && !strcmp("null",name_list->symbol())) { - name_list = 0; - } - std::string inc_name; - bool f_exists = false; - for (unsigned i = 1; !f_exists && i <= 3; ++i) { - inc_name.clear(); - f_exists = mk_filename(fn, i, inc_name); - - } - if (!f_exists) { - inc_name.clear(); - f_exists = mk_env_filename(fn, inc_name); - } - if (!f_exists) { - inc_name = fn; - } - - parse(inc_name.c_str(), fmls); - while (name_list) { - return mk_error(name_list, "name list (not handled)"); - //char const* name = name_list->child(0)->symbol(); - name_list = name_list->child(2); - } - } - -#define CHECK(_node_) if (0 != strcmp(_node_->symbol(),#_node_)) return mk_error(_node_,#_node_); - - const char* get_name(TreeNode* name) { - if (!name->child(0)) { - mk_error(name, "node with a child"); - } - if (!name->child(0)->child(0)) { - return name->child(0)->symbol(); - } - return name->child(0)->child(0)->symbol(); - } - - z3::expr mk_forall(z3::expr_vector& bound, z3::expr body) { - return mk_quantifier(true, bound, body); - } - - z3::expr mk_quantifier(bool is_forall, z3::expr_vector& bound, z3::expr body) { - Z3_app* vars = new Z3_app[bound.size()]; - for (unsigned i = 0; i < bound.size(); ++i) { - vars[i] = (Z3_app) bound[i]; - } - Z3_ast r = Z3_mk_quantifier_const(m_context, is_forall, 1, bound.size(), vars, 0, 0, body); - delete[] vars; - return z3::expr(m_context, r); - } - - void cnf_annotated(TreeNode* name, TreeNode* formula_role, TreeNode* formula, TreeNode* annotations, named_formulas& fmls) { - symbol_set st; - get_cnf_variables(formula, st); - symbol_set::iterator it = st.begin(), end = st.end(); - std::vector names; - m_bound.resize(0); - for(; it != end; ++it) { - names.push_back(*it); - m_bound.push_back(m_context.constant(names.back(), m_univ)); - } - z3::expr r(m_context); - cnf_formula(formula, r); - if (!m_bound.empty()) { - r = mk_forall(m_bound, r); - } - char const* role = formula_role->child(0)->symbol(); - if (!strcmp(role,"conjecture")) { - fmls.set_has_conjecture(); - r = !r; - } - fmls.push_back(r, get_name(name), m_filename); - m_bound.resize(0); - } - - void cnf_formula(TreeNode* formula, z3::expr& r) { - std::vector disj; - if (formula->child(1)) { - disjunction(formula->child(1), disj); - } - else { - disjunction(formula->child(0), disj); - } - if (disj.size() > 0) { - r = disj[0]; - } - else { - r = m_context.bool_val(false); - } - for (unsigned i = 1; i < disj.size(); ++i) { - r = r || disj[i]; - } - } - - void disjunction(TreeNode* d, std::vector& r) { - z3::expr lit(m_context); - if (d->child(2)) { - disjunction(d->child(0), r); - literal(d->child(2), lit); - r.push_back(lit); - } - else { - literal(d->child(0), lit); - r.push_back(lit); - } - } - - void literal(TreeNode* l, z3::expr& lit) { - if (!strcmp(l->child(0)->symbol(),"~")) { - fof_formula(l->child(1), lit); - lit = !lit; - } - else { - fof_formula(l->child(0), lit); - } - } - - void fof_annotated(TreeNode* name, TreeNode* formula_role, TreeNode* formula, TreeNode* annotations, named_formulas& fmls) { - z3::expr fml(m_context); - //CHECK(fof_formula); - CHECK(formula_role); - fof_formula(formula->child(0), fml); - char const* role = formula_role->child(0)->symbol(); - if (!strcmp(role,"conjecture")) { - fmls.set_has_conjecture(); - fmls.push_back(!fml, get_name(name), m_filename); - } - else if (!strcmp(role,"type")) { - } - else { - fmls.push_back(fml, get_name(name), m_filename); - } - } - - void fof_formula(TreeNode* f, z3::expr& fml) { - z3::expr f1(m_context); - char const* name = f->symbol(); - if (!strcmp(name,"fof_logic_formula") || - !strcmp(name,"fof_binary_assoc") || - !strcmp(name,"fof_binary_formula") || - !strcmp(name,"tff_logic_formula") || - !strcmp(name,"tff_binary_assoc") || - !strcmp(name,"tff_binary_formula") || - !strcmp(name,"atomic_formula") || - !strcmp(name,"defined_atomic_formula")) { - fof_formula(f->child(0), fml); - } - else if (!strcmp(name, "fof_sequent") || - !strcmp(name, "tff_sequent")) { - fof_formula(f->child(0), f1); - fof_formula(f->child(2), fml); - fml = implies(f1, fml); - } - else if (!strcmp(name, "fof_binary_nonassoc") || - !strcmp(name, "tff_binary_nonassoc")) { - fof_formula(f->child(0), f1); - fof_formula(f->child(2), fml); - //SASSERT(!strcmp("binary_connective",f->child(1)->symbol())); - char const* conn = f->child(1)->child(0)->symbol(); - if (!strcmp(conn, "<=>")) { - fml = (f1 == fml); - } - else if (!strcmp(conn, "=>")) { - fml = implies(f1, fml); - } - else if (!strcmp(conn, "<=")) { - fml = implies(fml, f1); - } - else if (!strcmp(conn, "<~>")) { - fml = ! (f1 == fml); - } - else if (!strcmp(conn, "~|")) { - fml = !(f1 || fml); - } - else if (!strcmp(conn, "~&")) { - fml = ! (f1 && fml); - } - else { - mk_error(f->child(1)->child(0), "connective"); - } - } - else if (!strcmp(name,"fof_or_formula") || - !strcmp(name,"tff_or_formula")) { - fof_formula(f->child(0), f1); - fof_formula(f->child(2), fml); - fml = f1 || fml; - } - else if (!strcmp(name,"fof_and_formula") || - !strcmp(name,"tff_and_formula")) { - fof_formula(f->child(0), f1); - fof_formula(f->child(2), fml); - fml = f1 && fml; - } - else if (!strcmp(name,"fof_unitary_formula") || - !strcmp(name,"tff_unitary_formula")) { - if (f->child(1)) { - // parenthesis - fof_formula(f->child(1), fml); - } - else { - fof_formula(f->child(0), fml); - } - } - else if (!strcmp(name,"fof_quantified_formula") || - !strcmp(name,"tff_quantified_formula")) { - fof_quantified_formula(f->child(0), f->child(2), f->child(5), fml); - } - else if (!strcmp(name,"fof_unary_formula") || - !strcmp(name,"tff_unary_formula")) { - if (!f->child(1)) { - fof_formula(f->child(0), fml); - } - else { - fof_formula(f->child(1), fml); - char const* conn = f->child(0)->child(0)->symbol(); - if (!strcmp(conn,"~")) { - fml = !fml; - } - else { - mk_error(f->child(0)->child(0), "fof_unary_formula"); - } - } - } - else if (!strcmp(name,"fof_let")) { - mk_let(f->child(2), f->child(5), fml); - } - else if (!strcmp(name,"variable")) { - char const* v = f->child(0)->symbol(); - if (!find_bound(v, fml)) { - mk_error(f->child(0), "variable"); - } - } - else if (!strcmp(name,"fof_conditional")) { - z3::expr f2(m_context); - fof_formula(f->child(2), f1); - fof_formula(f->child(4), f2); - fof_formula(f->child(6), fml); - fml = ite(f1, f2, fml); - } - else if (!strcmp(name,"plain_atomic_formula") || - !strcmp(name,"defined_plain_formula") || - !strcmp(name,"system_atomic_formula")) { - z3::sort srt(m_context.bool_sort()); - term(f->child(0), srt, fml); - } - else if (!strcmp(name,"defined_infix_formula") || - !strcmp(name,"fol_infix_unary")) { - z3::expr t1(m_context), t2(m_context); - term(f->child(0), m_univ, t1); - term(f->child(2), m_univ, t2); - TreeNode* inf = f->child(1); - while (inf && strcmp(inf->symbol(),"=") && strcmp(inf->symbol(),"!=")) { - inf = inf->child(0); - } - if (!inf) { - mk_error(f->child(1), "defined_infix_formula"); - } - char const* conn = inf->symbol(); - if (!strcmp(conn,"=")) { - fml = t1 == t2; - } - else if (!strcmp(conn,"!=")) { - fml = ! (t1 == t2); - } - else { - mk_error(inf, "defined_infix_formula"); - } - } - else if (!strcmp(name, "tff_typed_atom")) { - while (!strcmp(f->child(0)->symbol(),"(")) { - f = f->child(1); - } - char const* id = 0; - z3::sort s(m_context); - z3::sort_vector sorts(m_context); - - mk_id(f->child(0), id); - if (is_ttype(f->child(2))) { - s = mk_sort(id); - m_defined_sorts.insert(symbol(id), s); - } - else { - mk_mapping_sort(f->child(2), sorts, s); - z3::func_decl fd(m_context.function(id, sorts, s)); - m_decls.insert(symbol(id), fd); - } - } - else { - mk_error(f, "fof_formula"); - } - } - - bool is_ttype(TreeNode* t) { - char const* name = t->symbol(); - if (!strcmp(name,"atomic_defined_word")) { - return !strcmp("$tType", t->child(0)->symbol()); - } - return false; - } - - void fof_quantified_formula(TreeNode* fol_quantifier, TreeNode* vl, TreeNode* formula, z3::expr& fml) { - unsigned l = m_bound.size(); - mk_variable_list(vl); - fof_formula(formula, fml); - bool is_forall = !strcmp(fol_quantifier->child(0)->symbol(),"!"); - z3::expr_vector bound(m_context); - for (unsigned i = l; i < m_bound.size(); ++i) { - bound.push_back(m_bound[i]); - } - fml = mk_quantifier(is_forall, bound, fml); - m_bound.resize(l); - } - - void mk_variable_list(TreeNode* variable_list) { - while (variable_list) { - TreeNode* var = variable_list->child(0); - if (!strcmp(var->symbol(),"tff_variable")) { - var = var->child(0); - } - if (!strcmp(var->symbol(),"variable")) { - char const* name = var->child(0)->symbol(); - m_bound.push_back(m_context.constant(name, m_univ)); - } - else if (!strcmp(var->symbol(),"tff_typed_variable")) { - z3::sort s(m_context); - char const* name = var->child(0)->child(0)->symbol(); - mk_sort(var->child(2), s); - m_bound.push_back(m_context.constant(name, s)); - } - else { - mk_error(var, "variable_list"); - } - variable_list = variable_list->child(2); - } - } - - void mk_sort(TreeNode* t, z3::sort& s) { - char const* name = t->symbol(); - if (!strcmp(name, "tff_atomic_type") || - !strcmp(name, "defined_type")) { - mk_sort(t->child(0), s); - } - else if (!strcmp(name, "atomic_defined_word")) { - z3::symbol sname = symbol(t->child(0)->symbol()); - z3::sort srt(m_context); - if (!strcmp("$tType", t->child(0)->symbol())) { - char const* id = 0; - s = mk_sort(id); - m_defined_sorts.insert(symbol(id), s); - } - else if (m_defined_sorts.find(sname, srt)) { - s = srt; - } - else { - s = mk_sort(sname); - if (sname == symbol("$rat")) { - throw failure_ex("rational sorts are not handled\n"); - } - mk_error(t, sname.str().c_str()); - } - } - else if (!strcmp(name,"atomic_word")) { - name = t->child(0)->symbol(); - z3::symbol symname = symbol(name); - s = mk_sort(symname); - } - else { - mk_error(t, "sort"); - } - } - - void mk_mapping_sort(TreeNode* t, z3::sort_vector& domain, z3::sort& s) { - char const* name = t->symbol(); - //char const* id = 0; - if (!strcmp(name,"tff_top_level_type")) { - mk_mapping_sort(t->child(0), domain, s); - } - else if (!strcmp(name,"tff_atomic_type")) { - mk_sort(t->child(0), s); - } - else if (!strcmp(name,"tff_mapping_type")) { - TreeNode* t1 = t->child(0); - if (t1->child(1)) { - mk_xprod_sort(t1->child(1), domain); - } - else { - mk_sort(t1->child(0), s); - domain.push_back(s); - } - mk_sort(t->child(2), s); - } - else { - mk_error(t, "mapping sort"); - } - } - - void mk_xprod_sort(TreeNode* t, z3::sort_vector& sorts) { - char const* name = t->symbol(); - z3::sort s1(m_context), s2(m_context); - if (!strcmp(name, "tff_atomic_type")) { - mk_sort(t->child(0), s1); - sorts.push_back(s1); - } - else if (!strcmp(name, "tff_xprod_type")) { - name = t->child(0)->symbol(); - if (!strcmp(name, "tff_atomic_type") || - !strcmp(name, "tff_xprod_type")) { - mk_xprod_sort(t->child(0), sorts); - mk_xprod_sort(t->child(2), sorts); - } - else if (t->child(1)) { - mk_xprod_sort(t->child(1), sorts); - } - else { - mk_error(t, "xprod sort"); - } - } - else { - mk_error(t, "xprod sort"); - } - } - - void term(TreeNode* t, z3::sort const& s, z3::expr& r) { - char const* name = t->symbol(); - if (!strcmp(name, "defined_plain_term") || - !strcmp(name, "system_term") || - !strcmp(name, "plain_term")) { - if (!t->child(1)) { - term(t->child(0), s, r); - } - else { - apply_term(t->child(0), t->child(2), s, r); - } - } - else if (!strcmp(name, "constant") || - !strcmp(name, "functor") || - !strcmp(name, "defined_plain_formula") || - !strcmp(name, "defined_functor") || - !strcmp(name, "defined_constant") || - !strcmp(name, "system_constant") || - !strcmp(name, "defined_atomic_term") || - !strcmp(name, "system_functor") || - !strcmp(name, "function_term") || - !strcmp(name, "term") || - !strcmp(name, "defined_term")) { - term(t->child(0), s, r); - } - - - else if (!strcmp(name, "defined_atom")) { - char const* name0 = t->child(0)->symbol(); - if (!strcmp(name0,"number")) { - name0 = t->child(0)->child(0)->symbol(); - char const* per = strchr(name0, '.'); - bool is_real = 0 != per; - bool is_rat = 0 != strchr(name0, '/'); - bool is_int = !is_real && !is_rat; - if (is_int) { - r = m_context.int_val(name0); - } - else { - r = m_context.real_val(name0); - } - } - else if (!strcmp(name0, "distinct_object")) { - throw failure_ex("distinct object not handled"); - } - else { - mk_error(t->child(0), "number or distinct object"); - } - } - else if (!strcmp(name, "atomic_defined_word")) { - char const* ch = t->child(0)->symbol(); - z3::symbol s = symbol(ch); - z3::func_decl fd(m_context); - if (!strcmp(ch, "$true")) { - r = m_context.bool_val(true); - } - else if (!strcmp(ch, "$false")) { - r = m_context.bool_val(false); - } - else if (m_decls.find(s, fd)) { - r = fd(0,0); - } - else { - mk_error(t->child(0), "atomic_defined_word"); - } - } - else if (!strcmp(name, "atomic_word")) { - z3::func_decl f(m_context); - z3::symbol sym = symbol(t->child(0)->symbol()); - if (m_decls.find(sym, f)) { - r = f(0,0); - } - else { - r = m_context.constant(sym, s); - } - } - else if (!strcmp(name, "variable")) { - char const* v = t->child(0)->symbol(); - if (!find_bound(v, r)) { - mk_error(t->child(0), "variable not bound"); - } - } - else { - mk_error(t, "term not recognized"); - } - } - - void apply_term(TreeNode* f, TreeNode* args, z3::sort const& s, z3::expr& r) { - z3::expr_vector terms(m_context); - z3::sort_vector sorts(m_context); - mk_args(args, terms); - for (unsigned i = 0; i < terms.size(); ++i) { - sorts.push_back(terms[i].get_sort()); - } - if (!strcmp(f->symbol(),"functor") || - !strcmp(f->symbol(),"system_functor") || - !strcmp(f->symbol(),"defined_functor")) { - f = f->child(0); - } - bool atomic_word = !strcmp(f->symbol(),"atomic_word"); - if (atomic_word || - !strcmp(f->symbol(),"atomic_defined_word") || - !strcmp(f->symbol(),"atomic_system_word")) { - char const* ch = f->child(0)->symbol(); - z3::symbol fn = symbol(ch); - z3::func_decl fun(m_context); - z3::context& ctx = r.ctx(); - if (!strcmp(ch,"$less")) { - check_arity(terms.size(), 2); - r = terms[0] < terms[1]; - } - else if (!strcmp(ch,"$lesseq")) { - check_arity(terms.size(), 2); - r = terms[0] <= terms[1]; - } - else if (!strcmp(ch,"$greater")) { - check_arity(terms.size(), 2); - r = terms[0] > terms[1]; - } - else if (!strcmp(ch,"$greatereq")) { - check_arity(terms.size(), 2); - r = terms[0] >= terms[1]; - } - else if (!strcmp(ch,"$uminus")) { - check_arity(terms.size(), 1); - r = -terms[0]; - } - else if (!strcmp(ch,"$sum")) { - check_arity(terms.size(), 2); - r = terms[0] + terms[1]; - } - else if (!strcmp(ch,"$plus")) { - check_arity(terms.size(), 2); - r = terms[0] + terms[1]; - } - else if (!strcmp(ch,"$difference")) { - check_arity(terms.size(), 2); - r = terms[0] - terms[1]; - } - else if (!strcmp(ch,"$product")) { - check_arity(terms.size(), 2); - r = terms[0] * terms[1]; - } - else if (!strcmp(ch,"$quotient")) { - check_arity(terms.size(), 2); - r = terms[0] / terms[1]; - } - else if (!strcmp(ch,"$quotient_e")) { - check_arity(terms.size(), 2); - r = terms[0] / terms[1]; - } - else if (!strcmp(ch,"$distinct")) { - if (terms.size() == 2) { - r = terms[0] != terms[1]; - } - else { - r = distinct(terms); - } - } - else if (!strcmp(ch,"$floor") || !strcmp(ch,"$to_int")) { - check_arity(terms.size(), 1); - r = to_real(to_int(terms[0])); - } - else if (!strcmp(ch,"$to_real")) { - check_arity(terms.size(), 1); - r = terms[0]; - if (r.get_sort().is_int()) { - r = to_real(terms[0]); - } - } - else if (!strcmp(ch,"$is_int")) { - check_arity(terms.size(), 1); - r = z3::expr(ctx, Z3_mk_is_int(ctx, terms[0])); - } - else if (!strcmp(ch,"$true")) { - r = ctx.bool_val(true); - } - else if (!strcmp(ch,"$false")) { - r = ctx.bool_val(false); - } - // ceiling(x) = -floor(-x) - else if (!strcmp(ch,"$ceiling")) { - check_arity(terms.size(), 1); - r = ceiling(terms[0]); - } - // truncate - The nearest integral value with magnitude not greater than the absolute value of the argument. - // if x >= 0 floor(x) else ceiling(x) - else if (!strcmp(ch,"$truncate")) { - check_arity(terms.size(), 1); - r = truncate(terms[0]); - } - // The nearest integral number to the argument. When the argument - // is halfway between two integral numbers, the nearest even integral number to the argument. - else if (!strcmp(ch,"$round")) { - check_arity(terms.size(), 1); - z3::expr t = terms[0]; - z3::expr i = to_int(t); - z3::expr i2 = i + ctx.real_val(1,2); - r = ite(t > i2, i + 1, ite(t == i2, ite(is_even(i), i, i+1), i)); - } - // $quotient_e(N,D) - the Euclidean quotient, which has a non-negative remainder. - // If D is positive then $quotient_e(N,D) is the floor (in the type of N and D) of - // the real division N/D, and if D is negative then $quotient_e(N,D) is the ceiling of N/D. - - // $quotient_t(N,D) - the truncation of the real division N/D. - else if (!strcmp(ch,"$quotient_t")) { - check_arity(terms.size(), 2); - r = truncate(terms[0] / terms[1]); - } - // $quotient_f(N,D) - the floor of the real division N/D. - else if (!strcmp(ch,"$quotient_f")) { - check_arity(terms.size(), 2); - r = to_real(to_int(terms[0] / terms[1])); - } - // For t in {$int,$rat, $real}, x in {e, t,f}, $quotient_x and $remainder_x are related by - // ! [N:t,D:t] : $sum($product($quotient_x(N,D),D),$remainder_x(N,D)) = N - // For zero divisors the result is not specified. - else if (!strcmp(ch,"$remainder_t")) { - mk_not_handled(f, ch); - } - else if (!strcmp(ch,"$remainder_e")) { - check_arity(terms.size(), 2); - r = z3::expr(ctx, Z3_mk_mod(ctx, terms[0], terms[1])); - } - else if (!strcmp(ch,"$remainder_r")) { - mk_not_handled(f, ch); - } - else if (!strcmp(ch,"$to_rat") || - !strcmp(ch,"$is_rat")) { - mk_not_handled(f, ch); - } - else if (m_decls.find(fn, fun)) { - r = fun(terms); - } - else if (true) { - z3::func_decl func(m_context); - func = m_context.function(fn, sorts, s); - r = func(terms); - } - else { - mk_error(f->child(0), "atomic, defined or system word"); - } - return; - } - mk_error(f, "function"); - } - - z3::expr to_int(z3::expr e) { - return z3::expr(e.ctx(), Z3_mk_real2int(e.ctx(), e)); - } - - z3::expr to_real(z3::expr e) { - return z3::expr(e.ctx(), Z3_mk_int2real(e.ctx(), e)); - } - - z3::expr ceiling(z3::expr e) { - return -to_real(to_int(-e)); - } - - z3::expr is_even(z3::expr e) { - z3::context& ctx = e.ctx(); - z3::expr two = ctx.int_val(2); - z3::expr m = z3::expr(ctx, Z3_mk_mod(ctx, e, two)); - return m == 0; - } - - z3::expr truncate(z3::expr e) { - return ite(e >= 0, to_int(e), ceiling(e)); - } - - bool check_app(z3::func_decl& f, unsigned num, z3::expr const* args) { - if (f.arity() == num) { - for (unsigned i = 0; i < num; ++i) { - if (!eq(args[i].get_sort(), f.domain(i))) { - return false; - } - } - return true; - } - else { - return true; - } - } - - void mk_args(TreeNode* args, z3::expr_vector& result) { - z3::expr t(m_context); - while (args) { - term(args->child(0), m_univ, t); - result.push_back(t); - args = args->child(2); - } - } - - - bool find_bound(char const* v, z3::expr& b) { - for (unsigned l = m_bound.size(); l > 0; ) { - --l; - if (v == m_bound[l].decl().name().str()) { - b = m_bound[l]; - return true; - } - } - return false; - } - - void mk_id(TreeNode* f, char const*& sym) { - char const* name = f->symbol(); - if (!strcmp(name, "tff_untyped_atom") || - !strcmp(name, "functor") || - !strcmp(name, "system_functor")) { - mk_id(f->child(0), sym); - } - else if (!strcmp(name, "atomic_word") || - !strcmp(name, "atomic_system_word")) { - sym = f->child(0)->symbol(); - } - else { - mk_error(f, "atom"); - } - } - - void mk_let(TreeNode* let_vars, TreeNode* f, z3::expr& fml) { - mk_error(f, "let construct is not handled"); - } - - FILE* open_file(char const* filename) { - FILE* fp = 0; -#ifdef _WINDOWS - if (0 > fopen_s(&fp, filename, "r") || fp == 0) { - fp = 0; - } -#else - fp = fopen(filename, "r"); -#endif - return fp; - } - - bool is_sep(char s) { - return s == '/' || s == '\\'; - } - - void add_separator(const char* rel_name, std::string& inc_name) { - size_t sz = inc_name.size(); - if (sz == 0) return; - if (sz > 0 && is_sep(inc_name[sz-1])) return; - if (is_sep(rel_name[0])) return; - inc_name += "/"; - } - - void append_rel_name(const char * rel_name, std::string& inc_name) { - if (rel_name[0] == '\'') { - add_separator(rel_name+1, inc_name); - inc_name.append(rel_name+1); - inc_name.resize(inc_name.size()-1); - } - else { - add_separator(rel_name, inc_name); - inc_name.append(rel_name); - } - } - - bool mk_filename(const char *rel_name, unsigned num_sep, std::string& inc_name) { - unsigned sep1 = 0, sep2 = 0, sep3 = 0; - size_t len = strlen(m_filename); - for (unsigned i = 0; i < len; ++i) { - if (is_sep(m_filename[i])) { - sep3 = sep2; - sep2 = sep1; - sep1 = i; - } - } - if ((num_sep == 3) && sep3 > 0) { - inc_name.append(m_filename,sep3+1); - } - if ((num_sep == 2) && sep2 > 0) { - inc_name.append(m_filename,sep2+1); - } - if ((num_sep == 1) && sep1 > 0) { - inc_name.append(m_filename,sep1+1); - } - append_rel_name(rel_name, inc_name); - return file_exists(inc_name.c_str()); - } - - bool file_exists(char const* filename) { - FILE* fp = open_file(filename); - if (!fp) { - return false; - } - fclose(fp); - return true; - } - - bool mk_env_filename(const char* rel_name, std::string& inc_name) { -#ifdef _WINDOWS - char buffer[1024]; - size_t sz; - errno_t err = getenv_s( - &sz, - buffer, - "$TPTP"); - if (err != 0) { - return false; - } -#else - char const* buffer = getenv("$TPTP"); - if (!buffer) { - return false; - } -#endif - inc_name = buffer; - append_rel_name(rel_name, inc_name); - return file_exists(inc_name.c_str()); - } - - void get_cnf_variables(TreeNode* t, symbol_set& symbols) { - std::vector todo; - todo.push_back(t); - while (!todo.empty()) { - t = todo.back(); - todo.pop_back(); - if (!t) continue; - if (!strcmp(t->symbol(),"variable")) { - z3::symbol sym = symbol(t->child(0)->symbol()); - symbols.insert(sym); - } - else { - for (unsigned i = 0; i < 10; ++i) { - todo.push_back(t->child(i)); - } - } - } - } - - z3::symbol symbol(char const* s) { - return m_context.str_symbol(s); - } - - z3::sort mk_sort(char const* s) { - return m_context.uninterpreted_sort(s); - } - - z3::sort mk_sort(z3::symbol& s) { - return m_context.uninterpreted_sort(s); - } - -public: - env(z3::context& ctx): - m_context(ctx), - m_bound(ctx), - m_univ(mk_sort("$i")), - m_filename(0) { - m_nodes = 0; - m_region = new alloc_region(); - m_defined_sorts.insert(symbol("$i"), m_univ); - m_defined_sorts.insert(symbol("$o"), m_context.bool_sort()); - m_defined_sorts.insert(symbol("$real"), m_context.real_sort()); - m_defined_sorts.insert(symbol("$int"), m_context.int_sort()); - - } - - ~env() { - delete m_region; - m_region = 0; - } - void parse(const char* filename, named_formulas& fmls); - static void register_node(TreeNode* t) { m_nodes->push_back(t); } - static alloc_region& r() { return *m_region; } -}; - -std::vector* env::m_nodes = 0; -alloc_region* env::m_region = 0; - -# define P_USERPROC -# define P_ACT(ss) if(verbose)printf("%7d %s\n",yylineno,ss); -# define P_BUILD(sym,A,B,C,D,E,F,G,H,I,J) new (env::r()) TreeNode(env::r(), sym,A,B,C,D,E,F,G,H,I,J) -# define P_TOKEN(tok,symbolIndex) MkToken(env::r(), tok,symbolIndex) -# define P_PRINT(ss) env::register_node(ss) - - -// ------------------------------------------------------ -// created by YACC. -#include "tptp5.tab.c" - -extern FILE* yyin; - - -void env::parse(const char* filename, named_formulas& fmls) { - std::vector nodes; - flet fn(m_filename, filename); - flet*> fnds(m_nodes, &nodes); - - FILE* fp = open_file(filename); - if (!fp) { - std::stringstream strm; - strm << "Could not open file " << filename << "\n"; - throw failure_ex(strm.str().c_str()); - } - yyin = fp; - int result = yyparse(); - fclose(fp); - - if (result != 0) { - throw failure_ex("could not parse input"); - } - - for (unsigned i = 0; i < nodes.size(); ++i) { - TreeNode* cl = nodes[i]; - if (cl) { - mk_input(cl, fmls); - } - } - -} - -class pp_tptp { - z3::context& ctx; - std::vector names; - std::vector sorts; - std::vector funs; - std::vector todo; - std::set seen_ids; - unsigned m_formula_id; - unsigned m_node_number; - std::map m_proof_ids; - std::map > m_proof_hypotheses; - std::map m_axiom_ids; - named_formulas* m_named_formulas; - -public: - pp_tptp(z3::context& ctx): ctx(ctx), m_formula_id(0) {} - - - void display_func_decl(std::ostream& out, z3::func_decl& f) { - std::string name = lower_case_fun(f.name()); - out << "tff(" << name << "_type, type, (\n " << name << ": "; - unsigned na = f.arity(); - switch(na) { - case 0: - break; - case 1: { - z3::sort s(f.domain(0)); - display_sort(out, s); - out << " > "; - break; - } - default: - out << "( "; - for (unsigned j = 0; j < na; ++j) { - z3::sort s(f.domain(j)); - display_sort(out, s); - if (j + 1 < na) { - out << " * "; - } - } - out << " ) > "; - } - z3::sort srt(f.range()); - display_sort(out, srt); - out << ")).\n"; - } - - void display_axiom(std::ostream& out, z3::expr e) { - out << "tff(formula" << (++m_formula_id) << ", axiom,\n "; - display(out, e, true); - out << ").\n"; - } - - void display(std::ostream& out, z3::expr e, bool in_paren) { - std::string s; - if (e.is_numeral(s)) { - out << s; - } - else if (e.is_var()) { - unsigned idx = Z3_get_index_value(ctx, e); - out << names[names.size()-1-idx]; - } - else if (e.is_app()) { - switch(e.decl().decl_kind()) { - case Z3_OP_TRUE: - out << "$true"; - break; - case Z3_OP_FALSE: - out << "$false"; - break; - case Z3_OP_AND: - display_infix(out, "&", e, in_paren); - break; - case Z3_OP_OR: - display_infix(out, "|", e, in_paren); - break; - case Z3_OP_IMPLIES: - display_infix(out, "=>", e, in_paren); - break; - case Z3_OP_NOT: - if (!in_paren) out << "("; - out << "~"; - display(out, e.arg(0), false); - if (!in_paren) out << ")"; - break; - case Z3_OP_EQ: - if (e.arg(0).is_bool()) { - display_infix(out, "<=>", e, in_paren); - } - else { - display_infix(out, "=", e, in_paren); - } - break; - case Z3_OP_IFF: - display_infix(out, "<=>", e, in_paren); - break; - case Z3_OP_XOR: - display_infix(out, "<~>", e, in_paren); - break; - case Z3_OP_MUL: - display_binary(out, "$product", e); - break; - case Z3_OP_ADD: - display_binary(out, "$sum", e); - break; - case Z3_OP_SUB: - display_prefix(out, "$difference", e); - break; - case Z3_OP_LE: - display_prefix(out, "$lesseq", e); - break; - case Z3_OP_GE: - display_prefix(out, "$greatereq", e); - break; - case Z3_OP_LT: - display_prefix(out, "$less", e); - break; - case Z3_OP_GT: - display_prefix(out, "$greater", e); - break; - case Z3_OP_UMINUS: - display_prefix(out, "$uminus", e); - break; - case Z3_OP_DIV: - display_prefix(out, "$quotient", e); - break; - case Z3_OP_IS_INT: - display_prefix(out, "$is_int", e); - break; - case Z3_OP_TO_REAL: - display_prefix(out, "$to_real", e); - break; - case Z3_OP_TO_INT: - display_prefix(out, "$to_int", e); - break; - case Z3_OP_IDIV: - display_prefix(out, "$quotient_e", e); - break; - case Z3_OP_MOD: - display_prefix(out, "$remainder_e", e); - break; - case Z3_OP_ITE: - display_prefix(out, e.is_bool()?"ite_f":"ite_t", e); - break; - case Z3_OP_DISTINCT: - display_prefix(out, "$distinct", e); - break; - case Z3_OP_REM: - throw failure_ex("rem is not handled"); - break; - case Z3_OP_OEQ: - display_prefix(out, "$oeq", e); - break; - default: - display_app(out, e); - break; - } - } - else if (e.is_quantifier()) { - bool is_forall = Z3_is_quantifier_forall(ctx, e); - bool is_lambda = Z3_is_lambda(ctx, e); - unsigned nb = Z3_get_quantifier_num_bound(ctx, e); - - out << (is_lambda?"^":(is_forall?"!":"?")) << "["; - for (unsigned i = 0; i < nb; ++i) { - Z3_symbol n = Z3_get_quantifier_bound_name(ctx, e, i); - names.push_back(upper_case_var(z3::symbol(ctx, n))); - z3::sort srt(ctx, Z3_get_quantifier_bound_sort(ctx, e, i)); - out << names.back() << ": "; - display_sort(out, srt); - if (i + 1 < nb) { - out << ", "; - } - } - out << "] : "; - display(out, e.body(), false); - for (unsigned i = 0; i < nb; ++i) { - names.pop_back(); - } - } - } - - void display_app(std::ostream& out, z3::expr e) { - if (e.is_const()) { - out << e; - return; - } - out << lower_case_fun(e.decl().name()) << "("; - unsigned n = e.num_args(); - for(unsigned i = 0; i < n; ++i) { - display(out, e.arg(i), n == 1); - if (i + 1 < n) { - out << ", "; - } - } - out << ")"; - } - - void display_sort(std::ostream& out, z3::sort const& s) { - if (s.is_int()) { - out << "$int"; - } - else if (s.is_real()) { - out << "$real"; - } - else if (s.is_bool()) { - out << "$o"; - } - else { - out << s; - } - } - - void display_infix(std::ostream& out, char const* conn, z3::expr& e, bool in_paren) { - if (!in_paren) out << "("; - unsigned sz = e.num_args(); - for (unsigned i = 0; i < sz; ++i) { - display(out, e.arg(i), false); - if (i + 1 < sz) { - out << " " << conn << " "; - } - } - if (!in_paren) out << ")"; - } - - void display_prefix(std::ostream& out, char const* conn, z3::expr& e) { - out << conn << "("; - unsigned sz = e.num_args(); - for (unsigned i = 0; i < sz; ++i) { - display(out, e.arg(i), sz == 1); - if (i + 1 < sz) { - out << ", "; - } - } - out << ")"; - } - - void display_binary(std::ostream& out, char const* conn, z3::expr& e) { - out << conn << "("; - unsigned sz = e.num_args(); - unsigned np = 1; - for (unsigned i = 0; i < sz; ++i) { - display(out, e.arg(i), false); - if (i + 1 < sz) { - out << ", "; - } - if (i + 2 < sz) { - out << conn << "("; - ++np; - } - } - for (unsigned i = 0; i < np; ++i) { - out << ")"; - } - } - - void collect_axiom_ids(named_formulas& axioms) { - m_named_formulas = &axioms; - m_axiom_ids.clear(); - for (unsigned i = 0; i < axioms.m_formulas.size(); ++i) { - z3::expr& e = axioms.m_formulas[i]; - unsigned id = Z3_get_ast_id(ctx, e); - m_axiom_ids.insert(std::make_pair(id, i)); - } - } - - void display_proof(std::ostream& out, named_formulas& fmls, z3::solver& solver) { - m_node_number = 0; - m_proof_ids.clear(); - m_proof_hypotheses.clear(); - z3::expr proof = solver.proof(); - collect_axiom_ids(fmls); - collect_decls(proof); - collect_hypotheses(proof); - display_sort_decls(out); - display_func_decls(out); - display_proof_rec(out, proof); - } - - /** - \brief collect hypotheses for each proof node. - */ - void collect_hypotheses(z3::expr& proof) { - Z3_sort proof_sort = proof.get_sort(); - size_t todo_size = todo.size(); - todo.push_back(proof); - while (todo_size != todo.size()) { - z3::expr p = todo.back(); - unsigned id = Z3_get_ast_id(ctx, p); - if (m_proof_hypotheses.find(id) != m_proof_hypotheses.end()) { - todo.pop_back(); - continue; - } - bool all_visited = true; - for (unsigned i = 0; i < p.num_args(); ++i) { - z3::expr arg = p.arg(i); - if (arg.get_sort() == proof_sort) { - if (m_proof_hypotheses.find(Z3_get_ast_id(ctx,arg)) == m_proof_hypotheses.end()) { - all_visited = false; - todo.push_back(arg); - } - } - } - if (!all_visited) { - continue; - } - todo.pop_back(); - std::set hyps; - if (p.decl().decl_kind() == Z3_OP_PR_LEMMA) { - // we assume here that all hypotheses get consumed in lemmas. - } - else { - for (unsigned i = 0; i < p.num_args(); ++i) { - z3::expr arg = p.arg(i); - if (arg.get_sort() == proof_sort) { - unsigned arg_id = Z3_get_ast_id(ctx,arg); - std::set const& arg_hyps = m_proof_hypotheses.find(arg_id)->second; - std::set::iterator it = arg_hyps.begin(), end = arg_hyps.end(); - for (; it != end; ++it) { - hyps.insert(*it); - } - } - } - } - m_proof_hypotheses.insert(std::make_pair(id, hyps)); - } - - } - - unsigned display_proof_rec(std::ostream& out, z3::expr proof) { - Z3_sort proof_sort = proof.get_sort(); - size_t todo_size = todo.size(); - todo.push_back(proof); - while (todo_size != todo.size()) { - z3::expr p = todo.back(); - unsigned id = Z3_get_ast_id(ctx, p); - if (m_proof_ids.find(id) != m_proof_ids.end()) { - todo.pop_back(); - continue; - } - - switch (p.decl().decl_kind()) { - case Z3_OP_PR_MODUS_PONENS_OEQ: { - unsigned hyp = display_proof_rec(out, p.arg(0)); - unsigned num = display_proof_hyp(out, hyp, p.arg(1)); - m_proof_ids.insert(std::make_pair(id, num)); - todo.pop_back(); - continue; - } - default: - break; - } - bool all_visited = true; - for (unsigned i = 0; i < p.num_args(); ++i) { - z3::expr arg = p.arg(i); - if (arg.get_sort() == proof_sort) { - if (m_proof_ids.find(Z3_get_ast_id(ctx,arg)) == m_proof_ids.end()) { - all_visited = false; - todo.push_back(arg); - } - } - } - if (!all_visited) { - continue; - } - todo.pop_back(); - unsigned num = ++m_node_number; - m_proof_ids.insert(std::make_pair(id, num)); - - switch (p.decl().decl_kind()) { - case Z3_OP_PR_ASSERTED: { - std::string formula_name; - std::string formula_file; - unsigned id = Z3_get_ast_id(ctx, p.arg(0)); - std::map::iterator it = m_axiom_ids.find(id); - if (it != m_axiom_ids.end()) { - formula_name = m_named_formulas->m_names[it->second]; - formula_file = m_named_formulas->m_files[it->second]; - } - else { - std::ostringstream str; - str << "axiom_" << id; - formula_name = str.str(); - formula_file = "unknown"; - } - out << "tff(" << m_node_number << ",axiom,("; - display(out, get_proof_formula(p), true); - out << "), file('" << formula_file << "','"; - out << formula_name << "')).\n"; - break; - } - case Z3_OP_PR_UNDEF: - throw failure_ex("undef rule not handled"); - case Z3_OP_PR_TRUE: - display_inference(out, "true", "thm", p); - break; - case Z3_OP_PR_GOAL: - display_inference(out, "goal", "thm", p); - break; - case Z3_OP_PR_MODUS_PONENS: - display_inference(out, "modus_ponens", "thm", p); - break; - case Z3_OP_PR_REFLEXIVITY: - display_inference(out, "reflexivity", "thm", p); - break; - case Z3_OP_PR_SYMMETRY: - display_inference(out, "symmetry", "thm", p); - break; - case Z3_OP_PR_TRANSITIVITY: - case Z3_OP_PR_TRANSITIVITY_STAR: - display_inference(out, "transitivity", "thm", p); - break; - case Z3_OP_PR_MONOTONICITY: - display_inference(out, "monotonicity", "thm", p); - break; - case Z3_OP_PR_QUANT_INTRO: - display_inference(out, "quant_intro", "thm", p); - break; - case Z3_OP_PR_DISTRIBUTIVITY: - display_inference(out, "distributivity", "thm", p); - break; - case Z3_OP_PR_AND_ELIM: - display_inference(out, "and_elim", "thm", p); - break; - case Z3_OP_PR_NOT_OR_ELIM: - display_inference(out, "or_elim", "thm", p); - break; - case Z3_OP_PR_REWRITE: - case Z3_OP_PR_REWRITE_STAR: - display_inference(out, "rewrite", "thm", p); - break; - case Z3_OP_PR_PULL_QUANT: - display_inference(out, "pull_quant", "thm", p); - break; - case Z3_OP_PR_PUSH_QUANT: - display_inference(out, "push_quant", "thm", p); - break; - case Z3_OP_PR_ELIM_UNUSED_VARS: - display_inference(out, "elim_unused_vars", "thm", p); - break; - case Z3_OP_PR_DER: - display_inference(out, "destructive_equality_resolution", "thm", p); - break; - case Z3_OP_PR_QUANT_INST: - display_inference(out, "quant_inst", "thm", p); - break; - case Z3_OP_PR_HYPOTHESIS: - out << "tff(" << m_node_number << ",assumption,("; - display(out, get_proof_formula(p), true); - out << "), introduced(assumption)).\n"; - break; - case Z3_OP_PR_LEMMA: { - out << "tff(" << m_node_number << ",plain,("; - display(out, get_proof_formula(p), true); - out << "), inference(lemma,lemma(discharge,"; - unsigned parent_id = Z3_get_ast_id(ctx, p.arg(0)); - std::set const& hyps = m_proof_hypotheses.find(parent_id)->second; - print_hypotheses(out, hyps); - out << "))).\n"; - break; - } - case Z3_OP_PR_UNIT_RESOLUTION: - display_inference(out, "unit_resolution", "thm", p); - break; - case Z3_OP_PR_IFF_TRUE: - display_inference(out, "iff_true", "thm", p); - break; - case Z3_OP_PR_IFF_FALSE: - display_inference(out, "iff_false", "thm", p); - break; - case Z3_OP_PR_COMMUTATIVITY: - display_inference(out, "commutativity", "thm", p); - break; - case Z3_OP_PR_DEF_AXIOM: - display_inference(out, "tautology", "thm", p); - break; - case Z3_OP_PR_DEF_INTRO: - display_inference(out, "def_intro", "sab", p); - break; - case Z3_OP_PR_APPLY_DEF: - display_inference(out, "apply_def", "sab", p); - break; - case Z3_OP_PR_IFF_OEQ: - display_inference(out, "iff_oeq", "sab", p); - break; - case Z3_OP_PR_NNF_POS: - display_inference(out, "nnf_pos", "sab", p); - break; - case Z3_OP_PR_NNF_NEG: - display_inference(out, "nnf_neg", "sab", p); - break; - case Z3_OP_PR_SKOLEMIZE: - display_inference(out, "skolemize", "sab", p); - break; - case Z3_OP_PR_MODUS_PONENS_OEQ: - display_inference(out, "modus_ponens_sab", "sab", p); - break; - case Z3_OP_PR_TH_LEMMA: - display_inference(out, "theory_lemma", "thm", p); - break; - case Z3_OP_PR_HYPER_RESOLVE: - display_inference(out, "hyper_resolve", "thm", p); - break; - case Z3_OP_PR_BIND: - display_inference(out, "bind", "th", p); - break; - default: - out << "TBD: " << m_node_number << "\n" << p << "\n"; - throw failure_ex("rule not handled"); - } - } - return m_proof_ids.find(Z3_get_ast_id(ctx, proof))->second; - } - - unsigned display_proof_hyp(std::ostream& out, unsigned hyp, z3::expr p) { - z3::expr fml = p.arg(p.num_args()-1); - z3::expr conclusion = fml.arg(1); - switch (p.decl().decl_kind()) { - case Z3_OP_PR_REFLEXIVITY: - return display_hyp_inference(out, "reflexivity", "sab", conclusion, hyp); - case Z3_OP_PR_IFF_OEQ: { - unsigned hyp2 = display_proof_rec(out, p.arg(0)); - return display_hyp_inference(out, "modus_ponens", "thm", conclusion, hyp, hyp2); - } - case Z3_OP_PR_NNF_POS: - case Z3_OP_PR_SKOLEMIZE: - return display_hyp_inference(out, "skolemize", "sab", conclusion, hyp); - case Z3_OP_PR_TRANSITIVITY: - case Z3_OP_PR_TRANSITIVITY_STAR: { - unsigned na = p.num_args(); - for (unsigned i = 0; i + 1 < na; ++i) { - if (p.arg(i).num_args() != 2) { - // cop-out: Z3 produces transitivity proofs that are not a chain of equivalences/equi-sats. - // the generated proof is (most likely) not going to be checkable. - continue; - } - z3::expr conclusion = p.arg(i).arg(1); - hyp = display_hyp_inference(out, "transitivity", "sab", conclusion, hyp); - } - return hyp; - } - case Z3_OP_PR_MONOTONICITY: - throw failure_ex("monotonicity rule is not handled"); - default: - unsigned hyp2 = 0; - if (p.num_args() == 2) { - hyp2 = display_proof_rec(out, p.arg(0)); - } - if (p.num_args() > 2) { - std::cout << "unexpected number of arguments: " << p << "\n"; - throw failure_ex("unexpected number of arguments"); - } - - return display_hyp_inference(out, p.decl().name().str().c_str(), "sab", conclusion, hyp, hyp2); - } - return 0; - } - - - void display_inference(std::ostream& out, char const* name, char const* status, z3::expr p) { - unsigned id = Z3_get_ast_id(ctx, p); - std::set const& hyps = m_proof_hypotheses.find(id)->second; - out << "tff(" << m_node_number << ",plain,\n ("; - display(out, get_proof_formula(p), true); - out << "),\n inference(" << name << ",[status(" << status << ")"; - if (!hyps.empty()) { - out << ", assumptions("; - print_hypotheses(out, hyps); - out << ")"; - } - out << "],"; - display_hypotheses(out, p); - out << ")).\n"; - } - - void print_hypotheses(std::ostream& out, std::set const& hyps) { - std::set::iterator it = hyps.begin(), end = hyps.end(); - bool first = true; - out << "["; - for (; it != end; ++it) { - if (!first) { - out << ", "; - } - first = false; - out << m_proof_ids.find(*it)->second; - } - out << "]"; - } - - unsigned display_hyp_inference(std::ostream& out, char const* name, char const* status, z3::expr conclusion, unsigned hyp1, unsigned hyp2 = 0) { - ++m_node_number; - out << "tff(" << m_node_number << ",plain,(\n "; - display(out, conclusion, true); - out << "),\n inference(" << name << ",[status(" << status << ")],"; - out << "[" << hyp1; - if (hyp2) { - out << ", " << hyp2; - } - out << "])).\n"; - return m_node_number; - } - - - - void get_free_vars(z3::expr const& e, std::vector& vars) { - std::set seen; - size_t sz = todo.size(); - todo.push_back(e); - while (todo.size() != sz) { - z3::expr e = todo.back(); - todo.pop_back(); - unsigned id = Z3_get_ast_id(e.ctx(), e); - if (seen.find(id) != seen.end()) { - continue; - } - seen.insert(id); - if (e.is_var()) { - unsigned idx = Z3_get_index_value(ctx, e); - while (idx >= vars.size()) { - vars.push_back(e.get_sort()); - } - vars[idx] = e.get_sort(); - } - else if (e.is_app()) { - unsigned sz = e.num_args(); - for (unsigned i = 0; i < sz; ++i) { - todo.push_back(e.arg(i)); - } - } - else { - // e is a quantifier - std::vector fv; - get_free_vars(e.body(), fv); - unsigned nb = Z3_get_quantifier_num_bound(e.ctx(), e); - for (unsigned i = nb; i < fv.size(); ++i) { - if (vars.size() <= i - nb) { - vars.push_back(fv[i]); - } - } - } - } - } - - z3::expr get_proof_formula(z3::expr proof) { - // unsigned na = proof.num_args(); - z3::expr result = proof.arg(proof.num_args()-1); - std::vector vars; - get_free_vars(result, vars); - if (vars.empty()) { - return result; - } - Z3_sort* sorts = new Z3_sort[vars.size()]; - Z3_symbol* names = new Z3_symbol[vars.size()]; - for (unsigned i = 0; i < vars.size(); ++i) { - std::ostringstream str; - str << "X" << (i+1); - sorts[vars.size()-i-1] = vars[i]; - names[vars.size()-i-1] = Z3_mk_string_symbol(ctx, str.str().c_str()); - } - result = z3::expr(ctx, Z3_mk_forall(ctx, 1, 0, 0, static_cast(vars.size()), sorts, names, result)); - delete[] sorts; - delete[] names; - return result; - } - - void display_hypotheses(std::ostream& out, z3::expr p) { - unsigned na = p.num_args(); - out << "["; - for (unsigned i = 0; i + 1 < na; ++i) { - out << m_proof_ids.find(Z3_get_ast_id(p.ctx(), p.arg(i)))->second; - if (i + 2 < na) { - out << ", "; - } - } - out << "]"; - } - - void display_sort_decls(std::ostream& out) { - for (unsigned i = 0; i < sorts.size(); ++i) { - display_sort_decl(out, sorts[i]); - } - } - - void display_sort_decl(std::ostream& out, z3::sort& s) { - out << "tff(" << s << "_type, type, (" << s << ": $tType)).\n"; - } - - - void display_func_decls(std::ostream& out) { - for (size_t i = 0; i < funs.size(); ++i) { - display_func_decl(out, funs[i]); - } - } - - bool contains_id(unsigned id) const { - return seen_ids.find(id) != seen_ids.end(); - } - - void collect_decls(z3::expr e) { - todo.push_back(e); - while (!todo.empty()) { - z3::expr e = todo.back(); - todo.pop_back(); - unsigned id = Z3_get_ast_id(ctx, e); - if (contains_id(id)) { - continue; - } - seen_ids.insert(id); - if (e.is_app()) { - collect_fun(e.decl()); - unsigned sz = e.num_args(); - for (unsigned i = 0; i < sz; ++i) { - todo.push_back(e.arg(i)); - } - } - else if (e.is_quantifier()) { - unsigned nb = Z3_get_quantifier_num_bound(e.ctx(), e); - for (unsigned i = 0; i < nb; ++i) { - z3::sort srt(ctx, Z3_get_quantifier_bound_sort(e.ctx(), e, i)); - collect_sort(srt); - } - todo.push_back(e.body()); - } - else if (e.is_var()) { - collect_sort(e.get_sort()); - } - } - } - - void collect_sort(z3::sort s) { - unsigned id = Z3_get_sort_id(ctx, s); - if (s.sort_kind() == Z3_UNINTERPRETED_SORT && - contains_id(id)) { - seen_ids.insert(id); - sorts.push_back(s); - } - } - - void collect_fun(z3::func_decl f) { - unsigned id = Z3_get_func_decl_id(ctx, f); - if (contains_id(id)) { - return; - } - seen_ids.insert(id); - if (f.decl_kind() == Z3_OP_UNINTERPRETED) { - funs.push_back(f); - } - for (unsigned i = 0; i < f.arity(); ++i) { - collect_sort(f.domain(i)); - } - collect_sort(f.range()); - } - - std::string upper_case_var(z3::symbol const& sym) { - std::string result = sanitize(sym); - char ch = result[0]; - if ('A' <= ch && ch <= 'Z') { - return result; - } - return "X" + result; - } - - std::string lower_case_fun(z3::symbol const& sym) { - std::string result = sanitize(sym); - char ch = result[0]; - if ('a' <= ch && ch <= 'z') { - return result; - } - else { - return "tptp_fun_" + result; - } - } - - std::string sanitize(z3::symbol const& sym) { - std::ostringstream str; - if (sym.kind() == Z3_INT_SYMBOL) { - str << sym; - return str.str(); - } - std::string s = sym.str(); - size_t sz = s.size(); - for (size_t i = 0; i < sz; ++i) { - char ch = s[i]; - if ('a' <= ch && ch <= 'z') { - str << ch; - } - else if ('A' <= ch && ch <= 'Z') { - str << ch; - } - else if ('0' <= ch && ch <= '9') { - str << ch; - } - else if ('_' == ch) { - str << ch; - } - else { - str << "_"; - } - } - return str.str(); - } -}; - -static char* g_input_file = 0; -static bool g_display_smt2 = false; -static bool g_generate_model = false; -static bool g_generate_proof = false; -static bool g_generate_core = false; -static bool g_display_statistics = false; -static bool g_first_interrupt = true; -static bool g_smt2status = false; -static bool g_check_status = false; -static int g_timeout = 0; -static double g_start_time = 0; -static z3::solver* g_solver = 0; -static z3::context* g_context = 0; -static std::ostream* g_out = &std::cout; - - - -static void display_usage() { - unsigned major, minor, build_number, revision_number; - Z3_get_version(&major, &minor, &build_number, &revision_number); - std::cout << "Z3tptp [" << major << "." << minor << "." << build_number << "." << revision_number << "] (c) 2006-20**. Microsoft Corp.\n"; - std::cout << "Usage: tptp [options] [-file:]file\n"; - std::cout << " -h, -? prints this message.\n"; - std::cout << " -smt2 print SMT-LIB2 benchmark.\n"; - std::cout << " -m, -model generate model.\n"; - std::cout << " -p, -proof generate proof.\n"; - std::cout << " -c, -core generate unsat core of named formulas.\n"; - std::cout << " -st, -statistics display statistics.\n"; - std::cout << " -t:timeout set timeout (in second).\n"; - std::cout << " -smt2status display status in smt2 format instead of SZS.\n"; - std::cout << " -check_status check the status produced by Z3 against annotation in benchmark.\n"; - std::cout << " -: configuration parameter and value.\n"; - std::cout << " -o: file to place output in.\n"; -} - - -static void display_statistics() { - if (g_solver && g_display_statistics) { - std::cout.flush(); - std::cerr.flush(); - double end_time = static_cast(clock()); - z3::stats stats = g_solver->statistics(); - std::cout << stats << "\n"; - std::cout << "time: " << (end_time - g_start_time)/CLOCKS_PER_SEC << " secs\n"; - } -} - -static void on_ctrl_c(int) { - if (g_context && g_first_interrupt) { - Z3_interrupt(*g_context); - g_first_interrupt = false; - } - else { - signal (SIGINT, SIG_DFL); - display_statistics(); - raise(SIGINT); - } -} - -bool parse_token(char const*& line, char const* token) { - char const* result = line; - while (result[0] == ' ') ++result; - while (token[0] && result[0] == token[0]) { - ++token; - ++result; - } - if (!token[0]) { - line = result; - return true; - } - else { - return false; - } -} - -bool parse_is_sat_line(char const* line, bool& is_sat) { - if (!parse_token(line, "%")) return false; - if (!parse_token(line, "Status")) return false; - if (!parse_token(line, ":")) return false; - - if (parse_token(line, "Unsatisfiable")) { - is_sat = false; - return true; - } - if (parse_token(line, "Theorem")) { - is_sat = false; - return true; - } - if (parse_token(line, "Theorem")) { - is_sat = false; - return true; - } - if (parse_token(line, "CounterSatisfiable")) { - is_sat = true; - return true; - } - if (parse_token(line, "Satisfiable")) { - is_sat = true; - return true; - } - return false; -} - -bool parse_is_sat(char const* filename, bool& is_sat) { - std::ifstream is(filename); - if (is.bad() || is.fail()) { - std::stringstream strm; - strm << "Could not open file " << filename << "\n"; - throw failure_ex(strm.str().c_str()); - } - - for (unsigned i = 0; !is.eof() && i < 200; ++i) { - std::string line; - std::getline(is, line); - if (parse_is_sat_line(line.c_str(), is_sat)) { - return true; - } - } - return false; -} - - -void parse_cmd_line_args(int argc, char ** argv) { - g_input_file = 0; - g_display_smt2 = false; - int i = 1; - while (i < argc) { - char* arg = argv[i]; - //char * eq = 0; - char * opt_arg = 0; - if (arg[0] == '-' || arg[0] == '/') { - ++arg; - while (*arg == '-') { - ++arg; - } - char * colon = strchr(arg, ':'); - if (colon) { - opt_arg = colon + 1; - *colon = 0; - } - if (!strcmp(arg,"h") || !strcmp(arg,"help") || !strcmp(arg,"?")) { - display_usage(); - exit(0); - } - if (!strcmp(arg,"p") || !strcmp(arg,"proof")) { - g_generate_proof = true; - } - else if (!strcmp(arg,"m") || !strcmp(arg,"model")) { - g_generate_model = true; - } - else if (!strcmp(arg,"c") || !strcmp(arg,"core")) { - g_generate_core = true; - } - else if (!strcmp(arg,"st") || !strcmp(arg,"statistics")) { - g_display_statistics = true; - } - else if (!strcmp(arg,"check_status")) { - g_check_status = true; - } - else if (!strcmp(arg,"t") || !strcmp(arg,"timeout")) { - if (!opt_arg) { - display_usage(); - exit(0); - } - g_timeout = atoi(opt_arg); - } - else if (!strcmp(arg,"smt2status")) { - g_smt2status = true; - } - else if (!strcmp(arg,"o")) { - if (opt_arg) { - g_out = new std::ofstream(opt_arg); - if (g_out->bad() || g_out->fail()) { - std::cout << "Could not open file of output: " << opt_arg << "\n"; - exit(0); - } - } - else { - display_usage(); - exit(0); - } - } - else if (!strcmp(arg,"smt2")) { - g_display_smt2 = true; - - } - else if (!strcmp(arg, "file")) { - g_input_file = opt_arg; - } - else if (opt_arg && arg[0] != '"') { - Z3_global_param_set(arg, opt_arg); - } - else { - std::cerr << "parameter " << arg << " was not recognized\n"; - display_usage(); - exit(0); - } - } - else { - g_input_file = arg; - } - ++i; - } - - if (!g_input_file) { - display_usage(); - exit(0); - } -} - -static bool is_smt2_file(char const* filename) { - size_t len = strlen(filename); - return (len > 4 && !strcmp(filename + len - 5,".smt2")); -} - - -static void display_tptp(std::ostream& out) { - // run SMT2 parser, pretty print TFA format. - z3::context ctx; - z3::expr_vector fmls = ctx.parse_file(g_input_file); - z3::expr fml = z3::mk_and(fmls); - - pp_tptp pp(ctx); - pp.collect_decls(fml); - pp.display_sort_decls(out); - pp.display_func_decls(out); - - if (fml.decl().decl_kind() == Z3_OP_AND) { - for (unsigned i = 0; i < fml.num_args(); ++i) { - pp.display_axiom(out, fml.arg(i)); - } - } - else { - pp.display_axiom(out, fml); - } -} - -static void display_proof(z3::context& ctx, named_formulas& fmls, z3::solver& solver) { - pp_tptp pp(ctx); - pp.display_proof(std::cout, fmls, solver); -} - -static void display_model(z3::context& ctx, z3::model model) { - unsigned nc = model.num_consts(); - unsigned nf = model.num_funcs(); - z3::expr_vector fmls(ctx); - for (unsigned i = 0; i < nc; ++i) { - z3::func_decl f = model.get_const_decl(i); - z3::expr e = model.get_const_interp(f); - fmls.push_back(f() == e); - } - - for (unsigned i = 0; i < nf; ++i) { - z3::func_decl f = model.get_func_decl(i); - z3::func_interp fi = model.get_func_interp(f); - unsigned arity = f.arity(); - z3::expr_vector args(ctx); - for (unsigned j = 0; j < arity; ++j) { - std::ostringstream str; - str << "X" << j; - z3::symbol sym(ctx, Z3_mk_string_symbol(ctx, str.str().c_str())); - args.push_back(ctx.constant(sym, f.domain(j))); - } - unsigned ne = fi.num_entries(); - Z3_ast* conds = new Z3_ast[arity]; - Z3_ast* conds_match = new Z3_ast[ne]; - z3::expr_vector conds_matchv(ctx); - z3::expr els = fi.else_value(); - unsigned num_cases = 0; - for (unsigned k = 0; k < ne; ++k) { - z3::func_entry e = fi.entry(k); - z3::expr_vector condv(ctx), args_e(ctx); - if (((Z3_ast)els) && (Z3_get_ast_id(ctx, els) == Z3_get_ast_id(ctx, e.value()))) { - continue; - } - for (unsigned j = 0; j < arity; ++j) { - args_e.push_back(e.arg(j)); - condv.push_back(e.arg(j) == args[j]); - conds[j] = condv.back(); - } - z3::expr cond(ctx, Z3_mk_and(ctx, arity, conds)); - conds_matchv.push_back(cond); - conds_match[num_cases] = cond; - fmls.push_back(f(args_e) == e.value()); - ++num_cases; - } - if (els) { - els = f(args) == els; - switch (num_cases) { - case 0: els = forall(args, els); break; - case 1: els = forall(args, implies(!z3::expr(ctx, conds_match[0]), els)); break; - default: els = forall(args, implies(!z3::expr(ctx, Z3_mk_or(ctx, num_cases, conds_match)), els)); break; - } - fmls.push_back(els); - } - delete[] conds; - delete[] conds_match; - } - - pp_tptp pp(ctx); - for (unsigned i = 0; i < fmls.size(); ++i) { - pp.collect_decls(fmls[i]); - } - pp.display_sort_decls(std::cout); - pp.display_func_decls(std::cout); - for (unsigned i = 0; i < fmls.size(); ++i) { - pp.display_axiom(std::cout, fmls[i]); - } -} - -static void display_smt2(std::ostream& out) { - z3::config config; - z3::context ctx(config); - named_formulas fmls; - env env(ctx); - try { - env.parse(g_input_file, fmls); - } - catch (failure_ex& ex) { - std::cerr << ex.msg << "\n"; - return; - } - - z3::expr_vector asms(ctx); - size_t num_assumptions = fmls.m_formulas.size(); - for (size_t i = 0; i < num_assumptions; ++i) - asms.push_back(fmls.m_formulas[i]); - - for (size_t i = 0; i < asms.size(); ++i) { - z3::expr fml = asms[(unsigned)i]; - if (fml.is_and()) { - z3::expr arg0 = fml.arg(0); - asms.set((unsigned)i, arg0); - for (unsigned j = 1; j < fml.num_args(); ++j) - asms.push_back(fml.arg(j)); - --i; - } - } - - Z3_ast* assumptions = new Z3_ast[asms.size()]; - for (size_t i = 0; i < asms.size(); ++i) - assumptions[i] = asms[(unsigned)i]; - Z3_set_ast_print_mode(ctx, Z3_PRINT_SMTLIB_FULL); - Z3_string s = - Z3_benchmark_to_smtlib_string( - ctx, - "Benchmark generated from TPTP", // comment - 0, // no logic is set - "unknown", // no status annotation - "", // attributes - static_cast(asms.size()), - assumptions, - ctx.bool_val(true)); - - out << s << "\n"; - delete[] assumptions; -} - -static void prove_tptp() { - z3::config config; - if (g_generate_proof) { - config.set("proof", true); - z3::set_param("proof", true); - } - z3::context ctx(config); - z3::solver solver(ctx); - g_solver = &solver; - g_context = &ctx; - if (g_timeout) { - // TBD overflow check - z3::set_param("timeout", g_timeout*1000); - z3::params params(ctx); - params.set("timeout", static_cast(g_timeout*1000)); - solver.set(params); - } - - - named_formulas fmls; - env env(ctx); - try { - env.parse(g_input_file, fmls); - } - catch (failure_ex& ex) { - std::cerr << ex.msg << "\n"; - std::cout << "% SZS status GaveUp\n"; - return; - } - - size_t num_assumptions = fmls.m_formulas.size(); - - z3::check_result result; - - if (g_generate_core) { - z3::expr_vector assumptions(ctx); - - for (size_t i = 0; i < num_assumptions; ++i) { - z3::expr pred = ctx.constant(fmls.m_names[i].c_str(), ctx.bool_sort()); - z3::expr def = fmls.m_formulas[i] == pred; - solver.add(def); - assumptions.push_back(pred); - } - result = solver.check(assumptions); - } - else { - for (unsigned i = 0; i < num_assumptions; ++i) { - solver.add(fmls.m_formulas[i]); - } - result = solver.check(); - } - - switch(result) { - case z3::unsat: - if (g_smt2status) { - std::cout << result << "\n"; - } - else if (fmls.has_conjecture()) { - std::cout << "% SZS status Theorem\n"; - } - else { - std::cout << "% SZS status Unsatisfiable\n"; - } - if (g_generate_proof) { - try { - std::cout << "% SZS output start Proof\n"; - display_proof(ctx, fmls, solver); - std::cout << "% SZS output end Proof\n"; - } - catch (failure_ex& ex) { - std::cerr << "Proof display could not be completed: " << ex.msg << "\n"; - } - } - if (g_generate_core) { - z3::expr_vector core = solver.unsat_core(); - std::cout << "% SZS core "; - for (unsigned i = 0; i < core.size(); ++i) { - std::cout << core[i] << " "; - } - std::cout << "\n"; - } - break; - case z3::sat: - if (g_smt2status) { - std::cout << result << "\n"; - } - else if (fmls.has_conjecture()) { - std::cout << "% SZS status CounterSatisfiable\n"; - } - else { - std::cout << "% SZS status Satisfiable\n"; - } - if (g_generate_model) { - std::cout << "% SZS output start Model\n"; - display_model(ctx, solver.get_model()); - std::cout << "% SZS output end Model\n"; - } - break; - case z3::unknown: - if (g_smt2status) { - std::cout << result << "\n"; - } - else if (!g_first_interrupt) { - std::cout << "% SZS status Interrupted\n"; - } - else { - std::cout << "% SZS status GaveUp\n"; - std::string reason = solver.reason_unknown(); - std::cout << "% SZS reason " << reason << "\n"; - } - break; - } - bool is_sat = true; - if (g_check_status && - result != z3::unknown && - parse_is_sat(g_input_file, is_sat)) { - if (is_sat && result == z3::unsat) { - std::cout << "BUG!! expected result is Satisfiable, returned result is Unsat\n"; - } - if (!is_sat && result == z3::sat) { - std::cout << "BUG!! expected result is Unsatisfiable, returned result is Satisfiable\n"; - } - } - display_statistics(); -} - -int main(int argc, char** argv) { - - g_start_time = static_cast(clock()); - signal(SIGINT, on_ctrl_c); - - parse_cmd_line_args(argc, argv); - - if (is_smt2_file(g_input_file)) { - display_tptp(*g_out); - } - else if (g_display_smt2) { - display_smt2(*g_out); - } - else { - try { - prove_tptp(); - } - catch (z3::exception& ex) { - std::cerr << "Exception during proof: " << ex.msg() << "\n"; - } - } - return 0; -} - diff --git a/examples/tptp/tptp5.h b/examples/tptp/tptp5.h deleted file mode 100644 index 90fbc51422..0000000000 --- a/examples/tptp/tptp5.h +++ /dev/null @@ -1,44 +0,0 @@ - -/*++ -Copyright (c) 2015 Microsoft Corporation - ---*/ - -#ifndef TPTP5_H_ -#define TPTP5_H_ - - -class TreeNode; - -#if 0 -class named_formulas { - expr_ref_vector m_fmls; - svector m_names; - bool m_has_conjecture; - unsigned m_conjecture_index; -public: - named_formulas(ast_manager& m) : - m_fmls(m), - m_has_conjecture(false), - m_conjecture_index(0) - {} - void push_back(expr* fml, char const* name) { - m_fmls.push_back(fml); - m_names.push_back(symbol(name)); - } - unsigned size() const { return m_fmls.size(); } - expr*const* data() const { return m_fmls.data(); } - expr* operator[](unsigned i) { return m_fmls[i].get(); } - symbol const& name(unsigned i) { return m_names[i]; } - void set_has_conjecture() { - m_has_conjecture = true; - m_conjecture_index = m_fmls.size(); - } - bool has_conjecture() const { return m_has_conjecture; } - unsigned conjecture_index() const { return m_conjecture_index; } -}; - -bool tptp5_parse(ast_manager& m, char const* filename, named_formulas& fmls); -#endif - -#endif diff --git a/examples/tptp/tptp5.lex.cpp b/examples/tptp/tptp5.lex.cpp deleted file mode 100644 index fb6ccfa511..0000000000 --- a/examples/tptp/tptp5.lex.cpp +++ /dev/null @@ -1,2679 +0,0 @@ - -/*++ -Copyright (c) 2015 Microsoft Corporation - ---*/ - -#line 2 "tptp5.lex.cpp" - -#line 4 "tptp5.lex.cpp" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 8*16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE yylex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - int yyl;\ - for ( yyl = n; yyl < yyleng; ++yyl )\ - if ( yytext[yyl] == '\n' )\ - --yylineno;\ - }while(0) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -#define YY_FLEX_LEX_COMPAT -extern int yylineno; - -int yylineno = 1; - -extern char yytext[]; - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - if ( yyleng + (yy_more_offset) >= YYLMAX ) \ - YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \ - yy_flex_strncpy( &yytext[(yy_more_offset)], (yytext_ptr), yyleng + 1 ); \ - yyleng += (yy_more_offset); \ - (yy_prev_more_offset) = (yy_more_offset); \ - (yy_more_offset) = 0; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 75 -#define YY_END_OF_BUFFER 76 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_acclist[228] = - { 0, - 76, 73, 75, 72, 73, 75, 11, 74, 75, 74, - 75, 74, 75, 74, 75, 71, 74, 75, 1, 74, - 75, 74, 75, 19, 74, 75, 27, 74, 75, 28, - 53, 74, 75, 54, 74, 75, 8, 74, 75, 20, - 74, 75, 22, 74, 75, 74, 75, 63, 65, 66, - 74, 75, 63, 65, 66, 67, 74, 75, 6, 74, - 75, 56, 74, 75, 9, 74, 75, 55, 74, 75, - 23, 74, 75, 2, 74, 75, 50, 74, 75, 15, - 74, 75, 26, 74, 75, 5, 74, 75, 51, 74, - 75, 51, 74, 75, 51, 74, 75, 51, 74, 75, - - 51, 74, 75, 32, 52, 74, 75, 29, 74, 75, - 75, 13, 12, 14, 47, 48, 48, 48, 48, 48, - 71, 63, 64, 63, 64, 70, 63, 65, 66, 67, - 7, 16, 10, 25, 24, 4, 3, 50, 51, 51, - 51, 51, 51, 51, 30, 31, 49, 48, 48, 48, - 48, 48, 48, 46, 63, 64, 21, 70, 57, 59, - 69, 60, 62, 57, 59, 68, 57, 59, 68, 17, - 18, 41, 51, 42, 51, 51, 44, 51, 45, 51, - 49, 33, 48, 34, 48, 35, 48, 48, 39, 48, - 40, 48, 57, 58, 60, 61, 57, 58, 57, 58, - - 71, 57, 59, 69, 60, 62, 57, 59, 68, 51, - 36, 48, 48, 57, 58, 60, 61, 57, 58, 51, - 37, 48, 38, 48, 51, 43, 51 - } ; - -static yyconst flex_int16_t yy_accept[153] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 4, 7, 10, 12, - 14, 16, 19, 22, 24, 27, 30, 34, 37, 40, - 43, 46, 48, 53, 59, 62, 65, 68, 71, 74, - 77, 80, 83, 86, 89, 92, 95, 98, 101, 104, - 108, 111, 112, 113, 114, 115, 115, 116, 116, 116, - 117, 118, 119, 120, 121, 122, 122, 122, 124, 126, - 126, 127, 127, 127, 127, 127, 131, 132, 133, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - - 154, 154, 155, 155, 155, 155, 155, 157, 158, 159, - 159, 159, 162, 164, 167, 170, 171, 172, 174, 176, - 177, 179, 181, 182, 184, 186, 188, 189, 191, 193, - 195, 197, 199, 201, 201, 201, 202, 205, 207, 210, - 211, 213, 214, 216, 218, 220, 221, 223, 225, 226, - 228, 228 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 22, 7, 23, - 24, 25, 26, 27, 28, 28, 28, 28, 29, 28, - 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 30, 31, 32, 33, 34, 7, 35, 35, 36, 37, - - 38, 39, 35, 40, 41, 35, 35, 42, 35, 43, - 44, 35, 35, 35, 35, 45, 46, 35, 35, 35, - 35, 35, 7, 47, 7, 48, 49, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50 - } ; - -static yyconst flex_int32_t yy_meta[51] = - { 0, - 1, 1, 2, 3, 3, 3, 3, 4, 3, 3, - 5, 3, 3, 3, 3, 3, 3, 3, 3, 6, - 6, 3, 3, 3, 3, 3, 3, 6, 6, 3, - 3, 3, 3, 6, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 3, 3, 1, 1 - } ; - -static yyconst flex_int16_t yy_base[164] = - { 0, - 0, 0, 15, 16, 23, 30, 31, 38, 45, 46, - 53, 60, 61, 68, 302, 303, 303, 90, 47, 303, - 80, 0, 303, 270, 303, 303, 303, 90, 303, 103, - 97, 286, 108, 110, 275, 84, 273, 303, 108, 48, - 0, 303, 303, 303, 0, 254, 252, 252, 96, 303, - 93, 303, 303, 303, 303, 127, 303, 132, 0, 0, - 222, 213, 209, 102, 0, 62, 133, 131, 133, 228, - 135, 231, 145, 223, 147, 154, 303, 218, 217, 303, - 303, 303, 303, 303, 0, 0, 202, 201, 202, 197, - 196, 303, 303, 0, 0, 180, 131, 171, 157, 143, - - 146, 303, 148, 160, 157, 164, 168, 303, 170, 147, - 179, 174, 179, 303, 181, 303, 303, 0, 0, 105, - 0, 0, 0, 0, 0, 0, 165, 0, 0, 187, - 193, 303, 197, 131, 201, 303, 201, 203, 206, 97, - 0, 166, 208, 211, 213, 75, 0, 0, 42, 0, - 303, 244, 248, 255, 260, 262, 264, 51, 266, 271, - 278, 280, 287 - } ; - -static yyconst flex_int16_t yy_def[164] = - { 0, - 151, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 151, 151, 151, 151, 152, 151, - 153, 154, 151, 155, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 156, 151, 151, 151, 157, 157, 157, 157, 157, 151, - 151, 151, 151, 151, 151, 152, 151, 151, 158, 159, - 159, 159, 159, 159, 154, 160, 151, 151, 151, 151, - 151, 161, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 156, 157, 157, 157, 157, 157, - 157, 151, 151, 162, 159, 159, 159, 159, 159, 159, - - 160, 151, 151, 151, 151, 151, 151, 151, 151, 161, - 163, 151, 151, 151, 151, 151, 151, 157, 157, 157, - 157, 157, 162, 159, 159, 159, 159, 159, 159, 151, - 151, 151, 151, 161, 163, 151, 151, 151, 151, 157, - 159, 159, 151, 151, 151, 157, 159, 159, 157, 157, - 0, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151 - } ; - -static yyconst flex_int16_t yy_nxt[354] = - { 0, - 16, 17, 17, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 41, 42, - 20, 43, 44, 20, 45, 46, 45, 45, 47, 45, - 48, 45, 45, 45, 49, 45, 50, 51, 16, 52, - 45, 45, 57, 45, 45, 45, 45, 94, 45, 45, - 45, 45, 83, 45, 84, 45, 45, 45, 45, 45, - 45, 45, 102, 45, 45, 45, 45, 58, 45, 150, - 45, 45, 45, 45, 45, 45, 45, 59, 45, 45, - 45, 45, 103, 45, 53, 45, 45, 45, 45, 45, - - 45, 45, 92, 45, 45, 45, 45, 78, 45, 68, - 69, 149, 45, 54, 55, 61, 71, 71, 62, 70, - 63, 81, 68, 69, 64, 73, 74, 73, 74, 76, - 76, 79, 57, 82, 90, 91, 75, 56, 75, 93, - 99, 100, 146, 66, 111, 75, 140, 75, 104, 105, - 104, 105, 107, 107, 109, 109, 102, 58, 101, 106, - 111, 106, 56, 66, 112, 112, 114, 115, 106, 125, - 106, 73, 74, 76, 76, 126, 103, 131, 101, 130, - 130, 129, 75, 132, 133, 104, 105, 107, 107, 109, - 109, 75, 135, 137, 137, 128, 106, 136, 138, 138, - - 139, 139, 75, 141, 147, 106, 143, 143, 127, 142, - 148, 75, 144, 144, 135, 106, 145, 145, 124, 136, - 137, 137, 138, 138, 106, 139, 139, 143, 143, 75, - 144, 144, 145, 145, 122, 121, 106, 120, 75, 119, - 118, 117, 116, 113, 111, 106, 56, 56, 56, 56, - 56, 60, 108, 98, 60, 65, 97, 65, 65, 65, - 65, 65, 66, 66, 96, 66, 66, 85, 85, 86, - 86, 95, 95, 101, 101, 101, 101, 101, 110, 110, - 110, 110, 110, 110, 110, 123, 123, 134, 134, 134, - 134, 134, 134, 134, 89, 88, 87, 80, 77, 72, - - 67, 151, 15, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151 - } ; - -static yyconst flex_int16_t yy_chk[354] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 4, 19, 3, 4, 3, 4, 158, 5, 3, - 4, 5, 40, 5, 40, 6, 7, 5, 6, 7, - 6, 7, 66, 8, 6, 7, 8, 19, 8, 149, - 9, 10, 8, 9, 10, 9, 10, 21, 11, 9, - 10, 11, 66, 11, 18, 12, 13, 11, 12, 13, - - 12, 13, 51, 14, 12, 13, 14, 36, 14, 28, - 28, 146, 14, 18, 18, 21, 31, 31, 21, 30, - 21, 39, 30, 30, 21, 33, 33, 34, 34, 34, - 34, 36, 56, 39, 49, 49, 33, 58, 34, 51, - 64, 64, 140, 67, 134, 33, 120, 34, 68, 68, - 69, 69, 69, 69, 71, 71, 101, 56, 103, 68, - 110, 69, 58, 67, 73, 73, 75, 75, 68, 97, - 69, 76, 76, 76, 76, 97, 101, 105, 103, 104, - 104, 100, 76, 106, 106, 107, 107, 107, 107, 109, - 109, 76, 111, 112, 112, 99, 107, 111, 113, 113, - - 115, 115, 112, 127, 142, 107, 130, 130, 98, 127, - 142, 112, 131, 131, 135, 130, 133, 133, 96, 135, - 137, 137, 138, 138, 130, 139, 139, 143, 143, 137, - 144, 144, 145, 145, 91, 90, 143, 89, 137, 88, - 87, 79, 78, 74, 72, 143, 152, 152, 152, 152, - 152, 153, 70, 63, 153, 154, 62, 154, 154, 154, - 154, 154, 155, 155, 61, 155, 155, 156, 156, 157, - 157, 159, 159, 160, 160, 160, 160, 160, 161, 161, - 161, 161, 161, 161, 161, 162, 162, 163, 163, 163, - 163, 163, 163, 163, 48, 47, 46, 37, 35, 32, - - 24, 15, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151 - } ; - -/* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[76] = - { 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, }; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; -static char *yy_full_match; -static int yy_lp; -#define REJECT \ -{ \ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \ -yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ -++(yy_lp); \ -goto find_rule; \ -} - -static int yy_more_offset = 0; -static int yy_prev_more_offset = 0; -#define yymore() ((yy_more_offset) = yy_flex_strlen( yytext )) -#define YY_NEED_STRLEN -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET \ - { \ - (yy_more_offset) = (yy_prev_more_offset); \ - yyleng -= (yy_more_offset); \ - } -#ifndef YYLMAX -#define YYLMAX 2*8*8192 -#endif - -char yytext[YYLMAX]; -char *yytext_ptr; -#line 1 "tptp5.l" -#line 3 "tptp5.l" -//----------------------------------------------------------------------------- -#include -#include -#include - -#if _WINDOWS - #include - #define isatty _isatty -#else - // Linux - #include - #define _strdup strdup -#endif - -#include "tptp5.h" -#include "tptp5.tab.h" - - -#define YY_NO_UNISTD_H -#define YY_SKIP_YYWRAP -static int yywrap() { return 1; } -//----------------------------------------------------------------------------- -//----Compile with -DP_VERBOSE=2 to list tokens as they are seen. -#ifndef P_VERBOSE -# define P_VERBOSE 0 -# endif -int verbose2 = P_VERBOSE; - -//----If tptp_prev_tok == PERIOD, you are outside any sentence. -//#ifndef PERIOD -//# error "Period not defined" -//# define PERIOD 46 -//# endif - -#define TPTP_STORE_SIZE 32768 - -//----These have to be external as they are references from other code that -//----is generated by lex/yacc. -int tptp_prev_tok = PERIOD; -int tptp_store_size = TPTP_STORE_SIZE; -char* tptp_lval[TPTP_STORE_SIZE]; -//----------------------------------------------------------------------------- -void tptp_print_tok(char* lval) { - - printf("%3d:%s;\n", tptp_prev_tok, lval); - - return; -} -//----------------------------------------------------------------------------- -int tptp_update_lval(char* lval) { - - static int tptp_next_store = 0; - int next = tptp_next_store; - - free(tptp_lval[tptp_next_store]); - tptp_lval[tptp_next_store] = _strdup(lval); - tptp_next_store = (tptp_next_store+1) % TPTP_STORE_SIZE; - if (verbose2 == 2) { - tptp_print_tok(lval); - } - - return next; -} -//----------------------------------------------------------------------------- -//----%Start: INITIAL begin sentence, B before formula. No others. - -#line 710 "tptp5.lex.cpp" - -#define INITIAL 0 -#define B 1 -#define FF 2 -#define SQ1 3 -#define SQ2 4 -#define Q1 5 -#define Q2 6 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy (void ); - -int yyget_debug (void ); - -void yyset_debug (int debug_flag ); - -YY_EXTRA_TYPE yyget_extra (void ); - -void yyset_extra (YY_EXTRA_TYPE user_defined ); - -FILE *yyget_in (void ); - -void yyset_in (FILE * in_str ); - -FILE *yyget_out (void ); - -void yyset_out (FILE * out_str ); - -int yyget_leng (void ); - -char *yyget_text (void ); - -int yyget_lineno (void ); - -void yyset_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - int n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - -#line 110 "tptp5.l" - - -#line 901 "tptp5.lex.cpp" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - /* Create the reject buffer large enough to save one state per allowed character. */ - if ( ! (yy_state_buf) ) - (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE ); - if ( ! (yy_state_buf) ) - YY_FATAL_ERROR( "out of dynamic memory in yylex()" ); - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); - - (yy_state_ptr) = (yy_state_buf); - *(yy_state_ptr)++ = yy_current_state; - -yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 152 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *(yy_state_ptr)++ = yy_current_state; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 303 ); - -yy_find_action: - yy_current_state = *--(yy_state_ptr); - (yy_lp) = yy_accept[yy_current_state]; -goto find_rule; -find_rule: /* we branch to this label when backing up */ - for ( ; ; ) /* until we find what rule we matched */ - { - if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) - { - yy_act = yy_acclist[(yy_lp)]; - { - (yy_full_match) = yy_cp; - break; - } - } - --yy_cp; - yy_current_state = *--(yy_state_ptr); - (yy_lp) = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - int yyl; - for ( yyl = (yy_prev_more_offset); yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) - - yylineno++; -; - } - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ -case 1: -YY_RULE_SETUP -#line 112 "tptp5.l" -{ - tptp_prev_tok=AMPERSAND; - yylval.ival = tptp_update_lval(yytext); - return(AMPERSAND); -} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 117 "tptp5.l" -{ - tptp_prev_tok=AT_SIGN; - yylval.ival = tptp_update_lval(yytext); - return(AT_SIGN); -} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 122 "tptp5.l" -{ - tptp_prev_tok=AT_SIGN_MINUS; - yylval.ival = tptp_update_lval(yytext); - return(AT_SIGN_MINUS); -} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 127 "tptp5.l" -{ - tptp_prev_tok=AT_SIGN_PLUS; - yylval.ival = tptp_update_lval(yytext); - return(AT_SIGN_PLUS); -} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 132 "tptp5.l" -{ - tptp_prev_tok=CARET; - yylval.ival = tptp_update_lval(yytext); - return(CARET); -} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 137 "tptp5.l" -{ - tptp_prev_tok=COLON; - yylval.ival = tptp_update_lval(yytext); - return(COLON); -} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 142 "tptp5.l" -{ - tptp_prev_tok=COLON_EQUALS; - yylval.ival = tptp_update_lval(yytext); - return(COLON_EQUALS); -} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 147 "tptp5.l" -{ - tptp_prev_tok=COMMA; - yylval.ival = tptp_update_lval(yytext); - return(COMMA); -} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 152 "tptp5.l" -{ - tptp_prev_tok=EQUALS; - yylval.ival = tptp_update_lval(yytext); - return(EQUALS); -} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 157 "tptp5.l" -{ - tptp_prev_tok=EQUALS_GREATER; - yylval.ival = tptp_update_lval(yytext); - return(EQUALS_GREATER); -} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 162 "tptp5.l" -{ - tptp_prev_tok=EXCLAMATION; - yylval.ival = tptp_update_lval(yytext); - return(EXCLAMATION); -} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 167 "tptp5.l" -{ - tptp_prev_tok=EXCLAMATION_EQUALS; - yylval.ival = tptp_update_lval(yytext); - return(EXCLAMATION_EQUALS); -} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 172 "tptp5.l" -{ - tptp_prev_tok=EXCLAMATION_EXCLAMATION; - yylval.ival = tptp_update_lval(yytext); - return(EXCLAMATION_EXCLAMATION); -} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 177 "tptp5.l" -{ - tptp_prev_tok=EXCLAMATION_GREATER; - yylval.ival = tptp_update_lval(yytext); - return(EXCLAMATION_GREATER); -} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 182 "tptp5.l" -{ - tptp_prev_tok=LBRKT; - yylval.ival = tptp_update_lval(yytext); - return(LBRKT); -} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 187 "tptp5.l" -{ - tptp_prev_tok=LESS_EQUALS; - yylval.ival = tptp_update_lval(yytext); - return(LESS_EQUALS); -} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 192 "tptp5.l" -{ - tptp_prev_tok=LESS_EQUALS_GREATER; - yylval.ival = tptp_update_lval(yytext); - return(LESS_EQUALS_GREATER); -} - YY_BREAK -case 18: -YY_RULE_SETUP -#line 197 "tptp5.l" -{ - tptp_prev_tok=LESS_TILDE_GREATER; - yylval.ival = tptp_update_lval(yytext); - return(LESS_TILDE_GREATER); -} - YY_BREAK -case 19: -YY_RULE_SETUP -#line 202 "tptp5.l" -{ - tptp_prev_tok=LPAREN; - yylval.ival = tptp_update_lval(yytext); - return(LPAREN); -} - YY_BREAK -case 20: -YY_RULE_SETUP -#line 207 "tptp5.l" -{ - tptp_prev_tok=MINUS; - yylval.ival = tptp_update_lval(yytext); - return(MINUS); -} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 212 "tptp5.l" -{ - tptp_prev_tok=MINUS_MINUS_GREATER; - yylval.ival = tptp_update_lval(yytext); - return(MINUS_MINUS_GREATER); -} - YY_BREAK -case 22: -YY_RULE_SETUP -#line 217 "tptp5.l" -{ - BEGIN INITIAL; - tptp_prev_tok=PERIOD; - yylval.ival = tptp_update_lval(yytext); - return(PERIOD); -} - YY_BREAK -case 23: -YY_RULE_SETUP -#line 223 "tptp5.l" -{ - tptp_prev_tok=QUESTION; - yylval.ival = tptp_update_lval(yytext); - return(QUESTION); -} - YY_BREAK -case 24: -YY_RULE_SETUP -#line 228 "tptp5.l" -{ - tptp_prev_tok=QUESTION_QUESTION; - yylval.ival = tptp_update_lval(yytext); - return(QUESTION_QUESTION); -} - YY_BREAK -case 25: -YY_RULE_SETUP -#line 233 "tptp5.l" -{ - tptp_prev_tok=QUESTION_STAR; - yylval.ival = tptp_update_lval(yytext); - return(QUESTION_STAR); -} - YY_BREAK -case 26: -YY_RULE_SETUP -#line 238 "tptp5.l" -{ - tptp_prev_tok=RBRKT; - yylval.ival = tptp_update_lval(yytext); - return(RBRKT); -} - YY_BREAK -case 27: -YY_RULE_SETUP -#line 243 "tptp5.l" -{ - tptp_prev_tok=RPAREN; - yylval.ival = tptp_update_lval(yytext); - return(RPAREN); -} - YY_BREAK -case 28: -YY_RULE_SETUP -#line 248 "tptp5.l" -{ - tptp_prev_tok=STAR; - yylval.ival = tptp_update_lval(yytext); - return(STAR); -} - YY_BREAK -case 29: -YY_RULE_SETUP -#line 253 "tptp5.l" -{ - tptp_prev_tok=TILDE; - yylval.ival = tptp_update_lval(yytext); - return(TILDE); -} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 258 "tptp5.l" -{ - tptp_prev_tok=TILDE_AMPERSAND; - yylval.ival = tptp_update_lval(yytext); - return(TILDE_AMPERSAND); -} - YY_BREAK -case 31: -YY_RULE_SETUP -#line 263 "tptp5.l" -{ - tptp_prev_tok=TILDE_VLINE; - yylval.ival = tptp_update_lval(yytext); - return(TILDE_VLINE); -} - YY_BREAK -case 32: -YY_RULE_SETUP -#line 268 "tptp5.l" -{ - tptp_prev_tok=VLINE; - yylval.ival = tptp_update_lval(yytext); - return(VLINE); -} - YY_BREAK -case 33: -YY_RULE_SETUP -#line 273 "tptp5.l" -{ - tptp_prev_tok=_DLR_cnf; - yylval.ival = tptp_update_lval(yytext); - return(_DLR_cnf); -} - YY_BREAK -case 34: -YY_RULE_SETUP -#line 278 "tptp5.l" -{ - tptp_prev_tok=_DLR_fof; - yylval.ival = tptp_update_lval(yytext); - return(_DLR_fof); -} - YY_BREAK -case 35: -YY_RULE_SETUP -#line 283 "tptp5.l" -{ - tptp_prev_tok=_DLR_fot; - yylval.ival = tptp_update_lval(yytext); - return(_DLR_fot); -} - YY_BREAK -case 36: -YY_RULE_SETUP -#line 288 "tptp5.l" -{ - tptp_prev_tok=_DLR_itef; - yylval.ival = tptp_update_lval(yytext); - return(_DLR_itef); -} - YY_BREAK -case 37: -YY_RULE_SETUP -#line 293 "tptp5.l" -{ - tptp_prev_tok=_DLR_itetf; - yylval.ival = tptp_update_lval(yytext); - return(_DLR_itetf); -} - YY_BREAK -case 38: -YY_RULE_SETUP -#line 298 "tptp5.l" -{ - tptp_prev_tok=_DLR_itett; - yylval.ival = tptp_update_lval(yytext); - return(_DLR_itett); -} - YY_BREAK -case 39: -YY_RULE_SETUP -#line 303 "tptp5.l" -{ - tptp_prev_tok=_DLR_tff; - yylval.ival = tptp_update_lval(yytext); - return(_DLR_tff); -} - YY_BREAK -case 40: -YY_RULE_SETUP -#line 308 "tptp5.l" -{ - tptp_prev_tok=_DLR_thf; - yylval.ival = tptp_update_lval(yytext); - return(_DLR_thf); -} - YY_BREAK -case 41: -YY_RULE_SETUP -#line 313 "tptp5.l" -{ - BEGIN B; - tptp_prev_tok=_LIT_cnf; - yylval.ival = tptp_update_lval(yytext); - return(_LIT_cnf); -} - YY_BREAK -case 42: -YY_RULE_SETUP -#line 319 "tptp5.l" -{ - BEGIN B; - tptp_prev_tok=_LIT_fof; - yylval.ival = tptp_update_lval(yytext); - return(_LIT_fof); -} - YY_BREAK -case 43: -YY_RULE_SETUP -#line 325 "tptp5.l" -{ - BEGIN B; - tptp_prev_tok=_LIT_include; - yylval.ival = tptp_update_lval(yytext); - return(_LIT_include); -} - YY_BREAK -case 44: -YY_RULE_SETUP -#line 331 "tptp5.l" -{ - BEGIN B; - tptp_prev_tok=_LIT_tff; - yylval.ival = tptp_update_lval(yytext); - return(_LIT_tff); -} - YY_BREAK -case 45: -YY_RULE_SETUP -#line 337 "tptp5.l" -{ - BEGIN B; - tptp_prev_tok=_LIT_thf; - yylval.ival = tptp_update_lval(yytext); - return(_LIT_thf); -} - YY_BREAK -case 46: -YY_RULE_SETUP -#line 344 "tptp5.l" -{ - tptp_prev_tok=single_quoted; - yylval.ival = tptp_update_lval(yytext); - return(single_quoted); -} - YY_BREAK -case 47: -YY_RULE_SETUP -#line 349 "tptp5.l" -{ - tptp_prev_tok=distinct_object; - yylval.ival = tptp_update_lval(yytext); - return(distinct_object); -} - YY_BREAK -case 48: -YY_RULE_SETUP -#line 354 "tptp5.l" -{ - tptp_prev_tok=dollar_word; - yylval.ival = tptp_update_lval(yytext); - return(dollar_word); -} - YY_BREAK -case 49: -YY_RULE_SETUP -#line 359 "tptp5.l" -{ - tptp_prev_tok=dollar_dollar_word; - yylval.ival = tptp_update_lval(yytext); - return(dollar_dollar_word); -} - YY_BREAK -case 50: -YY_RULE_SETUP -#line 364 "tptp5.l" -{ - tptp_prev_tok=upper_word; - yylval.ival = tptp_update_lval(yytext); - return(upper_word); -} - YY_BREAK -case 51: -YY_RULE_SETUP -#line 369 "tptp5.l" -{ - tptp_prev_tok=lower_word; - yylval.ival = tptp_update_lval(yytext); - return(lower_word); -} - YY_BREAK -case 52: -YY_RULE_SETUP -#line 374 "tptp5.l" -{ - tptp_prev_tok=vline; - yylval.ival = tptp_update_lval(yytext); - return(vline); -} - YY_BREAK -case 53: -YY_RULE_SETUP -#line 379 "tptp5.l" -{ - tptp_prev_tok=star; - yylval.ival = tptp_update_lval(yytext); - return(star); -} - YY_BREAK -case 54: -YY_RULE_SETUP -#line 384 "tptp5.l" -{ - tptp_prev_tok=plus; - yylval.ival = tptp_update_lval(yytext); - return(plus); -} - YY_BREAK -case 55: -YY_RULE_SETUP -#line 389 "tptp5.l" -{ - tptp_prev_tok=arrow; - yylval.ival = tptp_update_lval(yytext); - return(arrow); -} - YY_BREAK -case 56: -YY_RULE_SETUP -#line 394 "tptp5.l" -{ - tptp_prev_tok=less_sign; - yylval.ival = tptp_update_lval(yytext); - return(less_sign); -} - YY_BREAK -case 57: -YY_RULE_SETUP -#line 399 "tptp5.l" -{ - tptp_prev_tok=real; - yylval.ival = tptp_update_lval(yytext); - return(real); -} - YY_BREAK -case 58: -YY_RULE_SETUP -#line 404 "tptp5.l" -{ - tptp_prev_tok=signed_real; - yylval.ival = tptp_update_lval(yytext); - return(signed_real); -} - YY_BREAK -case 59: -YY_RULE_SETUP -#line 409 "tptp5.l" -{ - tptp_prev_tok=unsigned_real; - yylval.ival = tptp_update_lval(yytext); - return(unsigned_real); -} - YY_BREAK -case 60: -YY_RULE_SETUP -#line 414 "tptp5.l" -{ - tptp_prev_tok=rational; - yylval.ival = tptp_update_lval(yytext); - return(rational); -} - YY_BREAK -case 61: -YY_RULE_SETUP -#line 419 "tptp5.l" -{ - tptp_prev_tok=signed_rational; - yylval.ival = tptp_update_lval(yytext); - return(signed_rational); -} - YY_BREAK -case 62: -YY_RULE_SETUP -#line 424 "tptp5.l" -{ - tptp_prev_tok=unsigned_rational; - yylval.ival = tptp_update_lval(yytext); - return(unsigned_rational); -} - YY_BREAK -case 63: -YY_RULE_SETUP -#line 429 "tptp5.l" -{ - tptp_prev_tok=integer; - yylval.ival = tptp_update_lval(yytext); - return(integer); -} - YY_BREAK -case 64: -YY_RULE_SETUP -#line 434 "tptp5.l" -{ - tptp_prev_tok=signed_integer; - yylval.ival = tptp_update_lval(yytext); - return(signed_integer); -} - YY_BREAK -case 65: -YY_RULE_SETUP -#line 439 "tptp5.l" -{ - tptp_prev_tok=unsigned_integer; - yylval.ival = tptp_update_lval(yytext); - return(unsigned_integer); -} - YY_BREAK -case 66: -YY_RULE_SETUP -#line 444 "tptp5.l" -{ - tptp_prev_tok=decimal; - yylval.ival = tptp_update_lval(yytext); - return(decimal); -} - YY_BREAK -case 67: -YY_RULE_SETUP -#line 449 "tptp5.l" -{ - tptp_prev_tok=positive_decimal; - yylval.ival = tptp_update_lval(yytext); - return(positive_decimal); -} - YY_BREAK -case 68: -YY_RULE_SETUP -#line 454 "tptp5.l" -{ - tptp_prev_tok=decimal_exponent; - yylval.ival = tptp_update_lval(yytext); - return(decimal_exponent); -} - YY_BREAK -case 69: -YY_RULE_SETUP -#line 459 "tptp5.l" -{ - tptp_prev_tok=decimal_fraction; - yylval.ival = tptp_update_lval(yytext); - return(decimal_fraction); -} - YY_BREAK -case 70: -YY_RULE_SETUP -#line 464 "tptp5.l" -{ - tptp_prev_tok=dot_decimal; - yylval.ival = tptp_update_lval(yytext); - return(dot_decimal); -} - YY_BREAK -case 71: -/* rule 71 can match eol */ -YY_RULE_SETUP -#line 469 "tptp5.l" -tptp_update_lval(yytext); - YY_BREAK -case 72: -/* rule 72 can match eol */ -YY_RULE_SETUP -#line 470 "tptp5.l" -; - YY_BREAK -case 73: -/* rule 73 can match eol */ -YY_RULE_SETUP -#line 471 "tptp5.l" -; - YY_BREAK -case 74: -YY_RULE_SETUP -#line 472 "tptp5.l" -return(unrecognized); - YY_BREAK -case 75: -YY_RULE_SETUP -#line 473 "tptp5.l" -ECHO; - YY_BREAK -#line 1667 "tptp5.lex.cpp" - case YY_STATE_EOF(INITIAL): - case YY_STATE_EOF(B): - case YY_STATE_EOF(FF): - case YY_STATE_EOF(SQ1): - case YY_STATE_EOF(SQ2): - case YY_STATE_EOF(Q1): - case YY_STATE_EOF(Q2): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - printf("%zu %d %zu\n", YY_CURRENT_BUFFER_LVALUE->yy_buf_size, number_to_move, num_to_read); - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (int)num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - yy_state_type yy_current_state; - char *yy_cp; - - yy_current_state = (yy_start); - - (yy_state_ptr) = (yy_state_buf); - *(yy_state_ptr)++ = yy_current_state; - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 152 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *(yy_state_ptr)++ = yy_current_state; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - int yy_is_jam; - - YY_CHAR yy_c = 1; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 152 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 151); - if ( ! yy_is_jam ) - *(yy_state_ptr)++ = yy_current_state; - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int)YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - if ( c == '\n' ){ - --yylineno; - } - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - if ( c == '\n' ) - - yylineno++; -; - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - -#ifdef _WINDOWS - b->yy_is_interactive = file ? (isatty( _fileno(file) ) > 0) : 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = (int)b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,(int)strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -int yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the current line number. - * @param line_number - * - */ -void yyset_lineno (int line_number ) -{ - - yylineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} - -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - /* We do not touch yylineno unless the option is enabled. */ - yylineno = 1; - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - - (yy_state_buf) = 0; - (yy_state_ptr) = 0; - (yy_full_match) = 0; - (yy_lp) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - yyfree ( (yy_state_buf) ); - (yy_state_buf) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 473 "tptp5.l" - - diff --git a/examples/tptp/tptp5.tab.c b/examples/tptp/tptp5.tab.c deleted file mode 100644 index 086f6e6227..0000000000 --- a/examples/tptp/tptp5.tab.c +++ /dev/null @@ -1,4475 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software - Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.4.2" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - - - -/* Copy the first part of user declarations. */ - -/* Line 189 of yacc.c */ -#line 2 "tptp5.y" - -//----------------------------------------------------------------------------- -#include -#include -#include -//----------------------------------------------------------------------------- -//----Compile with -DP_VERBOSE=1 for verbose output. -#ifndef P_VERBOSE -# define P_VERBOSE 0 -#endif -int verbose = P_VERBOSE; - -//----Compile with -DP_USERPROC=1 to #include p_user_proc.c. p_user_proc.c -//----should #define P_ACT, P_BUILD, P_TOKEN, P_PRINT to different procedures -//----from those below, and supply code. -#ifdef P_USERPROC - -#else -# define P_ACT(ss) if(verbose)printf("%7d %s\n",yylineno,ss); -# define P_BUILD(sym,A,B,C,D,E,F,G,H,I,J) pBuildTree(sym,A,B,C,D,E,F,G,H,I,J) -# define P_TOKEN(tok,symbolIndex) pToken(tok,symbolIndex) -# define P_PRINT(ss) if(verbose){printf("\n\n");pPrintTree(ss,0);} -#endif - -extern int yylineno; -extern int yychar; -extern char yytext[]; - -extern int tptp_store_size; -extern char* tptp_lval[]; - -#define MAX_CHILDREN 12 -typedef struct pTreeNode * pTree; -struct pTreeNode { - char* symbol; - int symbolIndex; - pTree children[MAX_CHILDREN+1]; -}; -//----------------------------------------------------------------------------- -int yyerror( char const *s ) { - - fprintf( stderr, "%s in line %d at item \"%s\".\n", s, yylineno, yytext); - return 0; -} -//----------------------------------------------------------------------------- -pTree pBuildTree(char* symbol,pTree A,pTree B,pTree C,pTree D,pTree E,pTree F, -pTree G, pTree H, pTree I, pTree J) { - - pTree ss = (pTree)calloc(1,sizeof(struct pTreeNode)); - - ss->symbol = symbol; - ss->symbolIndex = -1; - ss->children[0] = A; - ss->children[1] = B; - ss->children[2] = C; - ss->children[3] = D; - ss->children[4] = E; - ss->children[5] = F; - ss->children[6] = G; - ss->children[7] = H; - ss->children[8] = I; - ss->children[9] = J; - ss->children[10] = NULL; - - return ss; -} -//----------------------------------------------------------------------------- -pTree pToken(char* token, int symbolIndex) { - - //char pTokenBuf[8240]; - pTree ss; - //char* symbol = tptp_lval[symbolIndex]; - char* safeSym = 0; - - //strncpy(pTokenBuf, token, 39); - //strncat(pTokenBuf, symbol, 8193); - //safeSym = strdup(pTokenBuf); - ss = pBuildTree(safeSym,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); - ss->symbolIndex = symbolIndex; - - return ss; -} -//----------------------------------------------------------------------------- -void pPrintComments(int start, int depth) { - - int d, j; - char c1[4] = "%", c2[4] = "/*"; - - j = start; - while (tptp_lval[j] != NULL && (tptp_lval[j][0]==c1[0] || -(tptp_lval[j][0]==c2[0] && tptp_lval[j][1]==c2[1]))) { - for (d=0; d= 0) { - pPrintComments(pPrintIdx, 0); - pPrintIdx = -1; - } - if (ss == NULL) { - return; - } - for (d = 0; d < depth-1; d++) { - printf("| "); - } - printf("%1d ",depth % 10); - if (ss->children[0] == NULL) { - printf("%s\n", ss->symbol); - } else { - printf("<%s>\n", ss->symbol); - } - if (strcmp(ss->symbol, "PERIOD .") == 0) { - pPrintIdx = (ss->symbolIndex+1) % tptp_store_size; - } - if (ss->symbolIndex >= 0) { - pPrintComments((ss->symbolIndex+1) % tptp_store_size, depth); - } - i = 0; - while(ss->children[i] != NULL) { - pPrintTree(ss->children[i],depth+1); - i++; - } - return; -} -//----------------------------------------------------------------------------- -int yywrap(void) { - - P_PRINT(NULL); - return 1; -} -//----------------------------------------------------------------------------- - - -/* Line 189 of yacc.c */ -#line 219 "tptp5.tab.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - AMPERSAND = 258, - AT_SIGN = 259, - AT_SIGN_MINUS = 260, - AT_SIGN_PLUS = 261, - CARET = 262, - COLON = 263, - COLON_EQUALS = 264, - COMMA = 265, - EQUALS = 266, - EQUALS_GREATER = 267, - EXCLAMATION = 268, - EXCLAMATION_EQUALS = 269, - EXCLAMATION_EXCLAMATION = 270, - EXCLAMATION_GREATER = 271, - LBRKT = 272, - LESS_EQUALS = 273, - LESS_EQUALS_GREATER = 274, - LESS_TILDE_GREATER = 275, - LPAREN = 276, - MINUS = 277, - MINUS_MINUS_GREATER = 278, - PERIOD = 279, - QUESTION = 280, - QUESTION_QUESTION = 281, - QUESTION_STAR = 282, - RBRKT = 283, - RPAREN = 284, - STAR = 285, - TILDE = 286, - TILDE_AMPERSAND = 287, - TILDE_VLINE = 288, - VLINE = 289, - _DLR_cnf = 290, - _DLR_fof = 291, - _DLR_fot = 292, - _DLR_itef = 293, - _DLR_itetf = 294, - _DLR_itett = 295, - _DLR_tff = 296, - _DLR_thf = 297, - _LIT_cnf = 298, - _LIT_fof = 299, - _LIT_include = 300, - _LIT_tff = 301, - _LIT_thf = 302, - arrow = 303, - comment = 304, - comment_line = 305, - decimal = 306, - decimal_exponent = 307, - decimal_fraction = 308, - distinct_object = 309, - dollar_dollar_word = 310, - dollar_word = 311, - dot_decimal = 312, - integer = 313, - less_sign = 314, - lower_word = 315, - plus = 316, - positive_decimal = 317, - rational = 318, - real = 319, - signed_integer = 320, - signed_rational = 321, - signed_real = 322, - single_quoted = 323, - star = 324, - unrecognized = 325, - unsigned_integer = 326, - unsigned_rational = 327, - unsigned_real = 328, - upper_word = 329, - vline = 330 - }; -#endif - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ - -/* Line 214 of yacc.c */ -#line 148 "tptp5.y" -int ival; double dval; char* sval; TreeNode* pval; - - -/* Line 214 of yacc.c */ -#line 334 "tptp5.tab.c" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - - -/* Copy the second part of user declarations. */ - - -/* Line 264 of yacc.c */ -#line 346 "tptp5.tab.c" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; -#endif -{ - return yyi; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 3 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1612 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 76 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 141 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 281 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 523 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 330 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 5, 8, 10, 12, 14, 16, 18, - 20, 31, 42, 53, 64, 68, 70, 72, 74, 76, - 78, 80, 82, 84, 86, 88, 90, 94, 96, 98, - 100, 104, 108, 112, 116, 120, 124, 126, 128, 130, - 132, 134, 136, 140, 147, 149, 153, 155, 157, 161, - 166, 170, 172, 174, 178, 182, 184, 186, 188, 190, - 192, 196, 200, 204, 208, 212, 216, 218, 220, 223, - 227, 229, 233, 240, 242, 246, 250, 254, 263, 267, - 271, 273, 275, 277, 279, 281, 283, 285, 289, 291, - 293, 297, 301, 305, 309, 311, 313, 315, 317, 319, - 321, 325, 332, 334, 338, 340, 342, 346, 349, 351, - 355, 359, 361, 363, 365, 367, 369, 373, 375, 377, - 381, 385, 389, 393, 397, 404, 406, 410, 414, 419, - 423, 432, 436, 440, 442, 444, 446, 448, 450, 452, - 456, 458, 460, 464, 468, 472, 476, 478, 480, 482, - 484, 486, 488, 492, 499, 501, 505, 508, 510, 517, - 519, 523, 527, 532, 536, 545, 549, 553, 557, 559, - 561, 565, 567, 570, 572, 574, 576, 578, 582, 584, - 586, 588, 590, 592, 594, 596, 598, 600, 602, 604, - 606, 609, 611, 613, 615, 617, 619, 621, 623, 625, - 627, 629, 631, 633, 635, 637, 639, 641, 643, 645, - 647, 649, 653, 655, 657, 659, 661, 663, 665, 667, - 669, 671, 673, 675, 680, 682, 684, 686, 688, 690, - 692, 694, 696, 701, 703, 705, 707, 712, 714, 716, - 718, 720, 724, 733, 742, 744, 747, 749, 751, 758, - 763, 765, 767, 771, 773, 777, 779, 781, 786, 788, - 790, 792, 794, 799, 804, 809, 814, 819, 822, 826, - 828, 832, 834, 836, 838, 840, 842, 844, 846, 848, - 850, 852 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 77, 0, -1, 216, -1, 77, 78, -1, 79, -1, - 202, -1, 80, -1, 81, -1, 82, -1, 83, -1, - 47, 21, 210, 10, 85, 10, 86, 84, 29, 24, - -1, 46, 21, 210, 10, 85, 10, 117, 84, 29, - 24, -1, 44, 21, 210, 10, 85, 10, 142, 84, - 29, 24, -1, 43, 21, 210, 10, 85, 10, 158, - 84, 29, 24, -1, 10, 199, 200, -1, 216, -1, - 60, -1, 87, -1, 116, -1, 88, -1, 94, -1, - 100, -1, 102, -1, 89, -1, 90, -1, 105, -1, - 94, 164, 94, -1, 91, -1, 92, -1, 93, -1, - 94, 34, 94, -1, 91, 34, 94, -1, 94, 3, - 94, -1, 92, 3, 94, -1, 94, 4, 94, -1, - 93, 4, 94, -1, 95, -1, 99, -1, 109, -1, - 110, -1, 112, -1, 115, -1, 21, 87, 29, -1, - 163, 17, 96, 28, 8, 94, -1, 97, -1, 97, - 10, 96, -1, 98, -1, 196, -1, 196, 8, 103, - -1, 165, 21, 87, 29, -1, 101, 8, 103, -1, - 109, -1, 110, -1, 21, 87, 29, -1, 185, 166, - 185, -1, 87, -1, 94, -1, 106, -1, 107, -1, - 108, -1, 104, 48, 104, -1, 104, 48, 106, -1, - 104, 30, 104, -1, 107, 30, 104, -1, 104, 61, - 104, -1, 108, 61, 104, -1, 182, -1, 161, -1, - 17, 28, -1, 17, 111, 28, -1, 94, -1, 94, - 10, 111, -1, 9, 17, 113, 28, 8, 94, -1, - 114, -1, 114, 10, 113, -1, 97, 9, 87, -1, - 21, 114, 29, -1, 38, 21, 87, 10, 87, 10, - 87, 29, -1, 110, 171, 110, -1, 21, 116, 29, - -1, 118, -1, 130, -1, 141, -1, 119, -1, 124, - -1, 120, -1, 121, -1, 124, 168, 124, -1, 122, - -1, 123, -1, 124, 34, 124, -1, 122, 34, 124, - -1, 124, 3, 124, -1, 123, 3, 124, -1, 125, - -1, 129, -1, 173, -1, 137, -1, 196, -1, 140, - -1, 21, 118, 29, -1, 167, 17, 126, 28, 8, - 124, -1, 127, -1, 127, 10, 126, -1, 128, -1, - 196, -1, 196, 8, 134, -1, 170, 124, -1, 162, - -1, 131, 8, 132, -1, 21, 130, 29, -1, 186, - -1, 195, -1, 134, -1, 135, -1, 134, -1, 21, - 136, 29, -1, 211, -1, 172, -1, 133, 48, 134, - -1, 21, 135, 29, -1, 134, 30, 134, -1, 136, - 30, 134, -1, 21, 136, 29, -1, 9, 17, 138, - 28, 8, 124, -1, 139, -1, 139, 10, 138, -1, - 196, 9, 118, -1, 196, 8, 22, 182, -1, 21, - 139, 29, -1, 38, 21, 118, 10, 118, 10, 118, - 29, -1, 118, 171, 118, -1, 21, 141, 29, -1, - 143, -1, 157, -1, 144, -1, 149, -1, 145, -1, - 146, -1, 149, 168, 149, -1, 147, -1, 148, -1, - 149, 34, 149, -1, 147, 34, 149, -1, 149, 3, - 149, -1, 148, 3, 149, -1, 150, -1, 152, -1, - 173, -1, 153, -1, 196, -1, 156, -1, 21, 143, - 29, -1, 167, 17, 151, 28, 8, 149, -1, 196, - -1, 196, 10, 151, -1, 170, 149, -1, 162, -1, - 9, 17, 154, 28, 8, 149, -1, 155, -1, 155, - 10, 154, -1, 196, 9, 143, -1, 196, 8, 22, - 182, -1, 21, 155, 29, -1, 38, 21, 143, 10, - 143, 10, 143, 29, -1, 143, 171, 143, -1, 21, - 157, 29, -1, 21, 159, 29, -1, 159, -1, 160, - -1, 159, 34, 160, -1, 173, -1, 31, 173, -1, - 162, -1, 164, -1, 169, -1, 165, -1, 182, 180, - 182, -1, 167, -1, 7, -1, 16, -1, 27, -1, - 6, -1, 5, -1, 179, -1, 180, -1, 168, -1, - 170, -1, 15, -1, 26, -1, 59, 59, -1, 13, - -1, 25, -1, 19, -1, 12, -1, 18, -1, 20, - -1, 33, -1, 32, -1, 34, -1, 3, -1, 31, - -1, 23, -1, 212, -1, 174, -1, 175, -1, 181, - -1, 184, -1, 176, -1, 177, -1, 190, -1, 182, - 178, 182, -1, 179, -1, 11, -1, 14, -1, 193, - -1, 183, -1, 196, -1, 198, -1, 184, -1, 187, - -1, 193, -1, 185, -1, 186, 21, 197, 29, -1, - 186, -1, 211, -1, 188, -1, 189, -1, 214, -1, - 54, -1, 190, -1, 191, -1, 192, 21, 197, 29, - -1, 192, -1, 212, -1, 194, -1, 195, 21, 197, - 29, -1, 195, -1, 213, -1, 74, -1, 182, -1, - 182, 10, 197, -1, 40, 21, 118, 10, 182, 10, - 182, 29, -1, 39, 21, 143, 10, 182, 10, 182, - 29, -1, 205, -1, 10, 201, -1, 216, -1, 208, - -1, 45, 21, 215, 203, 29, 24, -1, 10, 17, - 204, 28, -1, 216, -1, 210, -1, 210, 10, 204, - -1, 206, -1, 206, 8, 205, -1, 208, -1, 211, - -1, 211, 21, 209, 29, -1, 196, -1, 214, -1, - 54, -1, 207, -1, 42, 21, 86, 29, -1, 41, - 21, 117, 29, -1, 36, 21, 142, 29, -1, 35, - 21, 158, 29, -1, 37, 21, 182, 29, -1, 17, - 28, -1, 17, 209, 28, -1, 205, -1, 205, 10, - 209, -1, 211, -1, 58, -1, 60, -1, 68, -1, - 56, -1, 55, -1, 58, -1, 63, -1, 64, -1, - 68, -1, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 225, 225, 226, 229, 230, 233, 234, 235, 236, - 239, 242, 245, 248, 251, 252, 255, 258, 259, 262, - 263, 264, 265, 268, 269, 270, 273, 276, 277, 278, - 281, 282, 285, 286, 289, 290, 293, 294, 295, 296, - 297, 298, 299, 302, 305, 306, 309, 310, 313, 316, - 319, 322, 323, 324, 327, 330, 333, 336, 337, 338, - 341, 342, 345, 346, 349, 350, 353, 354, 357, 358, - 361, 362, 365, 368, 369, 372, 373, 376, 379, 380, - 383, 384, 385, 388, 389, 392, 393, 396, 399, 400, - 403, 404, 407, 408, 411, 412, 413, 414, 415, 416, - 417, 420, 423, 424, 427, 428, 431, 434, 435, 438, - 439, 442, 443, 446, 447, 450, 451, 454, 455, 458, - 459, 462, 463, 464, 467, 470, 471, 474, 475, 476, - 479, 482, 483, 486, 487, 490, 491, 494, 495, 498, - 501, 502, 505, 506, 509, 510, 513, 514, 515, 516, - 517, 518, 519, 522, 525, 526, 529, 530, 533, 536, - 537, 540, 541, 542, 545, 548, 549, 552, 553, 556, - 557, 560, 561, 562, 565, 566, 567, 570, 573, 574, - 575, 576, 577, 578, 581, 582, 583, 586, 587, 588, - 591, 594, 595, 598, 599, 600, 601, 602, 603, 606, - 607, 610, 613, 616, 619, 620, 621, 624, 627, 628, - 631, 634, 637, 640, 643, 646, 649, 650, 651, 654, - 655, 656, 659, 660, 663, 666, 669, 670, 673, 674, - 677, 680, 681, 684, 687, 690, 691, 694, 697, 700, - 703, 704, 707, 708, 711, 714, 715, 718, 721, 724, - 725, 728, 729, 732, 733, 734, 737, 738, 739, 740, - 741, 742, 745, 746, 747, 748, 749, 752, 753, 756, - 757, 760, 761, 764, 765, 768, 771, 774, 775, 776, - 779, 782 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "AMPERSAND", "AT_SIGN", "AT_SIGN_MINUS", - "AT_SIGN_PLUS", "CARET", "COLON", "COLON_EQUALS", "COMMA", "EQUALS", - "EQUALS_GREATER", "EXCLAMATION", "EXCLAMATION_EQUALS", - "EXCLAMATION_EXCLAMATION", "EXCLAMATION_GREATER", "LBRKT", "LESS_EQUALS", - "LESS_EQUALS_GREATER", "LESS_TILDE_GREATER", "LPAREN", "MINUS", - "MINUS_MINUS_GREATER", "PERIOD", "QUESTION", "QUESTION_QUESTION", - "QUESTION_STAR", "RBRKT", "RPAREN", "STAR", "TILDE", "TILDE_AMPERSAND", - "TILDE_VLINE", "VLINE", "_DLR_cnf", "_DLR_fof", "_DLR_fot", "_DLR_itef", - "_DLR_itetf", "_DLR_itett", "_DLR_tff", "_DLR_thf", "_LIT_cnf", - "_LIT_fof", "_LIT_include", "_LIT_tff", "_LIT_thf", "arrow", "comment", - "comment_line", "decimal", "decimal_exponent", "decimal_fraction", - "distinct_object", "dollar_dollar_word", "dollar_word", "dot_decimal", - "integer", "less_sign", "lower_word", "plus", "positive_decimal", - "rational", "real", "signed_integer", "signed_rational", "signed_real", - "single_quoted", "star", "unrecognized", "unsigned_integer", - "unsigned_rational", "unsigned_real", "upper_word", "vline", "$accept", - "TPTP_file", "TPTP_input", "annotated_formula", "thf_annotated", - "tff_annotated", "fof_annotated", "cnf_annotated", "annotations", - "formula_role", "thf_formula", "thf_logic_formula", "thf_binary_formula", - "thf_binary_pair", "thf_binary_tuple", "thf_or_formula", - "thf_and_formula", "thf_apply_formula", "thf_unitary_formula", - "thf_quantified_formula", "thf_variable_list", "thf_variable", - "thf_typed_variable", "thf_unary_formula", "thf_type_formula", - "thf_typeable_formula", "thf_subtype", "thf_top_level_type", - "thf_unitary_type", "thf_binary_type", "thf_mapping_type", - "thf_xprod_type", "thf_union_type", "thf_atom", "thf_tuple", - "thf_tuple_list", "thf_let", "thf_let_list", "thf_defined_var", - "thf_conditional", "thf_sequent", "tff_formula", "tff_logic_formula", - "tff_binary_formula", "tff_binary_nonassoc", "tff_binary_assoc", - "tff_or_formula", "tff_and_formula", "tff_unitary_formula", - "tff_quantified_formula", "tff_variable_list", "tff_variable", - "tff_typed_variable", "tff_unary_formula", "tff_typed_atom", - "tff_untyped_atom", "tff_top_level_type", "tff_unitary_type", - "tff_atomic_type", "tff_mapping_type", "tff_xprod_type", "tff_let", - "tff_let_list", "tff_defined_var", "tff_conditional", "tff_sequent", - "fof_formula", "fof_logic_formula", "fof_binary_formula", - "fof_binary_nonassoc", "fof_binary_assoc", "fof_or_formula", - "fof_and_formula", "fof_unitary_formula", "fof_quantified_formula", - "fof_variable_list", "fof_unary_formula", "fof_let", "fof_let_list", - "fof_defined_var", "fof_conditional", "fof_sequent", "cnf_formula", - "disjunction", "literal", "thf_conn_term", "fol_infix_unary", - "thf_quantifier", "thf_pair_connective", "thf_unary_connective", - "subtype_sign", "fol_quantifier", "binary_connective", - "assoc_connective", "unary_connective", "gentzen_arrow", "defined_type", - "atomic_formula", "plain_atomic_formula", "defined_atomic_formula", - "defined_plain_formula", "defined_infix_formula", "defined_infix_pred", - "infix_equality", "infix_inequality", "system_atomic_formula", "term", - "function_term", "plain_term", "constant", "functor", "defined_term", - "defined_atom", "defined_atomic_term", "defined_plain_term", - "defined_constant", "defined_functor", "system_term", "system_constant", - "system_functor", "variable", "arguments", "conditional_term", "source", - "optional_info", "useful_info", "include", "formula_selection", - "name_list", "general_term", "general_data", "formula_data", - "general_list", "general_terms", "name", "atomic_word", - "atomic_defined_word", "atomic_system_word", "number", "file_name", - "null", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 76, 77, 77, 78, 78, 79, 79, 79, 79, - 80, 81, 82, 83, 84, 84, 85, 86, 86, 87, - 87, 87, 87, 88, 88, 88, 89, 90, 90, 90, - 91, 91, 92, 92, 93, 93, 94, 94, 94, 94, - 94, 94, 94, 95, 96, 96, 97, 97, 98, 99, - 100, 101, 101, 101, 102, 103, 104, 105, 105, 105, - 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, - 111, 111, 112, 113, 113, 114, 114, 115, 116, 116, - 117, 117, 117, 118, 118, 119, 119, 120, 121, 121, - 122, 122, 123, 123, 124, 124, 124, 124, 124, 124, - 124, 125, 126, 126, 127, 127, 128, 129, 129, 130, - 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, - 135, 136, 136, 136, 137, 138, 138, 139, 139, 139, - 140, 141, 141, 142, 142, 143, 143, 144, 144, 145, - 146, 146, 147, 147, 148, 148, 149, 149, 149, 149, - 149, 149, 149, 150, 151, 151, 152, 152, 153, 154, - 154, 155, 155, 155, 156, 157, 157, 158, 158, 159, - 159, 160, 160, 160, 161, 161, 161, 162, 163, 163, - 163, 163, 163, 163, 164, 164, 164, 165, 165, 165, - 166, 167, 167, 168, 168, 168, 168, 168, 168, 169, - 169, 170, 171, 172, 173, 173, 173, 174, 175, 175, - 176, 177, 178, 179, 180, 181, 182, 182, 182, 183, - 183, 183, 184, 184, 185, 186, 187, 187, 188, 188, - 189, 190, 190, 191, 192, 193, 193, 194, 195, 196, - 197, 197, 198, 198, 199, 200, 200, 201, 202, 203, - 203, 204, 204, 205, 205, 205, 206, 206, 206, 206, - 206, 206, 207, 207, 207, 207, 207, 208, 208, 209, - 209, 210, 210, 211, 211, 212, 213, 214, 214, 214, - 215, 216 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 2, 1, 1, 1, 1, 1, 1, - 10, 10, 10, 10, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, - 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, - 1, 1, 3, 6, 1, 3, 1, 1, 3, 4, - 3, 1, 1, 3, 3, 1, 1, 1, 1, 1, - 3, 3, 3, 3, 3, 3, 1, 1, 2, 3, - 1, 3, 6, 1, 3, 3, 3, 8, 3, 3, - 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, - 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, - 3, 6, 1, 3, 1, 1, 3, 2, 1, 3, - 3, 1, 1, 1, 1, 1, 3, 1, 1, 3, - 3, 3, 3, 3, 6, 1, 3, 3, 4, 3, - 8, 3, 3, 1, 1, 1, 1, 1, 1, 3, - 1, 1, 3, 3, 3, 3, 1, 1, 1, 1, - 1, 1, 3, 6, 1, 3, 2, 1, 6, 1, - 3, 3, 4, 3, 8, 3, 3, 3, 1, 1, - 3, 1, 2, 1, 1, 1, 1, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, - 1, 3, 8, 8, 1, 2, 1, 1, 6, 4, - 1, 1, 3, 1, 3, 1, 1, 4, 1, 1, - 1, 1, 4, 4, 4, 4, 4, 2, 3, 1, - 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint16 yydefact[] = -{ - 281, 0, 2, 1, 0, 0, 0, 0, 0, 3, - 4, 6, 7, 8, 9, 5, 0, 0, 0, 0, - 0, 272, 273, 274, 0, 271, 0, 280, 281, 0, - 0, 0, 0, 0, 0, 250, 0, 0, 16, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 251, 248, - 0, 0, 0, 0, 0, 0, 229, 276, 275, 277, - 278, 279, 239, 281, 168, 169, 173, 171, 204, 205, - 208, 209, 206, 0, 216, 207, 222, 224, 220, 226, - 227, 210, 231, 233, 215, 235, 237, 217, 218, 225, - 234, 238, 228, 0, 191, 0, 192, 201, 0, 281, - 133, 135, 137, 138, 140, 141, 136, 146, 147, 149, - 151, 134, 157, 0, 0, 148, 150, 249, 0, 0, - 0, 0, 281, 80, 83, 85, 86, 88, 89, 84, - 94, 95, 81, 0, 97, 99, 82, 108, 0, 0, - 96, 224, 237, 98, 200, 183, 182, 179, 0, 213, - 194, 214, 188, 180, 0, 195, 193, 196, 0, 189, - 181, 198, 197, 199, 0, 281, 17, 19, 23, 24, - 27, 28, 29, 20, 36, 37, 21, 0, 22, 0, - 25, 57, 58, 59, 38, 39, 40, 41, 18, 67, - 0, 174, 176, 178, 186, 175, 187, 184, 185, 66, - 219, 222, 230, 221, 0, 172, 0, 0, 0, 0, - 0, 15, 0, 0, 212, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 202, 0, 0, 0, 0, 0, - 0, 0, 0, 156, 252, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 107, 0, 0, 68, 70, 38, 39, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 167, 0, 0, 0, 0, 0, 0, 0, 0, 260, - 258, 281, 244, 253, 261, 255, 256, 259, 0, 170, - 211, 177, 240, 0, 0, 0, 0, 0, 159, 0, - 152, 166, 0, 0, 165, 143, 145, 144, 142, 139, - 0, 154, 0, 0, 0, 125, 0, 100, 110, 132, - 0, 0, 131, 91, 93, 92, 90, 87, 0, 109, - 0, 113, 114, 118, 117, 203, 0, 102, 104, 105, - 0, 0, 0, 46, 0, 73, 47, 0, 0, 39, - 0, 69, 42, 79, 0, 0, 31, 33, 35, 32, - 34, 30, 26, 55, 50, 56, 62, 60, 61, 64, - 63, 65, 78, 0, 44, 0, 190, 54, 224, 0, - 0, 267, 269, 0, 0, 0, 0, 0, 0, 0, - 14, 246, 0, 0, 13, 0, 223, 232, 236, 0, - 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, - 0, 0, 0, 0, 11, 0, 115, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 42, 71, - 0, 10, 0, 0, 49, 0, 0, 0, 268, 0, - 0, 0, 0, 0, 245, 247, 254, 0, 241, 163, - 0, 160, 0, 161, 0, 0, 155, 129, 0, 126, - 0, 127, 0, 0, 0, 120, 116, 0, 119, 0, - 103, 106, 76, 75, 0, 74, 48, 0, 0, 45, - 0, 0, 270, 265, 264, 266, 263, 262, 257, 158, - 162, 0, 153, 124, 128, 0, 123, 121, 122, 101, - 72, 0, 43, 0, 0, 0, 0, 0, 243, 242, - 164, 130, 77 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 1, 9, 10, 11, 12, 13, 14, 210, 39, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 383, 352, 353, 175, 176, 177, 178, 374, 179, 180, - 181, 182, 183, 255, 256, 257, 186, 354, 355, 187, - 188, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 346, 347, 348, 131, 132, 133, 339, 340, 426, 427, - 428, 134, 324, 325, 135, 136, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 320, 108, 109, 307, 308, - 110, 111, 63, 64, 65, 189, 112, 190, 191, 192, - 279, 193, 194, 195, 196, 225, 343, 115, 68, 69, - 70, 71, 213, 197, 198, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 303, 88, 291, 400, 454, 15, 34, 47, 392, - 293, 294, 295, 393, 48, 89, 90, 91, 92, 28, - 211 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -388 -static const yytype_int16 yypact[] = -{ - -388, 110, -388, -388, 12, 14, 26, 41, 46, -388, - -388, -388, -388, -388, -388, -388, -12, -12, 10, -12, - -12, -388, -388, -388, 72, -388, 74, -388, 84, 89, - 91, 52, 52, 104, 101, -388, 52, 52, -388, 132, - 141, -12, 145, 155, 164, 750, 32, 148, 174, -388, - 790, 1403, 594, 471, 177, 179, -388, -388, -388, -388, - -388, -388, -388, 201, 178, -388, -388, -388, -388, -388, - -388, -388, -388, 50, -388, 111, -388, 192, -388, -388, - -388, 127, -388, 193, 152, -388, 195, -388, -388, -388, - -388, -388, -388, 216, -388, 32, -388, -388, 214, 201, - 217, -388, -388, -388, 205, 238, 298, -388, -388, -388, - -388, -388, -388, 227, 1158, -388, 153, -388, -12, 228, - 790, 226, 201, 217, -388, -388, -388, 231, 259, 316, - -388, -388, -388, 258, -388, -388, -388, -388, 251, 1241, - -388, 19, 22, 153, -388, -388, -388, -388, 254, -388, - -388, -388, -388, -388, 1339, -388, -388, -388, 1403, -388, - -388, -388, -388, -388, 252, 201, -388, -388, -388, -388, - 240, 269, 272, 566, -388, -388, -388, 270, -388, -6, - -388, -388, 250, 220, 275, 21, -388, -388, -388, -388, - 267, -388, 268, -388, -388, -388, -388, -388, -388, -388, - -388, 234, -388, -388, 2, -388, 279, 1158, 1241, 1058, - 266, -388, 594, 471, -388, 471, 471, 471, 471, -1, - 3, 271, 1158, 274, -388, 1158, 1158, 1158, 1158, 1158, - 1158, 222, 1158, -388, -388, 0, 36, 276, 282, 1241, - 284, 1241, 1241, 1241, 1241, 1241, 1241, 29, 222, 1241, - -388, 1, 1467, -388, 287, -388, -388, 295, 285, 296, - 1467, 297, 1531, 1531, 1531, 1531, 1531, 1531, 1531, 1467, - 1531, 1531, 1531, 1531, 1531, 281, 222, 1467, 245, 23, - -388, 289, 314, 1538, 306, 308, 312, 317, 318, -388, - -388, 330, -388, 334, -388, -388, 326, -388, 331, -388, - -388, -388, 346, 329, 332, 335, -1, 337, 349, 183, - -388, -388, 353, 342, -388, -388, -388, -388, -388, -388, - 339, 358, 340, 0, 343, 360, 186, -388, -388, -388, - 362, 354, -388, -388, -388, -388, -388, -388, 77, -388, - 333, 345, -388, -388, -388, -388, 355, 369, -388, 380, - 365, 1, 387, -388, 370, 390, 389, 1467, 372, 396, - 1531, -388, 397, -388, 400, 382, -388, -388, -388, -388, - -388, -388, -388, -388, -388, -388, -388, 359, -388, -388, - -388, -388, -388, 383, 402, 385, -388, -388, -388, 471, - 471, -388, 408, 391, 750, 32, 471, 790, 1403, 404, - -388, -388, 1058, 1058, -388, 471, -388, -388, -388, 393, - 416, -1, 405, 1158, 1158, -388, 420, 222, 401, 421, - 0, 411, 1241, 1241, -388, 77, 412, 409, 167, -2, - 433, 222, -2, 418, 1467, 441, 1, 1467, -388, -388, - 1467, -388, 442, 222, -388, 443, 445, 1058, -388, 423, - 430, 431, 434, 435, -388, -388, -388, 436, -388, -388, - 1158, -388, 471, -388, 452, 1158, -388, -388, 1241, -388, - 471, -388, 457, 180, -2, -388, -388, -2, -388, 1241, - -388, -388, -388, -388, 1531, -388, -388, 458, 1531, -388, - 471, 471, -388, -388, -388, -388, -388, -388, -388, -388, - -388, 1158, -388, -388, -388, 1241, 424, -388, -388, -388, - -388, 1467, -388, 440, 444, 446, 449, 451, -388, -388, - -388, -388, -388 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -388, -388, -388, -388, -388, -388, -388, -388, -84, 99, - 96, -149, -388, -388, -388, -388, -388, -388, -85, -388, - 55, -253, -388, -388, -388, -388, -388, 58, -112, -388, - 235, -388, -388, 465, 17, 154, -388, 76, 162, -388, - 357, 120, -115, -388, -388, -388, -388, -388, -127, -388, - 87, -388, -388, -388, 399, -388, -388, -388, -168, 273, - 97, -388, 103, 198, -388, 410, 129, -93, -388, -388, - -388, -388, -388, -80, -388, 115, -388, -388, 122, 230, - -388, 447, 143, 488, 350, -388, 516, -388, 368, -388, - -388, 781, -78, -388, 842, -109, -388, 455, -388, -388, - -388, -388, -388, -54, 470, -388, -45, -388, -14, 351, - -43, -388, -388, -388, 219, -388, -388, 286, -388, -40, - 722, -200, -388, -388, -388, -388, -388, -388, 426, -196, - -388, -388, 165, -387, 88, -16, -195, -388, -160, -388, - 11 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -231 -static const yytype_int16 yytable[] = -{ - 25, 25, 220, 25, 25, 236, 199, 141, 206, 258, - 142, 2, 250, 292, 241, 223, 457, 304, 305, 214, - 306, 323, 351, 384, 270, 25, 224, -111, 230, -52, - -112, 280, 310, 16, 233, 17, 212, 200, 240, 35, - 216, 93, 271, 218, 224, 94, 21, 18, 22, 297, - 338, 246, 345, 95, 58, 272, 23, 96, 22, 224, - 492, 149, 19, 97, 151, 327, 23, 20, 185, 254, - 98, 54, 55, 62, 62, 62, 275, 141, 27, 341, - 142, 261, 31, 22, 32, 58, 56, 57, 58, 22, - 59, 23, 22, 282, 33, 60, 61, 23, 425, 36, - 23, 37, 25, 358, 24, 26, 62, 29, 30, 199, - 3, 364, 38, 199, 281, 333, 334, 335, 336, 337, - 373, 41, -219, 297, 330, -219, 332, 241, 385, 312, - 42, 40, 314, 58, 350, 43, 44, 22, -230, 322, - 200, -230, 45, 345, 200, 23, 315, 316, 317, 318, - 319, 46, 214, 4, 5, 6, 7, 8, 376, 377, - 379, 380, 381, -221, -217, 50, -221, -217, 300, 49, - 301, 302, 302, 302, 51, 185, 117, 366, 367, 368, - 369, 370, 371, 372, 118, 375, 375, 375, 375, 375, - 384, 412, 413, 296, 421, 422, 476, 477, 207, 200, - 208, 200, 200, 200, 200, 458, 456, 199, 258, 506, - 477, 209, 212, 216, 217, 199, 218, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 345, 344, 199, 219, 345, 222, 388, 345, 200, 226, - 224, 227, 297, 297, 231, 235, 200, 239, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 478, 243, 200, 481, 242, 247, 296, 248, 359, - 202, 251, 263, 260, 262, 254, 264, 359, 269, 345, - 273, 274, 345, -51, 276, 483, 359, 297, 373, 277, - 149, 487, 382, 278, 359, 298, 62, 360, 154, 389, - 311, 228, 401, 313, 386, 328, 507, 471, 472, 508, - 150, 329, 199, 331, 362, 199, 155, 156, 157, 244, - 463, 464, 344, 361, 390, 363, 365, 394, 150, 395, - 161, 162, 229, 396, 155, 156, 157, 203, 397, 398, - 399, 503, 402, 200, 445, 446, 200, 403, 161, 162, - 245, 451, 509, 199, 141, 404, 405, 142, 406, 411, - 302, 407, 517, 414, 408, 410, 415, 416, 417, 310, - 420, 419, 423, 202, 359, 200, 200, 202, 424, 431, - 499, 429, 200, 430, 200, 502, 296, 296, 432, 199, - 516, 200, 199, -115, 327, 199, 434, 437, 435, 510, - 436, 438, 201, 512, -52, -53, 441, 271, 515, 344, - 440, 442, 443, 344, 444, 185, 344, 500, 447, 448, - 200, 283, 459, 200, 460, 504, 200, 462, 465, 468, - 467, 296, 202, 470, 202, 202, 202, 202, 475, 199, - 203, 479, 474, 199, 203, 513, 514, 482, 200, 484, - 488, 359, 493, 490, 359, 491, 200, 359, 344, 494, - 495, 344, 501, 496, 497, 498, 199, 505, 511, 518, - 200, 202, -116, 519, 200, 520, 200, 200, 521, 202, - 522, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 453, 486, 202, 200, 489, 203, - 67, 203, 203, 203, 203, 140, 378, 67, 205, 201, - 54, 55, 485, 433, 439, 259, 184, 452, 480, 237, - 342, 418, 473, 469, 450, 56, 57, 58, 359, 59, - 238, 22, 466, 461, 60, 61, 409, 449, 203, 23, - 204, 268, 221, 215, 234, 62, 203, 0, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, - 203, 66, 299, 203, 455, 0, 137, 0, 66, 265, - 266, 0, 0, 0, 0, 140, 202, 149, 150, 202, - 151, 0, 0, 0, 155, 156, 157, 0, 0, 0, - 0, 0, 0, 0, 140, 0, -56, 0, 161, 162, - 267, 0, 0, 201, 0, 0, 0, 0, 202, 202, - 0, 201, 0, 0, -56, 202, 0, 202, 0, 0, - 201, 0, 0, 184, 202, 53, 0, -56, 201, 0, - 387, 0, 0, 54, 55, 0, 137, 0, 0, 0, - 0, 0, 0, 203, 0, 0, 203, 0, 56, 57, - 58, 0, 59, 202, 22, 137, 202, 60, 61, 202, - 0, 0, 23, 140, 0, 0, 0, 67, 62, 0, - 0, 0, 0, 0, 0, 203, 203, 0, 0, 0, - 0, 202, 203, 0, 203, 0, 0, 0, 0, 202, - 0, 203, 0, 0, 140, 0, 140, 140, 140, 140, - 140, 140, 0, 202, 140, 0, 0, 202, 201, 202, - 202, 0, 0, 0, 0, 0, 0, 184, 0, 0, - 203, 0, 0, 203, 137, 184, 203, 0, 66, 0, - 202, 0, 0, 0, 184, 0, 0, 0, 0, 0, - 0, 0, 184, 0, 0, 0, 0, 0, 203, 201, - 0, 0, 0, 0, 0, 137, 203, 137, 137, 137, - 137, 137, 137, 0, 0, 137, 0, 0, 116, 0, - 203, 52, 143, 0, 203, 0, 203, 203, 0, 0, - 0, 53, 0, 0, 0, 201, 0, 0, 201, 54, - 55, 201, 0, 0, 0, 0, 0, 203, 0, 119, - 0, 0, 0, 94, 56, 57, 58, 0, 59, 0, - 22, 120, 0, 60, 61, 96, 0, 116, 23, 0, - 0, 97, 184, 0, 62, 0, 0, 113, 121, 54, - 55, 138, 0, 0, 0, 0, 116, 0, 0, 0, - 0, 0, 143, 0, 56, 57, 58, 0, 59, 67, - 22, 0, 140, 60, 61, 0, 0, 0, 23, 0, - 0, 143, 201, 184, 62, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 113, 140, 140, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 114, 0, - 0, 0, 139, 0, 0, 113, 0, 0, 0, 184, - 0, 138, 184, 0, 0, 184, 0, 0, 0, 0, - 66, 0, 0, 137, 0, 0, 0, 0, 0, 0, - 138, 0, 0, 140, 0, 0, 0, 0, 0, 116, - 143, 290, 0, 0, 140, 0, 0, 114, 137, 137, - 0, 309, 0, 0, 116, 0, 0, 116, 116, 116, - 116, 116, 116, 321, 116, 0, 114, 326, 0, 0, - 140, 143, 139, 143, 143, 143, 143, 143, 143, 0, - 349, 143, 0, 356, 0, 0, 184, 0, 0, 0, - 0, 139, 0, 0, 137, 0, 0, 0, 113, 138, - 0, 0, 0, 0, 0, 137, 0, 0, 356, 0, - 0, 0, 0, 113, 0, 290, 113, 113, 113, 113, - 113, 113, 0, 113, 0, 0, 0, 0, 0, 0, - 138, 137, 138, 138, 138, 138, 138, 138, 309, 0, - 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 326, 0, 0, 0, 114, - 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 114, 0, 0, 114, 114, 114, - 114, 114, 114, 356, 114, 283, 0, 0, 0, 0, - 0, 139, 0, 139, 139, 139, 139, 139, 139, 0, - 0, 139, 0, 284, 285, 286, 0, 0, 0, 287, - 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 289, 0, 0, 0, 59, 116, 22, 143, - 0, 60, 61, 0, 290, 290, 23, 0, 0, 0, - 0, 0, 62, 309, 0, 116, 116, 0, 0, 321, - 0, 0, 326, 0, 143, 143, 0, 0, 0, 0, - 0, 0, 0, 349, 0, 0, 0, 0, 356, 0, - 0, 0, 0, 0, 0, 356, 0, 93, 0, 290, - 0, 94, 0, 0, 0, 0, 113, 0, 138, 232, - 0, 0, 116, 96, 0, 0, 0, 116, 0, 97, - 143, 0, 0, 0, 113, 113, 98, 54, 55, 0, - 0, 143, 0, 138, 138, 0, 0, 0, 0, 0, - 0, 0, 56, 57, 58, 0, 59, 0, 22, 0, - 0, 60, 61, 116, 0, 0, 23, 143, 0, 0, - 0, 0, 62, 0, 0, 0, 0, 114, 0, 139, - 0, 113, 0, 0, 0, 0, 113, 0, 0, 138, - 119, 0, 0, 0, 94, 114, 114, 0, 0, 0, - 138, 0, 249, 0, 139, 139, 96, 0, 0, 0, - 0, 0, 97, 0, 0, 0, 0, 0, 0, 121, - 54, 55, 113, 0, 0, 0, 138, 0, 0, 0, - 0, 0, 0, 0, 0, 56, 57, 58, 0, 59, - 0, 22, 114, 0, 60, 61, 0, 114, 0, 23, - 139, 0, 0, 0, 0, 62, 0, 0, 0, 0, - 0, 139, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 144, 114, 145, 146, 147, 139, 148, 0, - 149, 150, 94, 151, 152, 153, 154, 155, 156, 157, - 252, 0, 0, 0, 96, 159, 160, 253, 0, 0, - 97, 161, 162, 163, 0, 0, 0, 164, 54, 55, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 56, 57, 58, 0, 59, 0, 22, - 0, 0, 60, 61, 0, 0, 144, 23, 145, 146, - 147, 0, 148, 62, 149, 150, 94, 151, 152, 153, - 154, 155, 156, 157, 158, 0, 0, 0, 96, 159, - 160, 0, 0, 0, 97, 161, 162, 163, 0, 0, - 0, 164, 54, 55, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 56, 57, 58, - 0, 59, 0, 22, 0, 0, 60, 61, 0, 0, - 144, 23, 145, 146, 147, 0, 148, 62, 149, 150, - 94, 151, 152, 153, 154, 155, 156, 157, 357, 0, - 0, 0, 96, 159, 160, 0, 0, 0, 97, 161, - 162, 163, 0, 0, 0, 164, 54, 55, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 56, 57, 58, 0, 59, 0, 22, 0, 0, - 60, 61, 0, 0, 144, 23, 145, 146, 147, 0, - 148, 62, 149, 150, 94, 151, 152, 153, 154, 155, - 156, 157, 252, 0, 0, 283, 96, 159, 160, 0, - 0, 0, 97, 161, 162, 163, 391, 0, 0, 164, - 54, 55, 0, 284, 285, 286, 0, 0, 0, 287, - 288, 0, 0, 0, 0, 56, 57, 58, 0, 59, - 0, 22, 289, 0, 60, 61, 59, 0, 22, 23, - 0, 60, 61, 0, 0, 62, 23, 0, 0, 0, - 0, 0, 62 -}; - -static const yytype_int16 yycheck[] = -{ - 16, 17, 95, 19, 20, 120, 51, 50, 53, 158, - 50, 0, 139, 209, 123, 99, 403, 217, 218, 73, - 21, 21, 21, 276, 30, 41, 23, 8, 106, 8, - 8, 29, 29, 21, 114, 21, 34, 51, 122, 28, - 21, 9, 48, 21, 23, 13, 58, 21, 60, 209, - 21, 129, 247, 21, 56, 61, 68, 25, 60, 23, - 447, 11, 21, 31, 14, 29, 68, 21, 51, 154, - 38, 39, 40, 74, 74, 74, 185, 120, 68, 247, - 120, 165, 10, 60, 10, 56, 54, 55, 56, 60, - 58, 68, 60, 208, 10, 63, 64, 68, 21, 10, - 68, 10, 118, 252, 16, 17, 74, 19, 20, 154, - 0, 260, 60, 158, 207, 242, 243, 244, 245, 246, - 269, 17, 11, 283, 239, 14, 241, 236, 277, 222, - 29, 32, 225, 56, 249, 36, 37, 60, 11, 232, - 154, 14, 10, 338, 158, 68, 226, 227, 228, 229, - 230, 10, 206, 43, 44, 45, 46, 47, 270, 271, - 272, 273, 274, 11, 11, 10, 14, 14, 213, 24, - 215, 216, 217, 218, 10, 158, 28, 262, 263, 264, - 265, 266, 267, 268, 10, 270, 271, 272, 273, 274, - 443, 8, 9, 209, 8, 9, 29, 30, 21, 213, - 21, 215, 216, 217, 218, 405, 402, 252, 357, 29, - 30, 10, 34, 21, 21, 260, 21, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 425, 247, 277, 17, 429, 21, 279, 432, 252, 34, - 23, 3, 402, 403, 17, 17, 260, 21, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 429, 3, 277, 432, 34, 8, 283, 17, 252, - 51, 17, 3, 21, 34, 360, 4, 260, 8, 474, - 30, 61, 477, 8, 17, 434, 269, 447, 437, 21, - 11, 440, 275, 59, 277, 29, 74, 10, 17, 10, - 29, 3, 291, 29, 59, 29, 474, 422, 423, 477, - 12, 29, 357, 29, 29, 360, 18, 19, 20, 3, - 413, 414, 338, 28, 10, 29, 29, 21, 12, 21, - 32, 33, 34, 21, 18, 19, 20, 51, 21, 21, - 10, 468, 8, 357, 389, 390, 360, 21, 32, 33, - 34, 396, 479, 398, 397, 24, 10, 397, 29, 10, - 405, 29, 511, 10, 29, 28, 24, 28, 10, 29, - 10, 28, 10, 154, 357, 389, 390, 158, 24, 10, - 460, 48, 396, 28, 398, 465, 402, 403, 8, 434, - 505, 405, 437, 48, 29, 440, 9, 8, 28, 484, - 10, 29, 51, 488, 8, 8, 24, 48, 501, 425, - 10, 28, 10, 429, 29, 398, 432, 462, 10, 28, - 434, 17, 29, 437, 8, 470, 440, 22, 8, 8, - 29, 447, 213, 22, 215, 216, 217, 218, 29, 484, - 154, 8, 30, 488, 158, 490, 491, 29, 462, 8, - 8, 434, 29, 10, 437, 10, 470, 440, 474, 29, - 29, 477, 10, 29, 29, 29, 511, 10, 10, 29, - 484, 252, 48, 29, 488, 29, 490, 491, 29, 260, - 29, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 398, 437, 277, 511, 443, 213, - 45, 215, 216, 217, 218, 50, 271, 52, 53, 158, - 39, 40, 436, 351, 360, 158, 51, 397, 431, 120, - 247, 323, 425, 420, 395, 54, 55, 56, 511, 58, - 120, 60, 417, 411, 63, 64, 306, 394, 252, 68, - 52, 173, 95, 73, 118, 74, 260, -1, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 45, 212, 277, 399, -1, 50, -1, 52, 3, - 4, -1, -1, -1, -1, 120, 357, 11, 12, 360, - 14, -1, -1, -1, 18, 19, 20, -1, -1, -1, - -1, -1, -1, -1, 139, -1, 30, -1, 32, 33, - 34, -1, -1, 252, -1, -1, -1, -1, 389, 390, - -1, 260, -1, -1, 48, 396, -1, 398, -1, -1, - 269, -1, -1, 158, 405, 31, -1, 61, 277, -1, - 279, -1, -1, 39, 40, -1, 120, -1, -1, -1, - -1, -1, -1, 357, -1, -1, 360, -1, 54, 55, - 56, -1, 58, 434, 60, 139, 437, 63, 64, 440, - -1, -1, 68, 208, -1, -1, -1, 212, 74, -1, - -1, -1, -1, -1, -1, 389, 390, -1, -1, -1, - -1, 462, 396, -1, 398, -1, -1, -1, -1, 470, - -1, 405, -1, -1, 239, -1, 241, 242, 243, 244, - 245, 246, -1, 484, 249, -1, -1, 488, 357, 490, - 491, -1, -1, -1, -1, -1, -1, 252, -1, -1, - 434, -1, -1, 437, 208, 260, 440, -1, 212, -1, - 511, -1, -1, -1, 269, -1, -1, -1, -1, -1, - -1, -1, 277, -1, -1, -1, -1, -1, 462, 398, - -1, -1, -1, -1, -1, 239, 470, 241, 242, 243, - 244, 245, 246, -1, -1, 249, -1, -1, 46, -1, - 484, 21, 50, -1, 488, -1, 490, 491, -1, -1, - -1, 31, -1, -1, -1, 434, -1, -1, 437, 39, - 40, 440, -1, -1, -1, -1, -1, 511, -1, 9, - -1, -1, -1, 13, 54, 55, 56, -1, 58, -1, - 60, 21, -1, 63, 64, 25, -1, 95, 68, -1, - -1, 31, 357, -1, 74, -1, -1, 46, 38, 39, - 40, 50, -1, -1, -1, -1, 114, -1, -1, -1, - -1, -1, 120, -1, 54, 55, 56, -1, 58, 394, - 60, -1, 397, 63, 64, -1, -1, -1, 68, -1, - -1, 139, 511, 398, 74, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 95, 422, 423, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, - -1, -1, 50, -1, -1, 114, -1, -1, -1, 434, - -1, 120, 437, -1, -1, 440, -1, -1, -1, -1, - 394, -1, -1, 397, -1, -1, -1, -1, -1, -1, - 139, -1, -1, 468, -1, -1, -1, -1, -1, 207, - 208, 209, -1, -1, 479, -1, -1, 95, 422, 423, - -1, 219, -1, -1, 222, -1, -1, 225, 226, 227, - 228, 229, 230, 231, 232, -1, 114, 235, -1, -1, - 505, 239, 120, 241, 242, 243, 244, 245, 246, -1, - 248, 249, -1, 251, -1, -1, 511, -1, -1, -1, - -1, 139, -1, -1, 468, -1, -1, -1, 207, 208, - -1, -1, -1, -1, -1, 479, -1, -1, 276, -1, - -1, -1, -1, 222, -1, 283, 225, 226, 227, 228, - 229, 230, -1, 232, -1, -1, -1, -1, -1, -1, - 239, 505, 241, 242, 243, 244, 245, 246, 306, -1, - 249, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 323, -1, -1, -1, 207, - 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 222, -1, -1, 225, 226, 227, - 228, 229, 230, 351, 232, 17, -1, -1, -1, -1, - -1, 239, -1, 241, 242, 243, 244, 245, 246, -1, - -1, 249, -1, 35, 36, 37, -1, -1, -1, 41, - 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 54, -1, -1, -1, 58, 395, 60, 397, - -1, 63, 64, -1, 402, 403, 68, -1, -1, -1, - -1, -1, 74, 411, -1, 413, 414, -1, -1, 417, - -1, -1, 420, -1, 422, 423, -1, -1, -1, -1, - -1, -1, -1, 431, -1, -1, -1, -1, 436, -1, - -1, -1, -1, -1, -1, 443, -1, 9, -1, 447, - -1, 13, -1, -1, -1, -1, 395, -1, 397, 21, - -1, -1, 460, 25, -1, -1, -1, 465, -1, 31, - 468, -1, -1, -1, 413, 414, 38, 39, 40, -1, - -1, 479, -1, 422, 423, -1, -1, -1, -1, -1, - -1, -1, 54, 55, 56, -1, 58, -1, 60, -1, - -1, 63, 64, 501, -1, -1, 68, 505, -1, -1, - -1, -1, 74, -1, -1, -1, -1, 395, -1, 397, - -1, 460, -1, -1, -1, -1, 465, -1, -1, 468, - 9, -1, -1, -1, 13, 413, 414, -1, -1, -1, - 479, -1, 21, -1, 422, 423, 25, -1, -1, -1, - -1, -1, 31, -1, -1, -1, -1, -1, -1, 38, - 39, 40, 501, -1, -1, -1, 505, -1, -1, -1, - -1, -1, -1, -1, -1, 54, 55, 56, -1, 58, - -1, 60, 460, -1, 63, 64, -1, 465, -1, 68, - 468, -1, -1, -1, -1, 74, -1, -1, -1, -1, - -1, 479, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 3, 501, 5, 6, 7, 505, 9, -1, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, -1, -1, -1, 25, 26, 27, 28, -1, -1, - 31, 32, 33, 34, -1, -1, -1, 38, 39, 40, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 54, 55, 56, -1, 58, -1, 60, - -1, -1, 63, 64, -1, -1, 3, 68, 5, 6, - 7, -1, 9, 74, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, -1, -1, -1, 25, 26, - 27, -1, -1, -1, 31, 32, 33, 34, -1, -1, - -1, 38, 39, 40, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 54, 55, 56, - -1, 58, -1, 60, -1, -1, 63, 64, -1, -1, - 3, 68, 5, 6, 7, -1, 9, 74, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, - -1, -1, 25, 26, 27, -1, -1, -1, 31, 32, - 33, 34, -1, -1, -1, 38, 39, 40, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 54, 55, 56, -1, 58, -1, 60, -1, -1, - 63, 64, -1, -1, 3, 68, 5, 6, 7, -1, - 9, 74, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, -1, -1, 17, 25, 26, 27, -1, - -1, -1, 31, 32, 33, 34, 28, -1, -1, 38, - 39, 40, -1, 35, 36, 37, -1, -1, -1, 41, - 42, -1, -1, -1, -1, 54, 55, 56, -1, 58, - -1, 60, 54, -1, 63, 64, 58, -1, 60, 68, - -1, 63, 64, -1, -1, 74, 68, -1, -1, -1, - -1, -1, 74 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 77, 216, 0, 43, 44, 45, 46, 47, 78, - 79, 80, 81, 82, 83, 202, 21, 21, 21, 21, - 21, 58, 60, 68, 210, 211, 210, 68, 215, 210, - 210, 10, 10, 10, 203, 216, 10, 10, 60, 85, - 85, 17, 29, 85, 85, 10, 10, 204, 210, 24, - 10, 10, 21, 31, 39, 40, 54, 55, 56, 58, - 63, 64, 74, 158, 159, 160, 162, 173, 174, 175, - 176, 177, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 198, 211, - 212, 213, 214, 9, 13, 21, 25, 31, 38, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 152, 153, - 156, 157, 162, 167, 170, 173, 196, 28, 10, 9, - 21, 38, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 129, 130, 131, 137, 140, 141, 162, 167, 170, - 173, 186, 195, 196, 3, 5, 6, 7, 9, 11, - 12, 14, 15, 16, 17, 18, 19, 20, 21, 26, - 27, 32, 33, 34, 38, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 99, 100, 101, 102, 104, - 105, 106, 107, 108, 109, 110, 112, 115, 116, 161, - 163, 164, 165, 167, 168, 169, 170, 179, 180, 182, - 184, 185, 190, 193, 159, 173, 182, 21, 21, 10, - 84, 216, 34, 178, 179, 180, 21, 21, 21, 17, - 143, 157, 21, 84, 23, 171, 34, 3, 3, 34, - 168, 17, 21, 149, 204, 17, 118, 130, 141, 21, - 84, 171, 34, 3, 3, 34, 168, 8, 17, 21, - 124, 17, 21, 28, 94, 109, 110, 111, 87, 116, - 21, 84, 34, 3, 4, 3, 4, 34, 164, 8, - 30, 48, 61, 30, 61, 171, 17, 21, 59, 166, - 29, 143, 118, 17, 35, 36, 37, 41, 42, 54, - 196, 199, 205, 206, 207, 208, 211, 214, 29, 160, - 182, 182, 182, 197, 197, 197, 21, 154, 155, 196, - 29, 29, 143, 29, 143, 149, 149, 149, 149, 149, - 151, 196, 143, 21, 138, 139, 196, 29, 29, 29, - 118, 29, 118, 124, 124, 124, 124, 124, 21, 132, - 133, 134, 135, 172, 211, 212, 126, 127, 128, 196, - 118, 21, 97, 98, 113, 114, 196, 21, 87, 110, - 10, 28, 29, 29, 87, 29, 94, 94, 94, 94, - 94, 94, 94, 87, 103, 94, 104, 104, 106, 104, - 104, 104, 110, 96, 97, 87, 59, 185, 186, 10, - 10, 28, 205, 209, 21, 21, 21, 21, 21, 10, - 200, 216, 8, 21, 24, 10, 29, 29, 29, 155, - 28, 10, 8, 9, 10, 24, 28, 10, 139, 28, - 10, 8, 9, 10, 24, 21, 134, 135, 136, 48, - 28, 10, 8, 114, 9, 28, 10, 8, 29, 111, - 10, 24, 28, 10, 29, 182, 182, 10, 28, 158, - 142, 182, 117, 86, 201, 208, 205, 209, 197, 29, - 8, 154, 22, 143, 143, 8, 151, 29, 8, 138, - 22, 118, 118, 136, 30, 29, 29, 30, 134, 8, - 126, 134, 29, 87, 8, 113, 103, 87, 8, 96, - 10, 10, 209, 29, 29, 29, 29, 29, 29, 149, - 182, 10, 149, 124, 182, 10, 29, 134, 134, 124, - 94, 10, 94, 182, 182, 143, 118, 87, 29, 29, - 29, 29, 29 -}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ - - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - -#if 0 - switch (yytype) - { - - default: - break; - } -#endif -} - -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: - -/* Line 1464 of yacc.c */ -#line 225 "tptp5.y" - {;} - break; - - case 3: - -/* Line 1464 of yacc.c */ -#line 226 "tptp5.y" - {;} - break; - - case 4: - -/* Line 1464 of yacc.c */ -#line 229 "tptp5.y" - {P_PRINT((yyval.pval));;} - break; - - case 5: - -/* Line 1464 of yacc.c */ -#line 230 "tptp5.y" - {P_PRINT((yyval.pval));;} - break; - - case 6: - -/* Line 1464 of yacc.c */ -#line 233 "tptp5.y" - {(yyval.pval) = P_BUILD("annotated_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 7: - -/* Line 1464 of yacc.c */ -#line 234 "tptp5.y" - {(yyval.pval) = P_BUILD("annotated_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 8: - -/* Line 1464 of yacc.c */ -#line 235 "tptp5.y" - {(yyval.pval) = P_BUILD("annotated_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 9: - -/* Line 1464 of yacc.c */ -#line 236 "tptp5.y" - {(yyval.pval) = P_BUILD("annotated_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 10: - -/* Line 1464 of yacc.c */ -#line 239 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_annotated", P_TOKEN("_LIT_thf ", (yyvsp[(1) - (10)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (10)].ival)), (yyvsp[(3) - (10)].pval), P_TOKEN("COMMA ", (yyvsp[(4) - (10)].ival)), (yyvsp[(5) - (10)].pval), P_TOKEN("COMMA ", (yyvsp[(6) - (10)].ival)), (yyvsp[(7) - (10)].pval), (yyvsp[(8) - (10)].pval), P_TOKEN("RPAREN ", (yyvsp[(9) - (10)].ival)), P_TOKEN("PERIOD ", (yyvsp[(10) - (10)].ival)));;} - break; - - case 11: - -/* Line 1464 of yacc.c */ -#line 242 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_annotated", P_TOKEN("_LIT_tff ", (yyvsp[(1) - (10)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (10)].ival)), (yyvsp[(3) - (10)].pval), P_TOKEN("COMMA ", (yyvsp[(4) - (10)].ival)), (yyvsp[(5) - (10)].pval), P_TOKEN("COMMA ", (yyvsp[(6) - (10)].ival)), (yyvsp[(7) - (10)].pval), (yyvsp[(8) - (10)].pval), P_TOKEN("RPAREN ", (yyvsp[(9) - (10)].ival)), P_TOKEN("PERIOD ", (yyvsp[(10) - (10)].ival)));;} - break; - - case 12: - -/* Line 1464 of yacc.c */ -#line 245 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_annotated", P_TOKEN("_LIT_fof ", (yyvsp[(1) - (10)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (10)].ival)), (yyvsp[(3) - (10)].pval), P_TOKEN("COMMA ", (yyvsp[(4) - (10)].ival)), (yyvsp[(5) - (10)].pval), P_TOKEN("COMMA ", (yyvsp[(6) - (10)].ival)), (yyvsp[(7) - (10)].pval), (yyvsp[(8) - (10)].pval), P_TOKEN("RPAREN ", (yyvsp[(9) - (10)].ival)), P_TOKEN("PERIOD ", (yyvsp[(10) - (10)].ival)));;} - break; - - case 13: - -/* Line 1464 of yacc.c */ -#line 248 "tptp5.y" - {(yyval.pval) = P_BUILD("cnf_annotated", P_TOKEN("_LIT_cnf ", (yyvsp[(1) - (10)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (10)].ival)), (yyvsp[(3) - (10)].pval), P_TOKEN("COMMA ", (yyvsp[(4) - (10)].ival)), (yyvsp[(5) - (10)].pval), P_TOKEN("COMMA ", (yyvsp[(6) - (10)].ival)), (yyvsp[(7) - (10)].pval), (yyvsp[(8) - (10)].pval), P_TOKEN("RPAREN ", (yyvsp[(9) - (10)].ival)), P_TOKEN("PERIOD ", (yyvsp[(10) - (10)].ival)));;} - break; - - case 14: - -/* Line 1464 of yacc.c */ -#line 251 "tptp5.y" - {(yyval.pval) = P_BUILD("annotations", P_TOKEN("COMMA ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 15: - -/* Line 1464 of yacc.c */ -#line 252 "tptp5.y" - {(yyval.pval) = P_BUILD("annotations", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 16: - -/* Line 1464 of yacc.c */ -#line 255 "tptp5.y" - {(yyval.pval) = P_BUILD("formula_role", P_TOKEN("lower_word ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 17: - -/* Line 1464 of yacc.c */ -#line 258 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 18: - -/* Line 1464 of yacc.c */ -#line 259 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 19: - -/* Line 1464 of yacc.c */ -#line 262 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_logic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 20: - -/* Line 1464 of yacc.c */ -#line 263 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_logic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 21: - -/* Line 1464 of yacc.c */ -#line 264 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_logic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 22: - -/* Line 1464 of yacc.c */ -#line 265 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_logic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 23: - -/* Line 1464 of yacc.c */ -#line 268 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_binary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 24: - -/* Line 1464 of yacc.c */ -#line 269 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_binary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 25: - -/* Line 1464 of yacc.c */ -#line 270 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_binary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 26: - -/* Line 1464 of yacc.c */ -#line 273 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_binary_pair", (yyvsp[(1) - (3)].pval), (yyvsp[(2) - (3)].pval), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 27: - -/* Line 1464 of yacc.c */ -#line 276 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_binary_tuple", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 28: - -/* Line 1464 of yacc.c */ -#line 277 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_binary_tuple", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 29: - -/* Line 1464 of yacc.c */ -#line 278 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_binary_tuple", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 30: - -/* Line 1464 of yacc.c */ -#line 281 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_or_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("VLINE ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 31: - -/* Line 1464 of yacc.c */ -#line 282 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_or_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("VLINE ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 32: - -/* Line 1464 of yacc.c */ -#line 285 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_and_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("AMPERSAND ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 33: - -/* Line 1464 of yacc.c */ -#line 286 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_and_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("AMPERSAND ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 34: - -/* Line 1464 of yacc.c */ -#line 289 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_apply_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("AT_SIGN ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 35: - -/* Line 1464 of yacc.c */ -#line 290 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_apply_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("AT_SIGN ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 36: - -/* Line 1464 of yacc.c */ -#line 293 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 37: - -/* Line 1464 of yacc.c */ -#line 294 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 38: - -/* Line 1464 of yacc.c */ -#line 295 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 39: - -/* Line 1464 of yacc.c */ -#line 296 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 40: - -/* Line 1464 of yacc.c */ -#line 297 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 41: - -/* Line 1464 of yacc.c */ -#line 298 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 42: - -/* Line 1464 of yacc.c */ -#line 299 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unitary_formula", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 43: - -/* Line 1464 of yacc.c */ -#line 302 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_quantified_formula", (yyvsp[(1) - (6)].pval), P_TOKEN("LBRKT ", (yyvsp[(2) - (6)].ival)), (yyvsp[(3) - (6)].pval), P_TOKEN("RBRKT ", (yyvsp[(4) - (6)].ival)), P_TOKEN("COLON ", (yyvsp[(5) - (6)].ival)), (yyvsp[(6) - (6)].pval),NULL,NULL,NULL,NULL);;} - break; - - case 44: - -/* Line 1464 of yacc.c */ -#line 305 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_variable_list", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 45: - -/* Line 1464 of yacc.c */ -#line 306 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_variable_list", (yyvsp[(1) - (3)].pval), P_TOKEN("COMMA ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 46: - -/* Line 1464 of yacc.c */ -#line 309 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_variable", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 47: - -/* Line 1464 of yacc.c */ -#line 310 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_variable", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 48: - -/* Line 1464 of yacc.c */ -#line 313 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_typed_variable", (yyvsp[(1) - (3)].pval), P_TOKEN("COLON ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 49: - -/* Line 1464 of yacc.c */ -#line 316 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unary_formula", (yyvsp[(1) - (4)].pval), P_TOKEN("LPAREN ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RPAREN ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 50: - -/* Line 1464 of yacc.c */ -#line 319 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_type_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("COLON ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 51: - -/* Line 1464 of yacc.c */ -#line 322 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_typeable_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 52: - -/* Line 1464 of yacc.c */ -#line 323 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_typeable_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 53: - -/* Line 1464 of yacc.c */ -#line 324 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_typeable_formula", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 54: - -/* Line 1464 of yacc.c */ -#line 327 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_subtype", (yyvsp[(1) - (3)].pval), (yyvsp[(2) - (3)].pval), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 55: - -/* Line 1464 of yacc.c */ -#line 330 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_top_level_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 56: - -/* Line 1464 of yacc.c */ -#line 333 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unitary_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 57: - -/* Line 1464 of yacc.c */ -#line 336 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_binary_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 58: - -/* Line 1464 of yacc.c */ -#line 337 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_binary_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 59: - -/* Line 1464 of yacc.c */ -#line 338 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_binary_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 60: - -/* Line 1464 of yacc.c */ -#line 341 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_mapping_type", (yyvsp[(1) - (3)].pval), P_TOKEN("arrow ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 61: - -/* Line 1464 of yacc.c */ -#line 342 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_mapping_type", (yyvsp[(1) - (3)].pval), P_TOKEN("arrow ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 62: - -/* Line 1464 of yacc.c */ -#line 345 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_xprod_type", (yyvsp[(1) - (3)].pval), P_TOKEN("STAR ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 63: - -/* Line 1464 of yacc.c */ -#line 346 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_xprod_type", (yyvsp[(1) - (3)].pval), P_TOKEN("STAR ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 64: - -/* Line 1464 of yacc.c */ -#line 349 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_union_type", (yyvsp[(1) - (3)].pval), P_TOKEN("plus ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 65: - -/* Line 1464 of yacc.c */ -#line 350 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_union_type", (yyvsp[(1) - (3)].pval), P_TOKEN("plus ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 66: - -/* Line 1464 of yacc.c */ -#line 353 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_atom", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 67: - -/* Line 1464 of yacc.c */ -#line 354 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_atom", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 68: - -/* Line 1464 of yacc.c */ -#line 357 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_tuple", P_TOKEN("LBRKT ", (yyvsp[(1) - (2)].ival)), P_TOKEN("RBRKT ", (yyvsp[(2) - (2)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 69: - -/* Line 1464 of yacc.c */ -#line 358 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_tuple", P_TOKEN("LBRKT ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RBRKT ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 70: - -/* Line 1464 of yacc.c */ -#line 361 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_tuple_list", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 71: - -/* Line 1464 of yacc.c */ -#line 362 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_tuple_list", (yyvsp[(1) - (3)].pval), P_TOKEN("COMMA ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 72: - -/* Line 1464 of yacc.c */ -#line 365 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_let", P_TOKEN("COLON_EQUALS ", (yyvsp[(1) - (6)].ival)), P_TOKEN("LBRKT ", (yyvsp[(2) - (6)].ival)), (yyvsp[(3) - (6)].pval), P_TOKEN("RBRKT ", (yyvsp[(4) - (6)].ival)), P_TOKEN("COLON ", (yyvsp[(5) - (6)].ival)), (yyvsp[(6) - (6)].pval),NULL,NULL,NULL,NULL);;} - break; - - case 73: - -/* Line 1464 of yacc.c */ -#line 368 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_let_list", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 74: - -/* Line 1464 of yacc.c */ -#line 369 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_let_list", (yyvsp[(1) - (3)].pval), P_TOKEN("COMMA ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 75: - -/* Line 1464 of yacc.c */ -#line 372 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_defined_var", (yyvsp[(1) - (3)].pval), P_TOKEN("COLON_EQUALS ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 76: - -/* Line 1464 of yacc.c */ -#line 373 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_defined_var", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 77: - -/* Line 1464 of yacc.c */ -#line 376 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_conditional", P_TOKEN("_DLR_itef ", (yyvsp[(1) - (8)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (8)].ival)), (yyvsp[(3) - (8)].pval), P_TOKEN("COMMA ", (yyvsp[(4) - (8)].ival)), (yyvsp[(5) - (8)].pval), P_TOKEN("COMMA ", (yyvsp[(6) - (8)].ival)), (yyvsp[(7) - (8)].pval), P_TOKEN("RPAREN ", (yyvsp[(8) - (8)].ival)),NULL,NULL);;} - break; - - case 78: - -/* Line 1464 of yacc.c */ -#line 379 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_sequent", (yyvsp[(1) - (3)].pval), (yyvsp[(2) - (3)].pval), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 79: - -/* Line 1464 of yacc.c */ -#line 380 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_sequent", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 80: - -/* Line 1464 of yacc.c */ -#line 383 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 81: - -/* Line 1464 of yacc.c */ -#line 384 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 82: - -/* Line 1464 of yacc.c */ -#line 385 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 83: - -/* Line 1464 of yacc.c */ -#line 388 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_logic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 84: - -/* Line 1464 of yacc.c */ -#line 389 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_logic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 85: - -/* Line 1464 of yacc.c */ -#line 392 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_binary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 86: - -/* Line 1464 of yacc.c */ -#line 393 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_binary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 87: - -/* Line 1464 of yacc.c */ -#line 396 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_binary_nonassoc", (yyvsp[(1) - (3)].pval), (yyvsp[(2) - (3)].pval), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 88: - -/* Line 1464 of yacc.c */ -#line 399 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_binary_assoc", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 89: - -/* Line 1464 of yacc.c */ -#line 400 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_binary_assoc", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 90: - -/* Line 1464 of yacc.c */ -#line 403 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_or_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("VLINE ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 91: - -/* Line 1464 of yacc.c */ -#line 404 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_or_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("VLINE ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 92: - -/* Line 1464 of yacc.c */ -#line 407 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_and_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("AMPERSAND ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 93: - -/* Line 1464 of yacc.c */ -#line 408 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_and_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("AMPERSAND ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 94: - -/* Line 1464 of yacc.c */ -#line 411 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 95: - -/* Line 1464 of yacc.c */ -#line 412 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 96: - -/* Line 1464 of yacc.c */ -#line 413 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 97: - -/* Line 1464 of yacc.c */ -#line 414 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 98: - -/* Line 1464 of yacc.c */ -#line 415 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 99: - -/* Line 1464 of yacc.c */ -#line 416 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 100: - -/* Line 1464 of yacc.c */ -#line 417 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unitary_formula", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 101: - -/* Line 1464 of yacc.c */ -#line 420 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_quantified_formula", (yyvsp[(1) - (6)].pval), P_TOKEN("LBRKT ", (yyvsp[(2) - (6)].ival)), (yyvsp[(3) - (6)].pval), P_TOKEN("RBRKT ", (yyvsp[(4) - (6)].ival)), P_TOKEN("COLON ", (yyvsp[(5) - (6)].ival)), (yyvsp[(6) - (6)].pval),NULL,NULL,NULL,NULL);;} - break; - - case 102: - -/* Line 1464 of yacc.c */ -#line 423 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_variable_list", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 103: - -/* Line 1464 of yacc.c */ -#line 424 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_variable_list", (yyvsp[(1) - (3)].pval), P_TOKEN("COMMA ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 104: - -/* Line 1464 of yacc.c */ -#line 427 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_variable", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 105: - -/* Line 1464 of yacc.c */ -#line 428 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_variable", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 106: - -/* Line 1464 of yacc.c */ -#line 431 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_typed_variable", (yyvsp[(1) - (3)].pval), P_TOKEN("COLON ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 107: - -/* Line 1464 of yacc.c */ -#line 434 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unary_formula", (yyvsp[(1) - (2)].pval), (yyvsp[(2) - (2)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 108: - -/* Line 1464 of yacc.c */ -#line 435 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 109: - -/* Line 1464 of yacc.c */ -#line 438 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_typed_atom", (yyvsp[(1) - (3)].pval), P_TOKEN("COLON ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 110: - -/* Line 1464 of yacc.c */ -#line 439 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_typed_atom", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 111: - -/* Line 1464 of yacc.c */ -#line 442 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_untyped_atom", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 112: - -/* Line 1464 of yacc.c */ -#line 443 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_untyped_atom", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 113: - -/* Line 1464 of yacc.c */ -#line 446 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_top_level_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 114: - -/* Line 1464 of yacc.c */ -#line 447 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_top_level_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 115: - -/* Line 1464 of yacc.c */ -#line 450 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unitary_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 116: - -/* Line 1464 of yacc.c */ -#line 451 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_unitary_type", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 117: - -/* Line 1464 of yacc.c */ -#line 454 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_atomic_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 118: - -/* Line 1464 of yacc.c */ -#line 455 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_atomic_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 119: - -/* Line 1464 of yacc.c */ -#line 458 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_mapping_type", (yyvsp[(1) - (3)].pval), P_TOKEN("arrow ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 120: - -/* Line 1464 of yacc.c */ -#line 459 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_mapping_type", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 121: - -/* Line 1464 of yacc.c */ -#line 462 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_xprod_type", (yyvsp[(1) - (3)].pval), P_TOKEN("STAR ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 122: - -/* Line 1464 of yacc.c */ -#line 463 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_xprod_type", (yyvsp[(1) - (3)].pval), P_TOKEN("STAR ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 123: - -/* Line 1464 of yacc.c */ -#line 464 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_xprod_type", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 124: - -/* Line 1464 of yacc.c */ -#line 467 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_let", P_TOKEN("COLON_EQUALS ", (yyvsp[(1) - (6)].ival)), P_TOKEN("LBRKT ", (yyvsp[(2) - (6)].ival)), (yyvsp[(3) - (6)].pval), P_TOKEN("RBRKT ", (yyvsp[(4) - (6)].ival)), P_TOKEN("COLON ", (yyvsp[(5) - (6)].ival)), (yyvsp[(6) - (6)].pval),NULL,NULL,NULL,NULL);;} - break; - - case 125: - -/* Line 1464 of yacc.c */ -#line 470 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_let_list", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 126: - -/* Line 1464 of yacc.c */ -#line 471 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_let_list", (yyvsp[(1) - (3)].pval), P_TOKEN("COMMA ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 127: - -/* Line 1464 of yacc.c */ -#line 474 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_defined_var", (yyvsp[(1) - (3)].pval), P_TOKEN("COLON_EQUALS ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 128: - -/* Line 1464 of yacc.c */ -#line 475 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_defined_var", (yyvsp[(1) - (4)].pval), P_TOKEN("COLON ", (yyvsp[(2) - (4)].ival)), P_TOKEN("MINUS ", (yyvsp[(3) - (4)].ival)), (yyvsp[(4) - (4)].pval),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 129: - -/* Line 1464 of yacc.c */ -#line 476 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_defined_var", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 130: - -/* Line 1464 of yacc.c */ -#line 479 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_conditional", P_TOKEN("_DLR_itef ", (yyvsp[(1) - (8)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (8)].ival)), (yyvsp[(3) - (8)].pval), P_TOKEN("COMMA ", (yyvsp[(4) - (8)].ival)), (yyvsp[(5) - (8)].pval), P_TOKEN("COMMA ", (yyvsp[(6) - (8)].ival)), (yyvsp[(7) - (8)].pval), P_TOKEN("RPAREN ", (yyvsp[(8) - (8)].ival)),NULL,NULL);;} - break; - - case 131: - -/* Line 1464 of yacc.c */ -#line 482 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_sequent", (yyvsp[(1) - (3)].pval), (yyvsp[(2) - (3)].pval), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 132: - -/* Line 1464 of yacc.c */ -#line 483 "tptp5.y" - {(yyval.pval) = P_BUILD("tff_sequent", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 133: - -/* Line 1464 of yacc.c */ -#line 486 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 134: - -/* Line 1464 of yacc.c */ -#line 487 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 135: - -/* Line 1464 of yacc.c */ -#line 490 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_logic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 136: - -/* Line 1464 of yacc.c */ -#line 491 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_logic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 137: - -/* Line 1464 of yacc.c */ -#line 494 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_binary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 138: - -/* Line 1464 of yacc.c */ -#line 495 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_binary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 139: - -/* Line 1464 of yacc.c */ -#line 498 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_binary_nonassoc", (yyvsp[(1) - (3)].pval), (yyvsp[(2) - (3)].pval), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 140: - -/* Line 1464 of yacc.c */ -#line 501 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_binary_assoc", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 141: - -/* Line 1464 of yacc.c */ -#line 502 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_binary_assoc", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 142: - -/* Line 1464 of yacc.c */ -#line 505 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_or_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("VLINE ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 143: - -/* Line 1464 of yacc.c */ -#line 506 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_or_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("VLINE ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 144: - -/* Line 1464 of yacc.c */ -#line 509 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_and_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("AMPERSAND ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 145: - -/* Line 1464 of yacc.c */ -#line 510 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_and_formula", (yyvsp[(1) - (3)].pval), P_TOKEN("AMPERSAND ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 146: - -/* Line 1464 of yacc.c */ -#line 513 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 147: - -/* Line 1464 of yacc.c */ -#line 514 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 148: - -/* Line 1464 of yacc.c */ -#line 515 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 149: - -/* Line 1464 of yacc.c */ -#line 516 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 150: - -/* Line 1464 of yacc.c */ -#line 517 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 151: - -/* Line 1464 of yacc.c */ -#line 518 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_unitary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 152: - -/* Line 1464 of yacc.c */ -#line 519 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_unitary_formula", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 153: - -/* Line 1464 of yacc.c */ -#line 522 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_quantified_formula", (yyvsp[(1) - (6)].pval), P_TOKEN("LBRKT ", (yyvsp[(2) - (6)].ival)), (yyvsp[(3) - (6)].pval), P_TOKEN("RBRKT ", (yyvsp[(4) - (6)].ival)), P_TOKEN("COLON ", (yyvsp[(5) - (6)].ival)), (yyvsp[(6) - (6)].pval),NULL,NULL,NULL,NULL);;} - break; - - case 154: - -/* Line 1464 of yacc.c */ -#line 525 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_variable_list", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 155: - -/* Line 1464 of yacc.c */ -#line 526 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_variable_list", (yyvsp[(1) - (3)].pval), P_TOKEN("COMMA ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 156: - -/* Line 1464 of yacc.c */ -#line 529 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_unary_formula", (yyvsp[(1) - (2)].pval), (yyvsp[(2) - (2)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 157: - -/* Line 1464 of yacc.c */ -#line 530 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_unary_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 158: - -/* Line 1464 of yacc.c */ -#line 533 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_let", P_TOKEN("COLON_EQUALS ", (yyvsp[(1) - (6)].ival)), P_TOKEN("LBRKT ", (yyvsp[(2) - (6)].ival)), (yyvsp[(3) - (6)].pval), P_TOKEN("RBRKT ", (yyvsp[(4) - (6)].ival)), P_TOKEN("COLON ", (yyvsp[(5) - (6)].ival)), (yyvsp[(6) - (6)].pval),NULL,NULL,NULL,NULL);;} - break; - - case 159: - -/* Line 1464 of yacc.c */ -#line 536 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_let_list", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 160: - -/* Line 1464 of yacc.c */ -#line 537 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_let_list", (yyvsp[(1) - (3)].pval), P_TOKEN("COMMA ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 161: - -/* Line 1464 of yacc.c */ -#line 540 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_defined_var", (yyvsp[(1) - (3)].pval), P_TOKEN("COLON_EQUALS ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 162: - -/* Line 1464 of yacc.c */ -#line 541 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_defined_var", (yyvsp[(1) - (4)].pval), P_TOKEN("COLON ", (yyvsp[(2) - (4)].ival)), P_TOKEN("MINUS ", (yyvsp[(3) - (4)].ival)), (yyvsp[(4) - (4)].pval),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 163: - -/* Line 1464 of yacc.c */ -#line 542 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_defined_var", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 164: - -/* Line 1464 of yacc.c */ -#line 545 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_conditional", P_TOKEN("_DLR_itef ", (yyvsp[(1) - (8)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (8)].ival)), (yyvsp[(3) - (8)].pval), P_TOKEN("COMMA ", (yyvsp[(4) - (8)].ival)), (yyvsp[(5) - (8)].pval), P_TOKEN("COMMA ", (yyvsp[(6) - (8)].ival)), (yyvsp[(7) - (8)].pval), P_TOKEN("RPAREN ", (yyvsp[(8) - (8)].ival)),NULL,NULL);;} - break; - - case 165: - -/* Line 1464 of yacc.c */ -#line 548 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_sequent", (yyvsp[(1) - (3)].pval), (yyvsp[(2) - (3)].pval), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 166: - -/* Line 1464 of yacc.c */ -#line 549 "tptp5.y" - {(yyval.pval) = P_BUILD("fof_sequent", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 167: - -/* Line 1464 of yacc.c */ -#line 552 "tptp5.y" - {(yyval.pval) = P_BUILD("cnf_formula", P_TOKEN("LPAREN ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RPAREN ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 168: - -/* Line 1464 of yacc.c */ -#line 553 "tptp5.y" - {(yyval.pval) = P_BUILD("cnf_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 169: - -/* Line 1464 of yacc.c */ -#line 556 "tptp5.y" - {(yyval.pval) = P_BUILD("disjunction", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 170: - -/* Line 1464 of yacc.c */ -#line 557 "tptp5.y" - {(yyval.pval) = P_BUILD("disjunction", (yyvsp[(1) - (3)].pval), P_TOKEN("VLINE ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 171: - -/* Line 1464 of yacc.c */ -#line 560 "tptp5.y" - {(yyval.pval) = P_BUILD("literal", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 172: - -/* Line 1464 of yacc.c */ -#line 561 "tptp5.y" - {(yyval.pval) = P_BUILD("literal", P_TOKEN("TILDE ", (yyvsp[(1) - (2)].ival)), (yyvsp[(2) - (2)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 173: - -/* Line 1464 of yacc.c */ -#line 562 "tptp5.y" - {(yyval.pval) = P_BUILD("literal", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 174: - -/* Line 1464 of yacc.c */ -#line 565 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_conn_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 175: - -/* Line 1464 of yacc.c */ -#line 566 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_conn_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 176: - -/* Line 1464 of yacc.c */ -#line 567 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_conn_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 177: - -/* Line 1464 of yacc.c */ -#line 570 "tptp5.y" - {(yyval.pval) = P_BUILD("fol_infix_unary", (yyvsp[(1) - (3)].pval), (yyvsp[(2) - (3)].pval), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 178: - -/* Line 1464 of yacc.c */ -#line 573 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_quantifier", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 179: - -/* Line 1464 of yacc.c */ -#line 574 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_quantifier", P_TOKEN("CARET ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 180: - -/* Line 1464 of yacc.c */ -#line 575 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_quantifier", P_TOKEN("EXCLAMATION_GREATER ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 181: - -/* Line 1464 of yacc.c */ -#line 576 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_quantifier", P_TOKEN("QUESTION_STAR ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 182: - -/* Line 1464 of yacc.c */ -#line 577 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_quantifier", P_TOKEN("AT_SIGN_PLUS ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 183: - -/* Line 1464 of yacc.c */ -#line 578 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_quantifier", P_TOKEN("AT_SIGN_MINUS ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 184: - -/* Line 1464 of yacc.c */ -#line 581 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_pair_connective", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 185: - -/* Line 1464 of yacc.c */ -#line 582 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_pair_connective", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 186: - -/* Line 1464 of yacc.c */ -#line 583 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_pair_connective", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 187: - -/* Line 1464 of yacc.c */ -#line 586 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unary_connective", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 188: - -/* Line 1464 of yacc.c */ -#line 587 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unary_connective", P_TOKEN("EXCLAMATION_EXCLAMATION ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 189: - -/* Line 1464 of yacc.c */ -#line 588 "tptp5.y" - {(yyval.pval) = P_BUILD("thf_unary_connective", P_TOKEN("QUESTION_QUESTION ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 190: - -/* Line 1464 of yacc.c */ -#line 591 "tptp5.y" - {(yyval.pval) = P_BUILD("subtype_sign", P_TOKEN("less_sign ", (yyvsp[(1) - (2)].ival)), P_TOKEN("less_sign ", (yyvsp[(2) - (2)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 191: - -/* Line 1464 of yacc.c */ -#line 594 "tptp5.y" - {(yyval.pval) = P_BUILD("fol_quantifier", P_TOKEN("EXCLAMATION ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 192: - -/* Line 1464 of yacc.c */ -#line 595 "tptp5.y" - {(yyval.pval) = P_BUILD("fol_quantifier", P_TOKEN("QUESTION ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 193: - -/* Line 1464 of yacc.c */ -#line 598 "tptp5.y" - {(yyval.pval) = P_BUILD("binary_connective", P_TOKEN("LESS_EQUALS_GREATER ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 194: - -/* Line 1464 of yacc.c */ -#line 599 "tptp5.y" - {(yyval.pval) = P_BUILD("binary_connective", P_TOKEN("EQUALS_GREATER ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 195: - -/* Line 1464 of yacc.c */ -#line 600 "tptp5.y" - {(yyval.pval) = P_BUILD("binary_connective", P_TOKEN("LESS_EQUALS ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 196: - -/* Line 1464 of yacc.c */ -#line 601 "tptp5.y" - {(yyval.pval) = P_BUILD("binary_connective", P_TOKEN("LESS_TILDE_GREATER ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 197: - -/* Line 1464 of yacc.c */ -#line 602 "tptp5.y" - {(yyval.pval) = P_BUILD("binary_connective", P_TOKEN("TILDE_VLINE ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 198: - -/* Line 1464 of yacc.c */ -#line 603 "tptp5.y" - {(yyval.pval) = P_BUILD("binary_connective", P_TOKEN("TILDE_AMPERSAND ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 199: - -/* Line 1464 of yacc.c */ -#line 606 "tptp5.y" - {(yyval.pval) = P_BUILD("assoc_connective", P_TOKEN("VLINE ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 200: - -/* Line 1464 of yacc.c */ -#line 607 "tptp5.y" - {(yyval.pval) = P_BUILD("assoc_connective", P_TOKEN("AMPERSAND ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 201: - -/* Line 1464 of yacc.c */ -#line 610 "tptp5.y" - {(yyval.pval) = P_BUILD("unary_connective", P_TOKEN("TILDE ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 202: - -/* Line 1464 of yacc.c */ -#line 613 "tptp5.y" - {(yyval.pval) = P_BUILD("gentzen_arrow", P_TOKEN("MINUS_MINUS_GREATER ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 203: - -/* Line 1464 of yacc.c */ -#line 616 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_type", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 204: - -/* Line 1464 of yacc.c */ -#line 619 "tptp5.y" - {(yyval.pval) = P_BUILD("atomic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 205: - -/* Line 1464 of yacc.c */ -#line 620 "tptp5.y" - {(yyval.pval) = P_BUILD("atomic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 206: - -/* Line 1464 of yacc.c */ -#line 621 "tptp5.y" - {(yyval.pval) = P_BUILD("atomic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 207: - -/* Line 1464 of yacc.c */ -#line 624 "tptp5.y" - {(yyval.pval) = P_BUILD("plain_atomic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 208: - -/* Line 1464 of yacc.c */ -#line 627 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_atomic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 209: - -/* Line 1464 of yacc.c */ -#line 628 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_atomic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 210: - -/* Line 1464 of yacc.c */ -#line 631 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_plain_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 211: - -/* Line 1464 of yacc.c */ -#line 634 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_infix_formula", (yyvsp[(1) - (3)].pval), (yyvsp[(2) - (3)].pval), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 212: - -/* Line 1464 of yacc.c */ -#line 637 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_infix_pred", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 213: - -/* Line 1464 of yacc.c */ -#line 640 "tptp5.y" - {(yyval.pval) = P_BUILD("infix_equality", P_TOKEN("EQUALS ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 214: - -/* Line 1464 of yacc.c */ -#line 643 "tptp5.y" - {(yyval.pval) = P_BUILD("infix_inequality", P_TOKEN("EXCLAMATION_EQUALS ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 215: - -/* Line 1464 of yacc.c */ -#line 646 "tptp5.y" - {(yyval.pval) = P_BUILD("system_atomic_formula", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 216: - -/* Line 1464 of yacc.c */ -#line 649 "tptp5.y" - {(yyval.pval) = P_BUILD("term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 217: - -/* Line 1464 of yacc.c */ -#line 650 "tptp5.y" - {(yyval.pval) = P_BUILD("term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 218: - -/* Line 1464 of yacc.c */ -#line 651 "tptp5.y" - {(yyval.pval) = P_BUILD("term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 219: - -/* Line 1464 of yacc.c */ -#line 654 "tptp5.y" - {(yyval.pval) = P_BUILD("function_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 220: - -/* Line 1464 of yacc.c */ -#line 655 "tptp5.y" - {(yyval.pval) = P_BUILD("function_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 221: - -/* Line 1464 of yacc.c */ -#line 656 "tptp5.y" - {(yyval.pval) = P_BUILD("function_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 222: - -/* Line 1464 of yacc.c */ -#line 659 "tptp5.y" - {(yyval.pval) = P_BUILD("plain_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 223: - -/* Line 1464 of yacc.c */ -#line 660 "tptp5.y" - {(yyval.pval) = P_BUILD("plain_term", (yyvsp[(1) - (4)].pval), P_TOKEN("LPAREN ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RPAREN ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 224: - -/* Line 1464 of yacc.c */ -#line 663 "tptp5.y" - {(yyval.pval) = P_BUILD("constant", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 225: - -/* Line 1464 of yacc.c */ -#line 666 "tptp5.y" - {(yyval.pval) = P_BUILD("functor", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 226: - -/* Line 1464 of yacc.c */ -#line 669 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 227: - -/* Line 1464 of yacc.c */ -#line 670 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 228: - -/* Line 1464 of yacc.c */ -#line 673 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_atom", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 229: - -/* Line 1464 of yacc.c */ -#line 674 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_atom", P_TOKEN("distinct_object ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 230: - -/* Line 1464 of yacc.c */ -#line 677 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_atomic_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 231: - -/* Line 1464 of yacc.c */ -#line 680 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_plain_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 232: - -/* Line 1464 of yacc.c */ -#line 681 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_plain_term", (yyvsp[(1) - (4)].pval), P_TOKEN("LPAREN ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RPAREN ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 233: - -/* Line 1464 of yacc.c */ -#line 684 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_constant", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 234: - -/* Line 1464 of yacc.c */ -#line 687 "tptp5.y" - {(yyval.pval) = P_BUILD("defined_functor", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 235: - -/* Line 1464 of yacc.c */ -#line 690 "tptp5.y" - {(yyval.pval) = P_BUILD("system_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 236: - -/* Line 1464 of yacc.c */ -#line 691 "tptp5.y" - {(yyval.pval) = P_BUILD("system_term", (yyvsp[(1) - (4)].pval), P_TOKEN("LPAREN ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RPAREN ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 237: - -/* Line 1464 of yacc.c */ -#line 694 "tptp5.y" - {(yyval.pval) = P_BUILD("system_constant", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 238: - -/* Line 1464 of yacc.c */ -#line 697 "tptp5.y" - {(yyval.pval) = P_BUILD("system_functor", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 239: - -/* Line 1464 of yacc.c */ -#line 700 "tptp5.y" - {(yyval.pval) = P_BUILD("variable", P_TOKEN("upper_word ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 240: - -/* Line 1464 of yacc.c */ -#line 703 "tptp5.y" - {(yyval.pval) = P_BUILD("arguments", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 241: - -/* Line 1464 of yacc.c */ -#line 704 "tptp5.y" - {(yyval.pval) = P_BUILD("arguments", (yyvsp[(1) - (3)].pval), P_TOKEN("COMMA ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 242: - -/* Line 1464 of yacc.c */ -#line 707 "tptp5.y" - {(yyval.pval) = P_BUILD("conditional_term", P_TOKEN("_DLR_itett ", (yyvsp[(1) - (8)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (8)].ival)), (yyvsp[(3) - (8)].pval), P_TOKEN("COMMA ", (yyvsp[(4) - (8)].ival)), (yyvsp[(5) - (8)].pval), P_TOKEN("COMMA ", (yyvsp[(6) - (8)].ival)), (yyvsp[(7) - (8)].pval), P_TOKEN("RPAREN ", (yyvsp[(8) - (8)].ival)),NULL,NULL);;} - break; - - case 243: - -/* Line 1464 of yacc.c */ -#line 708 "tptp5.y" - {(yyval.pval) = P_BUILD("conditional_term", P_TOKEN("_DLR_itetf ", (yyvsp[(1) - (8)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (8)].ival)), (yyvsp[(3) - (8)].pval), P_TOKEN("COMMA ", (yyvsp[(4) - (8)].ival)), (yyvsp[(5) - (8)].pval), P_TOKEN("COMMA ", (yyvsp[(6) - (8)].ival)), (yyvsp[(7) - (8)].pval), P_TOKEN("RPAREN ", (yyvsp[(8) - (8)].ival)),NULL,NULL);;} - break; - - case 244: - -/* Line 1464 of yacc.c */ -#line 711 "tptp5.y" - {(yyval.pval) = P_BUILD("source", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 245: - -/* Line 1464 of yacc.c */ -#line 714 "tptp5.y" - {(yyval.pval) = P_BUILD("optional_info", P_TOKEN("COMMA ", (yyvsp[(1) - (2)].ival)), (yyvsp[(2) - (2)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 246: - -/* Line 1464 of yacc.c */ -#line 715 "tptp5.y" - {(yyval.pval) = P_BUILD("optional_info", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 247: - -/* Line 1464 of yacc.c */ -#line 718 "tptp5.y" - {(yyval.pval) = P_BUILD("useful_info", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 248: - -/* Line 1464 of yacc.c */ -#line 721 "tptp5.y" - {(yyval.pval) = P_BUILD("include", P_TOKEN("_LIT_include ", (yyvsp[(1) - (6)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (6)].ival)), (yyvsp[(3) - (6)].pval), (yyvsp[(4) - (6)].pval), P_TOKEN("RPAREN ", (yyvsp[(5) - (6)].ival)), P_TOKEN("PERIOD ", (yyvsp[(6) - (6)].ival)),NULL,NULL,NULL,NULL);;} - break; - - case 249: - -/* Line 1464 of yacc.c */ -#line 724 "tptp5.y" - {(yyval.pval) = P_BUILD("formula_selection", P_TOKEN("COMMA ", (yyvsp[(1) - (4)].ival)), P_TOKEN("LBRKT ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RBRKT ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 250: - -/* Line 1464 of yacc.c */ -#line 725 "tptp5.y" - {(yyval.pval) = P_BUILD("formula_selection", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 251: - -/* Line 1464 of yacc.c */ -#line 728 "tptp5.y" - {(yyval.pval) = P_BUILD("name_list", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 252: - -/* Line 1464 of yacc.c */ -#line 729 "tptp5.y" - {(yyval.pval) = P_BUILD("name_list", (yyvsp[(1) - (3)].pval), P_TOKEN("COMMA ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 253: - -/* Line 1464 of yacc.c */ -#line 732 "tptp5.y" - {(yyval.pval) = P_BUILD("general_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 254: - -/* Line 1464 of yacc.c */ -#line 733 "tptp5.y" - {(yyval.pval) = P_BUILD("general_term", (yyvsp[(1) - (3)].pval), P_TOKEN("COLON ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 255: - -/* Line 1464 of yacc.c */ -#line 734 "tptp5.y" - {(yyval.pval) = P_BUILD("general_term", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 256: - -/* Line 1464 of yacc.c */ -#line 737 "tptp5.y" - {(yyval.pval) = P_BUILD("general_data", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 257: - -/* Line 1464 of yacc.c */ -#line 738 "tptp5.y" - {(yyval.pval) = P_BUILD("general_data", (yyvsp[(1) - (4)].pval), P_TOKEN("LPAREN ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RPAREN ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 258: - -/* Line 1464 of yacc.c */ -#line 739 "tptp5.y" - {(yyval.pval) = P_BUILD("general_data", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 259: - -/* Line 1464 of yacc.c */ -#line 740 "tptp5.y" - {(yyval.pval) = P_BUILD("general_data", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 260: - -/* Line 1464 of yacc.c */ -#line 741 "tptp5.y" - {(yyval.pval) = P_BUILD("general_data", P_TOKEN("distinct_object ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 261: - -/* Line 1464 of yacc.c */ -#line 742 "tptp5.y" - {(yyval.pval) = P_BUILD("general_data", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 262: - -/* Line 1464 of yacc.c */ -#line 745 "tptp5.y" - {(yyval.pval) = P_BUILD("formula_data", P_TOKEN("_DLR_thf ", (yyvsp[(1) - (4)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RPAREN ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 263: - -/* Line 1464 of yacc.c */ -#line 746 "tptp5.y" - {(yyval.pval) = P_BUILD("formula_data", P_TOKEN("_DLR_tff ", (yyvsp[(1) - (4)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RPAREN ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 264: - -/* Line 1464 of yacc.c */ -#line 747 "tptp5.y" - {(yyval.pval) = P_BUILD("formula_data", P_TOKEN("_DLR_fof ", (yyvsp[(1) - (4)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RPAREN ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 265: - -/* Line 1464 of yacc.c */ -#line 748 "tptp5.y" - {(yyval.pval) = P_BUILD("formula_data", P_TOKEN("_DLR_cnf ", (yyvsp[(1) - (4)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RPAREN ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 266: - -/* Line 1464 of yacc.c */ -#line 749 "tptp5.y" - {(yyval.pval) = P_BUILD("formula_data", P_TOKEN("_DLR_fot ", (yyvsp[(1) - (4)].ival)), P_TOKEN("LPAREN ", (yyvsp[(2) - (4)].ival)), (yyvsp[(3) - (4)].pval), P_TOKEN("RPAREN ", (yyvsp[(4) - (4)].ival)),NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 267: - -/* Line 1464 of yacc.c */ -#line 752 "tptp5.y" - {(yyval.pval) = P_BUILD("general_list", P_TOKEN("LBRKT ", (yyvsp[(1) - (2)].ival)), P_TOKEN("RBRKT ", (yyvsp[(2) - (2)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 268: - -/* Line 1464 of yacc.c */ -#line 753 "tptp5.y" - {(yyval.pval) = P_BUILD("general_list", P_TOKEN("LBRKT ", (yyvsp[(1) - (3)].ival)), (yyvsp[(2) - (3)].pval), P_TOKEN("RBRKT ", (yyvsp[(3) - (3)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 269: - -/* Line 1464 of yacc.c */ -#line 756 "tptp5.y" - {(yyval.pval) = P_BUILD("general_terms", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 270: - -/* Line 1464 of yacc.c */ -#line 757 "tptp5.y" - {(yyval.pval) = P_BUILD("general_terms", (yyvsp[(1) - (3)].pval), P_TOKEN("COMMA ", (yyvsp[(2) - (3)].ival)), (yyvsp[(3) - (3)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 271: - -/* Line 1464 of yacc.c */ -#line 760 "tptp5.y" - {(yyval.pval) = P_BUILD("name", (yyvsp[(1) - (1)].pval),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 272: - -/* Line 1464 of yacc.c */ -#line 761 "tptp5.y" - {(yyval.pval) = P_BUILD("name", P_TOKEN("integer ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 273: - -/* Line 1464 of yacc.c */ -#line 764 "tptp5.y" - {(yyval.pval) = P_BUILD("atomic_word", P_TOKEN("lower_word ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 274: - -/* Line 1464 of yacc.c */ -#line 765 "tptp5.y" - {(yyval.pval) = P_BUILD("atomic_word", P_TOKEN("single_quoted ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 275: - -/* Line 1464 of yacc.c */ -#line 768 "tptp5.y" - {(yyval.pval) = P_BUILD("atomic_defined_word", P_TOKEN("dollar_word ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 276: - -/* Line 1464 of yacc.c */ -#line 771 "tptp5.y" - {(yyval.pval) = P_BUILD("atomic_system_word", P_TOKEN("dollar_dollar_word ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 277: - -/* Line 1464 of yacc.c */ -#line 774 "tptp5.y" - {(yyval.pval) = P_BUILD("number", P_TOKEN("integer ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 278: - -/* Line 1464 of yacc.c */ -#line 775 "tptp5.y" - {(yyval.pval) = P_BUILD("number", P_TOKEN("rational ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 279: - -/* Line 1464 of yacc.c */ -#line 776 "tptp5.y" - {(yyval.pval) = P_BUILD("number", P_TOKEN("real ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 280: - -/* Line 1464 of yacc.c */ -#line 779 "tptp5.y" - {(yyval.pval) = P_BUILD("file_name", P_TOKEN("single_quoted ", (yyvsp[(1) - (1)].ival)),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - case 281: - -/* Line 1464 of yacc.c */ -#line 782 "tptp5.y" - {(yyval.pval) = P_BUILD("null",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);;} - break; - - - -/* Line 1464 of yacc.c */ -#line 4264 "tptp5.tab.c" - default: break; - } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined(yyoverflow) || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - - diff --git a/examples/tptp/tptp5.tab.h b/examples/tptp/tptp5.tab.h deleted file mode 100644 index 2e03c0d130..0000000000 --- a/examples/tptp/tptp5.tab.h +++ /dev/null @@ -1,138 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software - Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - AMPERSAND = 258, - AT_SIGN = 259, - AT_SIGN_MINUS = 260, - AT_SIGN_PLUS = 261, - CARET = 262, - COLON = 263, - COLON_EQUALS = 264, - COMMA = 265, - EQUALS = 266, - EQUALS_GREATER = 267, - EXCLAMATION = 268, - EXCLAMATION_EQUALS = 269, - EXCLAMATION_EXCLAMATION = 270, - EXCLAMATION_GREATER = 271, - LBRKT = 272, - LESS_EQUALS = 273, - LESS_EQUALS_GREATER = 274, - LESS_TILDE_GREATER = 275, - LPAREN = 276, - MINUS = 277, - MINUS_MINUS_GREATER = 278, - PERIOD = 279, - QUESTION = 280, - QUESTION_QUESTION = 281, - QUESTION_STAR = 282, - RBRKT = 283, - RPAREN = 284, - STAR = 285, - TILDE = 286, - TILDE_AMPERSAND = 287, - TILDE_VLINE = 288, - VLINE = 289, - _DLR_cnf = 290, - _DLR_fof = 291, - _DLR_fot = 292, - _DLR_itef = 293, - _DLR_itetf = 294, - _DLR_itett = 295, - _DLR_tff = 296, - _DLR_thf = 297, - _LIT_cnf = 298, - _LIT_fof = 299, - _LIT_include = 300, - _LIT_tff = 301, - _LIT_thf = 302, - arrow = 303, - comment = 304, - comment_line = 305, - decimal = 306, - decimal_exponent = 307, - decimal_fraction = 308, - distinct_object = 309, - dollar_dollar_word = 310, - dollar_word = 311, - dot_decimal = 312, - integer = 313, - less_sign = 314, - lower_word = 315, - plus = 316, - positive_decimal = 317, - rational = 318, - real = 319, - signed_integer = 320, - signed_rational = 321, - signed_real = 322, - single_quoted = 323, - star = 324, - unrecognized = 325, - unsigned_integer = 326, - unsigned_rational = 327, - unsigned_real = 328, - upper_word = 329, - vline = 330 - }; -#endif - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ - -/* Line 1685 of yacc.c */ -#line 148 "tptp5.y" -int ival; double dval; char* sval; TreeNode* pval; - - -/* Line 1685 of yacc.c */ -#line 130 "tptp5.tab.h" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - -extern YYSTYPE yylval; - - diff --git a/scripts/VERSION.txt b/scripts/VERSION.txt index e7887e717e..bb3d8c2b61 100644 --- a/scripts/VERSION.txt +++ b/scripts/VERSION.txt @@ -1 +1 @@ -4.17.1.0 +5.0.0.0 diff --git a/scripts/mk_project.py b/scripts/mk_project.py index e62b2e159b..69eb4d7881 100644 --- a/scripts/mk_project.py +++ b/scripts/mk_project.py @@ -118,7 +118,6 @@ def init_project_def(): add_js() # Examples add_cpp_example('cpp_example', 'c++') - add_cpp_example('z3_tptp', 'tptp') add_c_example('c_example', 'c') add_c_example('maxsat') add_dotnet_example('dotnet_example', 'dotnet') diff --git a/scripts/mk_util.py b/scripts/mk_util.py index 89d82303a1..6da1090aac 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -3160,6 +3160,7 @@ def mk_bindings(api_files): update_api.generate_files(api_files=new_api_files, api_output_dir=get_component('api').src_dir, z3py_output_dir=get_z3py_dir(), + z3py_soversion=f"{VER_MAJOR}.{VER_MINOR}" if is_linux() else None, dotnet_output_dir=dotnet_output_dir, java_input_dir=java_input_dir, java_output_dir=java_output_dir, diff --git a/scripts/test-examples-cmake.yml b/scripts/test-examples-cmake.yml index e5b36bacd4..988f1f95dc 100644 --- a/scripts/test-examples-cmake.yml +++ b/scripts/test-examples-cmake.yml @@ -4,11 +4,9 @@ steps: cd build ninja c_example ninja cpp_example - ninja z3_tptp5 ninja c_maxsat_example examples/c_example_build_dir/c_example examples/cpp_example_build_dir/cpp_example - examples/tptp_build_dir/z3_tptp5 -help examples/c_maxsat_example_build_dir/c_maxsat_example ../examples/maxsat/ex.smt cd .. diff --git a/scripts/tests/test_update_api.py b/scripts/tests/test_update_api.py new file mode 100644 index 0000000000..eeaaa5e879 --- /dev/null +++ b/scripts/tests/test_update_api.py @@ -0,0 +1,53 @@ +############################################ +# Copyright (c) 2026 Microsoft Corporation +# +# Unit tests for z3core.py library loading generation. +############################################ +import io +import os +import sys +import unittest + +# Add the scripts directory to the path so we can import update_api +_SCRIPTS_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if _SCRIPTS_DIR not in sys.path: + sys.path.insert(0, _SCRIPTS_DIR) + +import update_api + +class TestZ3PyLibraryLoading(unittest.TestCase): + def _render_preamble(self, soversion): + buf = io.StringIO() + update_api.write_core_py_preamble(buf, soversion) + update_api.write_core_py_post(buf) + return buf.getvalue() + + def test_linux_loader_uses_soversion_when_available(self): + text = self._render_preamble("5.0") + self.assertIn("_sover = '5.0'", text) + self.assertIn("sys.platform.startswith('linux') and _sover", text) + # Should have a fallback list with both versioned and unversioned names + self.assertIn("_lib_names", text) + self.assertIn("del _lib_names", text) + self.assertIn('raise Z3Exception("%s not found." % _lib_name)', text) + + def test_linux_loader_falls_back_to_unversioned(self): + text = self._render_preamble("5.0") + # The loader should try multiple names (versioned + unversioned fallback) + self.assertIn("for _name in _lib_names:", text) + self.assertIn("d = os.path.join(d, _name)", text) + self.assertIn("_lib = ctypes.CDLL(_name)", text) + + def test_loader_falls_back_to_unsuffixed_name_without_soversion(self): + text = self._render_preamble(None) + self.assertIn("_sover = None", text) + self.assertIn( + "_lib_name = 'libz3.%s.%s' % (_ext, _sover) if sys.platform.startswith('linux') and _sover else 'libz3.%s' % _ext", + text, + ) + self.assertIn("del _lib_name", text) + self.assertIn("del _sover", text) + + +if __name__ == '__main__': + unittest.main() diff --git a/scripts/update_api.py b/scripts/update_api.py index b539165a39..c0831e2dbe 100755 --- a/scripts/update_api.py +++ b/scripts/update_api.py @@ -1849,12 +1849,15 @@ def write_core_py_post(core_py): core_py.write(""" # Clean up del _lib +del _lib_name +del _lib_names del _default_dirs del _all_dirs del _ext +del _sover """) -def write_core_py_preamble(core_py): +def write_core_py_preamble(core_py, z3py_soversion=None): core_py.write( """ # Automatically generated file @@ -1871,7 +1874,14 @@ from .z3consts import * _file_manager = contextlib.ExitStack() atexit.register(_file_manager.close) +""") + core_py.write(f"_sover = {z3py_soversion!r}\n") + core_py.write( +""" _ext = 'dll' if sys.platform in ('win32', 'cygwin') else 'dylib' if sys.platform == 'darwin' else 'so' +_lib_name = 'libz3.%s.%s' % (_ext, _sover) if sys.platform.startswith('linux') and _sover else 'libz3.%s' % _ext +# On Linux with a soversion, also try the unversioned name as a fallback (e.g. build directories) +_lib_names = ['libz3.%s.%s' % (_ext, _sover), 'libz3.%s' % _ext] if sys.platform.startswith('linux') and _sover else ['libz3.%s' % _ext] _lib = None _z3_lib_resource = importlib_resources.files('z3').joinpath('lib') _z3_lib_resource_path = _file_manager.enter_context( @@ -1902,39 +1912,44 @@ for v in ('Z3_LIBRARY_PATH', 'PATH', 'PYTHONPATH'): _all_dirs.extend(lds) _failures = [] -for d in _all_dirs: - try: - d = os.path.realpath(d) - if os.path.isdir(d): - d = os.path.join(d, 'libz3.%s' % _ext) - if os.path.isfile(d): - _lib = ctypes.CDLL(d) - break - except Exception as e: - _failures += [e] - pass +for _name in _lib_names: + for d in _all_dirs: + try: + d = os.path.realpath(d) + if os.path.isdir(d): + d = os.path.join(d, _name) + if os.path.isfile(d): + _lib = ctypes.CDLL(d) + break + except Exception as e: + _failures += [e] + pass + if _lib is not None: + break if _lib is None: # If all else failed, ask the system to find it. - try: - _lib = ctypes.CDLL('libz3.%s' % _ext) - except Exception as e: - _failures += [e] - pass + for _name in _lib_names: + try: + _lib = ctypes.CDLL(_name) + break + except Exception as e: + _failures += [e] + pass if _lib is None: - print("Could not find libz3.%s; consider adding the directory containing it to" % _ext) + print("Could not find %s; consider adding the directory containing it to" % ' or '.join(_lib_names)) print(" - your system's PATH environment variable,") print(" - the Z3_LIBRARY_PATH environment variable, or ") print(" - to the custom Z3_LIB_DIRS Python-builtin before importing the z3 module, e.g. via") if sys.version < '3': print(" import __builtin__") - print(" __builtin__.Z3_LIB_DIRS = [ '/path/to/z3/lib/dir' ] # directory containing libz3.%s" % _ext) + print(" __builtin__.Z3_LIB_DIRS = [ '/path/to/z3/lib/dir' ] # directory containing %s" % _lib_name) else: print(" import builtins") - print(" builtins.Z3_LIB_DIRS = [ '/path/to/z3/lib/dir' ] # directory containing libz3.%s" % _ext) + print(" builtins.Z3_LIB_DIRS = [ '/path/to/z3/lib/dir' ] # directory containing %s" % _lib_name) print(_failures) - raise Z3Exception("libz3.%s not found." % _ext) + raise Z3Exception("%s not found." % _lib_name) if sys.version < '3': @@ -2000,6 +2015,7 @@ core_py = None def generate_files(api_files, api_output_dir=None, z3py_output_dir=None, + z3py_soversion=None, dotnet_output_dir=None, java_input_dir=None, java_output_dir=None, @@ -2057,7 +2073,7 @@ def generate_files(api_files, write_log_h_preamble(log_h) write_log_c_preamble(log_c) write_exe_c_preamble(exe_c) - write_core_py_preamble(core_py) + write_core_py_preamble(core_py, z3py_soversion) # FIXME: these functions are awful apiTypes.def_Types(api_files) @@ -2100,6 +2116,10 @@ def main(args): dest="z3py_output_dir", default=None, help="Directory to emit z3py files. If not specified no files are emitted.") + parser.add_argument("--z3py-soversion", + dest="z3py_soversion", + default=None, + help="SOVERSION for loading libz3 on supported platforms.") parser.add_argument("--dotnet-output-dir", dest="dotnet_output_dir", default=None, @@ -2147,6 +2167,7 @@ def main(args): generate_files(api_files=pargs.api_files, api_output_dir=pargs.api_output_dir, z3py_output_dir=pargs.z3py_output_dir, + z3py_soversion=pargs.z3py_soversion, dotnet_output_dir=pargs.dotnet_output_dir, java_input_dir=pargs.java_input_dir, java_output_dir=pargs.java_output_dir, diff --git a/src/api/api_arith.cpp b/src/api/api_arith.cpp index 806f720b32..46a22a516f 100644 --- a/src/api/api_arith.cpp +++ b/src/api/api_arith.cpp @@ -21,6 +21,7 @@ Revision History: #include "api/api_util.h" #include "ast/arith_decl_plugin.h" #include "math/polynomial/algebraic_numbers.h" +#include "util/manage_warnings.h" #include @@ -76,11 +77,13 @@ extern "C" { Z3_CATCH_RETURN(nullptr); } + START_DISABLE_EXTRA_SEMI_WARNING; MK_ARITH_OP(Z3_mk_add, OP_ADD); MK_ARITH_OP(Z3_mk_mul, OP_MUL); MK_BINARY_ARITH_OP(Z3_mk_power, OP_POWER); MK_BINARY_ARITH_OP(Z3_mk_mod, OP_MOD); MK_BINARY_ARITH_OP(Z3_mk_rem, OP_REM); + END_DISABLE_WARNING; Z3_ast Z3_API Z3_mk_div(Z3_context c, Z3_ast n1, Z3_ast n2) { Z3_TRY; @@ -100,10 +103,12 @@ extern "C" { Z3_CATCH_RETURN(nullptr); } + START_DISABLE_EXTRA_SEMI_WARNING; MK_ARITH_PRED(Z3_mk_lt, OP_LT); MK_ARITH_PRED(Z3_mk_gt, OP_GT); MK_ARITH_PRED(Z3_mk_le, OP_LE); MK_ARITH_PRED(Z3_mk_ge, OP_GE); + END_DISABLE_WARNING; Z3_ast Z3_API Z3_mk_divides(Z3_context c, Z3_ast n1, Z3_ast n2) { Z3_TRY; @@ -123,10 +128,12 @@ extern "C" { Z3_CATCH_RETURN(nullptr); } + START_DISABLE_EXTRA_SEMI_WARNING; MK_UNARY(Z3_mk_abs, mk_c(c)->get_arith_fid(), OP_ABS, SKIP); MK_UNARY(Z3_mk_int2real, mk_c(c)->get_arith_fid(), OP_TO_REAL, SKIP); MK_UNARY(Z3_mk_real2int, mk_c(c)->get_arith_fid(), OP_TO_INT, SKIP); MK_UNARY(Z3_mk_is_int, mk_c(c)->get_arith_fid(), OP_IS_INT, SKIP); + END_DISABLE_WARNING; Z3_ast Z3_API Z3_mk_sub(Z3_context c, unsigned num_args, Z3_ast const args[]) { Z3_TRY; diff --git a/src/api/api_array.cpp b/src/api/api_array.cpp index 6b454530ea..fc34f0f675 100644 --- a/src/api/api_array.cpp +++ b/src/api/api_array.cpp @@ -20,6 +20,7 @@ Revision History: #include "api/api_context.h" #include "api/api_util.h" #include "ast/array_decl_plugin.h" +#include "util/manage_warnings.h" extern "C" { @@ -266,12 +267,14 @@ extern "C" { Z3_CATCH_RETURN(nullptr); } + START_DISABLE_EXTRA_SEMI_WARNING; MK_NARY(Z3_mk_set_union, mk_c(c)->get_array_fid(), OP_SET_UNION, SKIP); MK_NARY(Z3_mk_set_intersect, mk_c(c)->get_array_fid(), OP_SET_INTERSECT, SKIP); MK_BINARY(Z3_mk_set_difference, mk_c(c)->get_array_fid(), OP_SET_DIFFERENCE, SKIP); MK_UNARY(Z3_mk_set_complement, mk_c(c)->get_array_fid(), OP_SET_COMPLEMENT, SKIP); MK_BINARY(Z3_mk_set_subset, mk_c(c)->get_array_fid(), OP_SET_SUBSET, SKIP); MK_BINARY(Z3_mk_array_ext, mk_c(c)->get_array_fid(), OP_ARRAY_EXT, SKIP); + END_DISABLE_WARNING; Z3_ast Z3_API Z3_mk_as_array(Z3_context c, Z3_func_decl f) { Z3_TRY; diff --git a/src/api/api_ast.cpp b/src/api/api_ast.cpp index f33f93e29f..799623b79e 100644 --- a/src/api/api_ast.cpp +++ b/src/api/api_ast.cpp @@ -39,6 +39,7 @@ Revision History: #include "util/scoped_ctrl_c.h" #include "util/cancel_eh.h" #include "util/scoped_timer.h" +#include "util/manage_warnings.h" #include "ast/pp_params.hpp" #include "ast/expr_abstract.h" @@ -190,16 +191,40 @@ extern "C" { func_decl* _d = reinterpret_cast(d); ast_manager& m = mk_c(c)->m(); if (_d->is_polymorphic()) { - polymorphism::util u(m); - polymorphism::substitution sub(m); - ptr_buffer domain; - for (unsigned i = 0; i < num_args; ++i) { - if (!sub.match(_d->get_domain(i), arg_list[i]->get_sort())) - SET_ERROR_CODE(Z3_INVALID_ARG, "failed to match argument of polymorphic function"); - domain.push_back(arg_list[i]->get_sort()); + if (_d->get_arity() != num_args && + !_d->is_left_associative() && !_d->is_right_associative() && !_d->is_chainable()) { + SET_ERROR_CODE(Z3_INVALID_ARG, "invalid function application, wrong number of arguments"); + return nullptr; } + polymorphism::substitution sub(m); + auto match = [&](unsigned domain_idx, unsigned arg_idx) { + if (!sub.match(_d->get_domain(domain_idx), arg_list[arg_idx]->get_sort())) { + SET_ERROR_CODE(Z3_INVALID_ARG, "failed to match argument of polymorphic function"); + return false; + } + return true; + }; + for (unsigned i = 0; i < num_args; ++i) { + unsigned domain_idx = i; + if (_d->is_associative()) + domain_idx = 0; + else if (_d->is_right_associative()) + domain_idx = i + 1 == num_args && num_args > 1 ? 1 : 0; + else if (_d->is_left_associative()) + domain_idx = i == 0 ? 0 : 1; + else if (_d->is_chainable()) { + if ((i > 0 && !match(1, i)) || (i + 1 < num_args && !match(0, i))) + return nullptr; + continue; + } + if (!match(domain_idx, i)) + return nullptr; + } + sort_ref_buffer domain(m); + for (unsigned i = 0; i < _d->get_arity(); ++i) + domain.push_back(sub(_d->get_domain(i))); sort_ref range = sub(_d->get_range()); - _d = m.instantiate_polymorphic(_d, num_args, domain.data(), range); + _d = m.instantiate_polymorphic(_d, _d->get_arity(), domain.data(), range); } app* a = m.mk_app(_d, num_args, arg_list.data()); mk_c(c)->save_ast_trail(a); @@ -273,6 +298,7 @@ extern "C" { Z3_CATCH_RETURN(nullptr); } + START_DISABLE_EXTRA_SEMI_WARNING; MK_UNARY(Z3_mk_not, mk_c(c)->get_basic_fid(), OP_NOT, SKIP); MK_BINARY(Z3_mk_eq, mk_c(c)->get_basic_fid(), OP_EQ, SKIP); MK_NARY(Z3_mk_distinct, mk_c(c)->get_basic_fid(), OP_DISTINCT, SKIP); @@ -281,6 +307,7 @@ extern "C" { MK_BINARY(Z3_mk_xor, mk_c(c)->get_basic_fid(), OP_XOR, SKIP); MK_NARY(Z3_mk_and, mk_c(c)->get_basic_fid(), OP_AND, SKIP); MK_NARY(Z3_mk_or, mk_c(c)->get_basic_fid(), OP_OR, SKIP); + END_DISABLE_WARNING; Z3_ast mk_ite_core(Z3_context c, Z3_ast t1, Z3_ast t2, Z3_ast t3) { expr * result = mk_c(c)->m().mk_ite(to_expr(t1), to_expr(t2), to_expr(t3)); diff --git a/src/api/api_bv.cpp b/src/api/api_bv.cpp index 77e7bfbc29..2f086e6dac 100644 --- a/src/api/api_bv.cpp +++ b/src/api/api_bv.cpp @@ -20,6 +20,7 @@ Revision History: #include "api/api_context.h" #include "api/api_util.h" #include "ast/bv_decl_plugin.h" +#include "util/manage_warnings.h" extern "C" { @@ -36,6 +37,7 @@ extern "C" { #define MK_BV_UNARY(NAME, OP) MK_UNARY(NAME, mk_c(c)->get_bv_fid(), OP, SKIP) #define MK_BV_BINARY(NAME, OP) MK_BINARY(NAME, mk_c(c)->get_bv_fid(), OP, SKIP) + START_DISABLE_EXTRA_SEMI_WARNING; MK_BV_UNARY(Z3_mk_bvnot, OP_BNOT); MK_BV_UNARY(Z3_mk_bvredand, OP_BREDAND); MK_BV_UNARY(Z3_mk_bvredor, OP_BREDOR); @@ -66,6 +68,7 @@ extern "C" { MK_BV_BINARY(Z3_mk_bvashr, OP_BASHR); MK_BV_BINARY(Z3_mk_ext_rotate_left, OP_EXT_ROTATE_LEFT); MK_BV_BINARY(Z3_mk_ext_rotate_right, OP_EXT_ROTATE_RIGHT); + END_DISABLE_WARNING; static Z3_ast mk_extract_core(Z3_context c, unsigned high, unsigned low, Z3_ast n) { expr * _n = to_expr(n); @@ -99,6 +102,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \ Z3_CATCH_RETURN(0); \ } + START_DISABLE_EXTRA_SEMI_WARNING; MK_BV_PUNARY(Z3_mk_sign_ext, OP_SIGN_EXT); MK_BV_PUNARY(Z3_mk_zero_ext, OP_ZERO_EXT); MK_BV_PUNARY(Z3_mk_repeat, OP_REPEAT); @@ -106,6 +110,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \ MK_BV_PUNARY(Z3_mk_rotate_left, OP_ROTATE_LEFT); MK_BV_PUNARY(Z3_mk_rotate_right, OP_ROTATE_RIGHT); MK_BV_PUNARY(Z3_mk_int2bv, OP_INT2BV); + END_DISABLE_WARNING; Z3_ast Z3_API Z3_mk_bv2int(Z3_context c, Z3_ast n, bool is_signed) { Z3_TRY; diff --git a/src/api/api_seq.cpp b/src/api/api_seq.cpp index 94756cc584..c003281faa 100644 --- a/src/api/api_seq.cpp +++ b/src/api/api_seq.cpp @@ -21,6 +21,7 @@ Revision History: #include "api/api_context.h" #include "api/api_util.h" #include "ast/ast_pp.h" +#include "util/manage_warnings.h" extern "C" { @@ -287,6 +288,7 @@ extern "C" { Z3_CATCH_RETURN(0); \ } + START_DISABLE_EXTRA_SEMI_WARNING; MK_SORTED(Z3_mk_seq_empty, mk_c(c)->sutil().str.mk_empty); MK_UNARY(Z3_mk_seq_unit, mk_c(c)->get_seq_fid(), OP_SEQ_UNIT, SKIP); @@ -316,6 +318,7 @@ extern "C" { MK_UNARY(Z3_mk_str_to_int, mk_c(c)->get_seq_fid(), OP_STRING_STOI, SKIP); MK_UNARY(Z3_mk_ubv_to_str, mk_c(c)->get_seq_fid(), OP_STRING_UBVTOS, SKIP); MK_UNARY(Z3_mk_sbv_to_str, mk_c(c)->get_seq_fid(), OP_STRING_SBVTOS, SKIP); + END_DISABLE_WARNING; Z3_ast Z3_API Z3_mk_re_loop(Z3_context c, Z3_ast r, unsigned lo, unsigned hi) { @@ -343,6 +346,7 @@ extern "C" { } + START_DISABLE_EXTRA_SEMI_WARNING; MK_UNARY(Z3_mk_re_plus, mk_c(c)->get_seq_fid(), OP_RE_PLUS, SKIP); MK_UNARY(Z3_mk_re_star, mk_c(c)->get_seq_fid(), OP_RE_STAR, SKIP); MK_UNARY(Z3_mk_re_option, mk_c(c)->get_seq_fid(), OP_RE_OPTION, SKIP); @@ -367,6 +371,7 @@ extern "C" { MK_TERNARY(Z3_mk_seq_mapi, mk_c(c)->get_seq_fid(), OP_SEQ_MAPI, SKIP); MK_TERNARY(Z3_mk_seq_foldl, mk_c(c)->get_seq_fid(), OP_SEQ_FOLDL, SKIP); MK_FOURARY(Z3_mk_seq_foldli, mk_c(c)->get_seq_fid(), OP_SEQ_FOLDLI, SKIP); + END_DISABLE_WARNING; } diff --git a/src/api/api_solver.cpp b/src/api/api_solver.cpp index 2d39e3287a..be1b701223 100644 --- a/src/api/api_solver.cpp +++ b/src/api/api_solver.cpp @@ -22,6 +22,7 @@ Revision History: #include "util/file_path.h" #include "util/scoped_timer.h" #include "util/file_path.h" +#include "util/memory_manager.h" #include "ast/ast_pp.h" #include "api/z3.h" #include "api/api_log_macros.h" @@ -514,6 +515,15 @@ extern "C" { Z3_TRY; LOG_Z3_solver_reset(c, s); RESET_ERROR_CODE(); + struct scoped_memory_limit_reset { + size_t m_prev_max; + scoped_memory_limit_reset(): m_prev_max(memory::get_max_size()) { + memory::set_max_size(0); + } + ~scoped_memory_limit_reset() { + memory::set_max_size(m_prev_max); + } + } scoped_max_memory; to_solver(s)->m_solver = nullptr; to_solver(s)->m_cmd_context = nullptr; if (to_solver(s)->m_pp) to_solver(s)->m_pp->reset(); diff --git a/src/api/api_special_relations.cpp b/src/api/api_special_relations.cpp index 0063fe7863..6257c37503 100644 --- a/src/api/api_special_relations.cpp +++ b/src/api/api_special_relations.cpp @@ -23,6 +23,7 @@ Revision History: #include "api/api_util.h" #include "ast/ast_pp.h" #include "ast/special_relations_decl_plugin.h" +#include "util/manage_warnings.h" extern "C" { @@ -39,10 +40,12 @@ extern "C" { Z3_CATCH_RETURN(nullptr); \ } + START_DISABLE_EXTRA_SEMI_WARNING; MK_SPECIAL_R(Z3_mk_linear_order, OP_SPECIAL_RELATION_LO); MK_SPECIAL_R(Z3_mk_partial_order, OP_SPECIAL_RELATION_PO); MK_SPECIAL_R(Z3_mk_piecewise_linear_order, OP_SPECIAL_RELATION_PLO); MK_SPECIAL_R(Z3_mk_tree_order, OP_SPECIAL_RELATION_TO); + END_DISABLE_WARNING; #define MK_DECL(NAME, FID) \ @@ -60,5 +63,7 @@ extern "C" { Z3_CATCH_RETURN(nullptr); \ } + START_DISABLE_EXTRA_SEMI_WARNING; MK_DECL(Z3_mk_transitive_closure, OP_SPECIAL_RELATION_TC); + END_DISABLE_WARNING; } diff --git a/src/api/js/package-lock.json b/src/api/js/package-lock.json index be36753542..de9145bc51 100644 --- a/src/api/js/package-lock.json +++ b/src/api/js/package-lock.json @@ -5400,9 +5400,9 @@ "dev": true }, "node_modules/linkify-it": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.1.tgz", - "integrity": "sha512-wVoTjP4Q6R0NW5hiZkVJaFZPWgtXfoGF+6LucL3/FtiNjmcHhYjEr5f1Kqjirc1nBW07J/ZuRFumqr2oqccEWg==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.2.tgz", + "integrity": "sha512-ONTm2jCMAVZjgQa/Fy1kScXsuOoF5NPTsoFBdE1KVIZ2vAh/r9+Bqo+0jINCBYnavTPQZz38QzFTme79ENoN3Q==", "dev": true, "funding": [ { @@ -6132,9 +6132,9 @@ } }, "node_modules/shell-quote": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.4.tgz", - "integrity": "sha512-VsC6n6vz1ihYYyZZwX7YZSF5l5x36ca17OC+a69h94YqB7X6XLwf+5MOgynYir2SLFUbl8gIYvBo8K8RoNQ6bQ==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.10.0.tgz", + "integrity": "sha512-w1aiOKwKuRgtwAReIIj89puqg+I7GvX4IbLrvmhXbzQsj1+Zwi4VO3+fa6ZF91TWSjIxoEkKnMeHcLEODK5ZXA==", "dev": true, "license": "MIT", "engines": { diff --git a/src/api/js/src/high-level/high-level.ts b/src/api/js/src/high-level/high-level.ts index f336fe30ba..5625637fb7 100644 --- a/src/api/js/src/high-level/high-level.ts +++ b/src/api/js/src/high-level/high-level.ts @@ -2796,7 +2796,7 @@ export function createApi(Z3: Z3Core, em?: any): Z3HighLevel { for (let i = 0; i < a.numEntries(); i++) { const e = a.entry(i); const n = e.numArgs(); - const args = global.Array(n).map((_, i) => e.argValue(i)); + const args = globalThis.Array.from({ length: n }, (_, i) => e.argValue(i)); funcInterp.addEntry(args, e.value()); } return; diff --git a/src/api/python/CMakeLists.txt b/src/api/python/CMakeLists.txt index 2d08d2cd61..2dc30fa8ba 100644 --- a/src/api/python/CMakeLists.txt +++ b/src/api/python/CMakeLists.txt @@ -20,6 +20,13 @@ set(z3py_bindings_build_dest "${PROJECT_BINARY_DIR}/python") file(MAKE_DIRECTORY "${z3py_bindings_build_dest}") file(MAKE_DIRECTORY "${z3py_bindings_build_dest}/z3") +set(z3py_soversion_args "") +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(z3py_soversion_args + "--z3py-soversion" + "${Z3_VERSION_MAJOR}.${Z3_VERSION_MINOR}") +endif() + set(build_z3_python_bindings_target_depends "") foreach (z3py_file ${z3py_files}) add_custom_command(OUTPUT "${z3py_bindings_build_dest}/${z3py_file}" @@ -37,6 +44,7 @@ add_custom_command(OUTPUT "${z3py_bindings_build_dest}/z3/z3core.py" COMMAND "${Python3_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/update_api.py" ${Z3_FULL_PATH_API_HEADER_FILES_TO_SCAN} + ${z3py_soversion_args} "--z3py-output-dir" "${z3py_bindings_build_dest}" DEPENDS @@ -93,6 +101,17 @@ if (TARGET libz3) DEPENDS ${LIBZ3_DEPENDS} COMMENT "Linking libz3 into python directory" ) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + add_custom_command(OUTPUT "${z3py_bindings_build_dest}/libz3${CMAKE_SHARED_MODULE_SUFFIX}.${Z3_VERSION_MAJOR}.${Z3_VERSION_MINOR}" + COMMAND "${CMAKE_COMMAND}" "-E" "${LINK_COMMAND}" + "${LIBZ3_SOURCE_PATH}" + "${z3py_bindings_build_dest}/libz3${CMAKE_SHARED_MODULE_SUFFIX}.${Z3_VERSION_MAJOR}.${Z3_VERSION_MINOR}" + DEPENDS ${LIBZ3_DEPENDS} + COMMENT "Linking versioned libz3 into python directory" + ) + list(APPEND build_z3_python_bindings_target_depends + "${z3py_bindings_build_dest}/libz3${CMAKE_SHARED_MODULE_SUFFIX}.${Z3_VERSION_MAJOR}.${Z3_VERSION_MINOR}") + endif() else() message(FATAL_ERROR "libz3 target not found. Cannot build Python bindings.") endif() diff --git a/src/api/python/pyproject.toml b/src/api/python/pyproject.toml index 52c6db5946..3d59010943 100644 --- a/src/api/python/pyproject.toml +++ b/src/api/python/pyproject.toml @@ -26,4 +26,4 @@ build = "cp314-*" [tool.cibuildwheel.pyodide] # z3test.py is the upstream smoke test; run it inside the Pyodide test venv. -test-command = "python {project}/z3test.py z3" +test-command = "python {project}/src/api/python/z3test.py z3" diff --git a/src/api/python/setup.py b/src/api/python/setup.py index d02cd39787..51d1c3df1e 100644 --- a/src/api/python/setup.py +++ b/src/api/python/setup.py @@ -83,15 +83,19 @@ BINS_DIR = os.path.join(ROOT_DIR, 'bin') # determine platform-specific filenames +EXECUTABLE_FILE_FALLBACKS = [] if BUILD_PLATFORM in ('sequoia','darwin', 'osx'): LIBRARY_FILE = "libz3.dylib" - EXECUTABLE_FILE = "z3" + EXECUTABLE_FILE = "z3" elif BUILD_PLATFORM in ('win32', 'cygwin', 'win'): LIBRARY_FILE = "libz3.dll" EXECUTABLE_FILE = "z3.exe" elif BUILD_PLATFORM in ('emscripten',): LIBRARY_FILE = "libz3.so" EXECUTABLE_FILE = "z3.wasm" + # Depending on emscripten/toolchain details, the shell target can appear + # as z3.js.wasm or z3; package it consistently as z3.wasm. + EXECUTABLE_FILE_FALLBACKS = ["z3.js.wasm", "z3"] else: LIBRARY_FILE = "libz3.so" EXECUTABLE_FILE = "z3" @@ -159,7 +163,13 @@ def _configure_z3(): 'Z3_BUILD_PYTHON_BINDINGS' : True, # Build Options 'CMAKE_BUILD_TYPE' : 'Release', - 'Z3_BUILD_EXECUTABLE' : True, + # For Pyodide/emscripten builds, skip the z3 shell executable. The + # pyodide ldflags include -sSIDE_MODULE=1 which cmake propagates to + # CMAKE_EXE_LINKER_FLAGS, causing the shell to be linked as a WASM + # side-module whose output name cannot be predicted reliably. Python + # users only need libz3.so (loaded via ctypes); the CLI is not usable + # inside a Pyodide environment anyway. + 'Z3_BUILD_EXECUTABLE' : not IS_PYODIDE, 'Z3_BUILD_LIBZ3_SHARED' : True, 'Z3_LINK_TIME_OPTIMIZATION' : ENABLE_LTO, 'WARNINGS_AS_ERRORS' : 'SERIOUS_ONLY', @@ -222,10 +232,22 @@ def _copy_bins(): # STEP 2: Copy the shared library, the executable and the headers os.mkdir(LIBS_DIR) - os.mkdir(BINS_DIR) os.mkdir(HEADERS_DIR) shutil.copy(os.path.join(BUILD_DIR, LIBRARY_FILE), LIBS_DIR) - shutil.copy(os.path.join(BUILD_DIR, EXECUTABLE_FILE), BINS_DIR) + if not IS_PYODIDE: + # The shell executable is not built for Pyodide (see _configure_z3). + os.mkdir(BINS_DIR) + executable_src = None + executable_names = (EXECUTABLE_FILE,) + tuple(EXECUTABLE_FILE_FALLBACKS) + for executable_name in executable_names: + executable_src_candidate = os.path.join(BUILD_DIR, executable_name) + if os.path.exists(executable_src_candidate): + executable_src = executable_src_candidate + break + if executable_src is None: + attempted_files = "\n- ".join(os.path.join(BUILD_DIR, executable_name) for executable_name in executable_names) + raise FileNotFoundError(f"Could not find any executable in build directory. Tried:\n- {attempted_files}") + shutil.copy(executable_src, os.path.join(BINS_DIR, EXECUTABLE_FILE)) path1 = glob.glob(os.path.join(BUILD_DIR, "msvcp*")) path2 = glob.glob(os.path.join(BUILD_DIR, "vcomp*")) path3 = glob.glob(os.path.join(BUILD_DIR, "vcrun*")) @@ -371,6 +393,6 @@ setup( package_data={ 'z3': [os.path.join('lib', '*'), os.path.join('include', '*.h'), os.path.join('include', 'c++', '*.h')] }, - data_files=[('bin',[os.path.join('bin',EXECUTABLE_FILE)])], + data_files=[('bin',[os.path.join('bin',EXECUTABLE_FILE)])] if not IS_PYODIDE else [], cmdclass={'build': build, 'develop': develop, 'sdist': sdist, 'bdist_wheel': bdist_wheel}, ) diff --git a/src/api/python/z3/z3.py b/src/api/python/z3/z3.py index c3d9ee34d6..2634ca4d3b 100644 --- a/src/api/python/z3/z3.py +++ b/src/api/python/z3/z3.py @@ -8098,7 +8098,7 @@ class Solver(Z3PPObject): while s.check() == sat: result = [s.model().eval(t_, model_completion=True) for t_ in t] yield result - s.add(*(t_ != result_ for t_, result_ in zip(t, result))) + s.add(Or(t_ != result_ for t_, result_ in zip(t, result))) else: while s.check() == sat: result = s.model().eval(t, model_completion=True) diff --git a/src/ast/arith_decl_plugin.h b/src/ast/arith_decl_plugin.h index db88f068f9..943626a73a 100644 --- a/src/ast/arith_decl_plugin.h +++ b/src/ast/arith_decl_plugin.h @@ -346,6 +346,7 @@ public: is_pi(n); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_UNARY(is_uminus); MATCH_UNARY(is_to_real); MATCH_UNARY(is_to_int); @@ -378,6 +379,7 @@ public: MATCH_UNARY(is_tan); MATCH_UNARY(is_atan); MATCH_UNARY(is_atanh); + END_DISABLE_WARNING; }; diff --git a/src/ast/array_decl_plugin.h b/src/ast/array_decl_plugin.h index 0c4983eec2..0a888b8502 100644 --- a/src/ast/array_decl_plugin.h +++ b/src/ast/array_decl_plugin.h @@ -19,6 +19,7 @@ Revision History: #pragma once #include "ast/ast.h" +#include "util/manage_warnings.h" inline sort* get_array_range(sort const * s) { @@ -207,7 +208,9 @@ public: } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_BINARY(is_subset); + END_DISABLE_WARNING; }; class array_util : public array_recognizers { diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp index b0fa217d62..edc4009b06 100644 --- a/src/ast/ast.cpp +++ b/src/ast/ast.cpp @@ -2102,10 +2102,15 @@ expr* ast_manager::coerce_to(expr* e, sort* s) { } if (s != se && s->get_family_id() == arith_family_id && is_bool(e)) { arith_util au(*this); - if (s->get_decl_kind() == REAL_SORT) - return mk_ite(e, au.mk_real(1), au.mk_real(0)); - else - return mk_ite(e, au.mk_int(1), au.mk_int(0)); + if (s->get_decl_kind() == REAL_SORT) { + auto _seqr0 = au.mk_real(1); + auto _seqr1 = au.mk_real(0); + return mk_ite(e, _seqr0, _seqr1); + } else { + auto _seq2108_0 = au.mk_int(1); + auto _seq2108_1 = au.mk_int(0); + return mk_ite(e, _seq2108_0, _seq2108_1); + } } else { return e; diff --git a/src/ast/ast.h b/src/ast/ast.h index 03713ee4b8..4c68fdcea7 100644 --- a/src/ast/ast.h +++ b/src/ast/ast.h @@ -47,6 +47,7 @@ Revision History: #include "util/z3_exception.h" #include "util/dependency.h" #include "util/rlimit.h" +#include "util/manage_warnings.h" #include #include #include @@ -2168,6 +2169,7 @@ public: public: + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_UNARY(is_not); MATCH_BINARY(is_eq); MATCH_BINARY(is_implies); @@ -2176,6 +2178,7 @@ public: MATCH_BINARY(is_xor); MATCH_TERNARY(is_and); MATCH_TERNARY(is_or); + END_DISABLE_WARNING; bool is_iff(expr const* n, expr*& lhs, expr*& rhs) const { return is_eq(n, lhs, rhs) && is_bool(lhs); } @@ -2311,9 +2314,11 @@ public: bool is_apply_def(expr const * e) const { return is_app_of(e, basic_family_id, PR_APPLY_DEF); } bool is_skolemize(expr const * e) const { return is_app_of(e, basic_family_id, PR_SKOLEMIZE); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_UNARY(is_asserted); MATCH_UNARY(is_hypothesis); MATCH_UNARY(is_lemma); + END_DISABLE_WARNING; bool has_fact(proof const * p) const { SASSERT(is_proof(p)); diff --git a/src/ast/bv_decl_plugin.cpp b/src/ast/bv_decl_plugin.cpp index 74368ecec5..c8dafb2ae3 100644 --- a/src/ast/bv_decl_plugin.cpp +++ b/src/ast/bv_decl_plugin.cpp @@ -977,9 +977,11 @@ app* bv_util::mk_sbv2int_as_ubv2int(expr* e) { arith_util autil(m_manager); unsigned sz = get_bv_size(e); expr_ref zero(mk_numeral(rational::zero(), sz), m_manager); - r = m_manager.mk_ite(mk_slt(e, zero), - autil.mk_sub(r, autil.mk_numeral(rational::power_of_two(sz), true)), - r); + { + auto _seq980_0 = mk_slt(e, zero); + auto _seq980_1 = autil.mk_sub(r, autil.mk_numeral(rational::power_of_two(sz), true)); + r = m_manager.mk_ite(_seq980_0, _seq980_1, r); + } return r; } @@ -1012,12 +1014,17 @@ void bv_util::mk_bv_divrem_bound(expr* t, expr_ref_vector& clause) { // OP_ULT is not handled by theory_bv::internalize_atom and would trigger UNREACHABLE. if (is_bv_urem(t) || is_bv_uremi(t)) bound = m_manager.mk_not(mk_ule(b, t)); - else if (is_bv_srem(t) || is_bv_sremi(t) || is_bv_smod(t) || is_bv_smodi(t)) - bound = m_manager.mk_not(mk_ule(mk_abs(b), mk_abs(t))); - else if (is_bv_udiv(t) || is_bv_udivi(t)) + else if (is_bv_srem(t) || is_bv_sremi(t) || is_bv_smod(t) || is_bv_smodi(t)) { + auto _seq0 = mk_abs(b); + auto _seq1 = mk_abs(t); + bound = m_manager.mk_not(mk_ule(_seq0, _seq1)); + } else if (is_bv_udiv(t) || is_bv_udivi(t)) bound = mk_ule(t, a); - else if (is_bv_sdiv(t) || is_bv_sdivi(t)) - bound = mk_ule(mk_abs(t), mk_abs(a)); + else if (is_bv_sdiv(t) || is_bv_sdivi(t)) { + auto _seq0 = mk_abs(t); + auto _seq1 = mk_abs(a); + bound = mk_ule(_seq0, _seq1); + } if (!bound) return; // clause encodes b != 0 => bound as the disjunction (b = 0) \/ bound diff --git a/src/ast/bv_decl_plugin.h b/src/ast/bv_decl_plugin.h index 8900c53d0a..2d769fc9d6 100644 --- a/src/ast/bv_decl_plugin.h +++ b/src/ast/bv_decl_plugin.h @@ -390,6 +390,7 @@ public: return is_int2bv(e) && (n = to_app(e)->get_parameter(0).get_int(), x = to_app(e)->get_arg(0), true); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_UNARY(is_bv_not); MATCH_UNARY(is_redand); MATCH_UNARY(is_redor); @@ -439,6 +440,7 @@ public: MATCH_BINARY(is_bv_smod0); MATCH_UNARY(is_bit2bool); MATCH_UNARY(is_int2bv); + END_DISABLE_WARNING; bool is_bit2bool(expr* e, expr*& bv, unsigned& idx) const; rational norm(rational const & val, unsigned bv_size, bool is_signed = false) const ; diff --git a/src/ast/char_decl_plugin.h b/src/ast/char_decl_plugin.h index 686b7105fe..0501c78b59 100644 --- a/src/ast/char_decl_plugin.h +++ b/src/ast/char_decl_plugin.h @@ -22,6 +22,7 @@ Revision History: --*/ #pragma once +#include "util/manage_warnings.h" #include "util/zstring.h" #include "ast/ast.h" #include @@ -97,11 +98,13 @@ public: bool is_bv2char(expr const* e) const { return is_app_of(e, m_family_id, OP_CHAR_FROM_BV); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_UNARY(is_is_digit); MATCH_UNARY(is_to_int); MATCH_UNARY(is_char2bv); MATCH_UNARY(is_bv2char); MATCH_BINARY(is_le); + END_DISABLE_WARNING; static unsigned max_char() { return zstring::max_char(); } diff --git a/src/ast/converters/expr_inverter.cpp b/src/ast/converters/expr_inverter.cpp index 0e756ebe65..65b5ea16cf 100644 --- a/src/ast/converters/expr_inverter.cpp +++ b/src/ast/converters/expr_inverter.cpp @@ -337,8 +337,11 @@ class bv_expr_inverter : public iexpr_inverter { ++sh; } mk_fresh_uncnstr_var_for(f, r); - if (sh > 0) - r = bv.mk_concat(bv.mk_extract(sz - sh - 1, 0, r), bv.mk_zero(sh)); + if (sh > 0) { + auto _seq0 = bv.mk_extract(sz - sh - 1, 0, r); + auto _seq1 = bv.mk_zero(sh); + r = bv.mk_concat(_seq0, _seq1); + } if (m_mc) { rational inv_r; @@ -427,7 +430,11 @@ class bv_expr_inverter : public iexpr_inverter { if (uncnstr(arg1) && uncnstr(arg2)) { mk_fresh_uncnstr_var_for(f, r); if (m_mc) { - add_def(arg1, m.mk_ite(r, bv.mk_zero(bv_sz), bv.mk_one(bv_sz))); + { + auto _seq430_0 = bv.mk_zero(bv_sz); + auto _seq430_1 = bv.mk_one(bv_sz); + add_def(arg1, m.mk_ite(r, _seq430_0, _seq430_1)); + } add_def(arg2, bv.mk_zero(bv_sz)); } return true; diff --git a/src/ast/datatype_decl_plugin.h b/src/ast/datatype_decl_plugin.h index f7d65f2b43..ba26a05ef6 100644 --- a/src/ast/datatype_decl_plugin.h +++ b/src/ast/datatype_decl_plugin.h @@ -27,6 +27,7 @@ Revision History: #include "util/symbol_table.h" #include "util/obj_hashtable.h" #include "util/dictionary.h" +#include "util/manage_warnings.h" enum sort_kind { @@ -424,9 +425,13 @@ namespace datatype { bool is_recognizer(expr const * f) const { return is_app(f) && (is_recognizer0(to_app(f)) || is_is(to_app(f))); } bool is_considered_uninterpreted(func_decl * f, unsigned n, expr* const* args); + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_UNARY(is_recognizer); + END_DISABLE_WARNING; bool is_accessor(expr const* e) const { return is_app(e) && is_app_of(to_app(e), fid(), OP_DT_ACCESSOR); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_UNARY(is_accessor); + END_DISABLE_WARNING; bool is_update_field(expr * f) const { return is_app(f) && is_app_of(to_app(f), fid(), OP_DT_UPDATE_FIELD); } app* mk_is(func_decl * c, expr *f); ptr_vector const * get_datatype_constructors(sort * ty); diff --git a/src/ast/euf/euf_ac_plugin.cpp b/src/ast/euf/euf_ac_plugin.cpp index 89d25b1545..705e46bbea 100644 --- a/src/ast/euf/euf_ac_plugin.cpp +++ b/src/ast/euf/euf_ac_plugin.cpp @@ -992,7 +992,7 @@ namespace euf { SASSERT(is_correct_ref_count(monomial(src.r), m_src_r_counts)); SASSERT(is_correct_ref_count(monomial(dst.l), m_dst_l_counts)); SASSERT(is_correct_ref_count(monomial(dst.r), m_dst_r_counts)); - // add difference betwen dst.l and src.l to both src.l, src.r + // add difference between dst.l and src.l to both src.l, src.r for (auto n : monomial(dst.l)) { unsigned id = n->id(); SASSERT(m_dst_l_counts[id] >= m_src_l_counts[id]); diff --git a/src/ast/euf/euf_arith_plugin.cpp b/src/ast/euf/euf_arith_plugin.cpp index 82ce7f2a91..59743a4436 100644 --- a/src/ast/euf/euf_arith_plugin.cpp +++ b/src/ast/euf/euf_arith_plugin.cpp @@ -78,7 +78,13 @@ namespace euf { push_merge(n, n1); } if (a.is_uminus(e, x)) { - NOT_IMPLEMENTED_YET(); + // -x = -1 * x + auto e1 = a.mk_numeral(rational(-1), a.is_int(x)); + auto n1 = g.find(e1) ? g.find(e1) : g.mk(e1, 0, 0, nullptr); + auto e2 = a.mk_mul(e1, x); + enode* es1[2] = { n1, g.find(x) }; + auto mul = g.find(e2) ? g.find(e2) : g.mk(e2, 0, 2, es1); + push_merge(n, mul); } } diff --git a/src/ast/euf/ho_matcher.cpp b/src/ast/euf/ho_matcher.cpp index c85914e8f1..334487bf20 100644 --- a/src/ast/euf/ho_matcher.cpp +++ b/src/ast/euf/ho_matcher.cpp @@ -49,6 +49,15 @@ Author: namespace euf { + namespace { + struct scoped_trail_level { + trail_stack& m_trail; + unsigned m_base; + scoped_trail_level(trail_stack& t) : m_trail(t), m_base(t.get_num_scopes()) {} + ~scoped_trail_level() { m_trail.pop_scope(m_trail.get_num_scopes() - m_base); } + }; + } + expr_ref_vector const &ho_subst::get_binding(quantifier *q) { ast_manager &m = m_subst.get_manager(); m_binding.reset(); @@ -102,25 +111,34 @@ namespace euf { } void ho_matcher::operator()(expr* pat, expr* t, unsigned num_bound, unsigned num_vars) { + scoped_trail_level _restore(m_trail); m_trail.push_scope(); m_subst.resize(0); m_subst.resize(num_vars); m_goals.reset(); m_goals.push(0, num_bound, pat, t); search(); - m_trail.pop_scope(1); } void ho_matcher::search() { IF_VERBOSE(10, display(verbose_stream())); + struct drain_backtrack { + ho_matcher &m; + drain_backtrack(ho_matcher &m) : m(m) {} + ~drain_backtrack() { + while (!m.m_backtrack.empty()) { + m.backtrack(); + } + } + }; + + drain_backtrack _drain(*this); unsigned budget = m_max_iterations; while (m.inc()) { if (budget-- == 0) { IF_VERBOSE(2, verbose_stream() << "ho_matcher: search budget exhausted\n"); - while (!m_backtrack.empty()) - backtrack(); break; } // Q, B -> Q', B'. Push work on the backtrack stack and new work items @@ -947,7 +965,7 @@ namespace euf { auto& abs = m_pat2abs[fo_pat]; verbose_stream() << " m_pat2abs size: " << abs.size() << "\n"; for (auto [v, pat] : abs) verbose_stream() << " v=" << v << " pat=" << mk_pp(pat, m) << "\n";); - unsigned base_scope = m_trail.get_num_scopes(); + scoped_trail_level _restore(m_trail); m_trail.push_scope(); m_subst.resize(0); m_subst.resize(s.size()); @@ -974,7 +992,6 @@ namespace euf { // higher-order pattern. Discard this refinement candidate (produce // no instance) instead of aborting the whole solve. if (!subst_sorts_match(m, pat, s, true)) { - m_trail.pop_scope(1); IF_VERBOSE(0, verbose_stream() << "refine_ho_match: sorts do not match for " << mk_pp(pat, m) << " and " << s << "\n";); UNREACHABLE(); @@ -988,8 +1005,6 @@ namespace euf { m_goals.push(level, num_bound, pat_refined, m_subst.get(v)); } search(); - - m_trail.pop_scope(1); } bool ho_matcher::subst_sorts_match(ast_manager& m, expr* t, expr_ref_vector const& s, bool std_order) { diff --git a/src/ast/finite_set_decl_plugin.h b/src/ast/finite_set_decl_plugin.h index ea9ab19f07..d73f8e71cb 100644 --- a/src/ast/finite_set_decl_plugin.h +++ b/src/ast/finite_set_decl_plugin.h @@ -30,6 +30,7 @@ Operators: #include "ast/ast.h" #include "ast/polymorphism_util.h" +#include "util/manage_warnings.h" enum finite_set_sort_kind { FINITE_SET_SORT @@ -137,6 +138,7 @@ public: bool is_range(expr const* n) const { return is_app_of(n, m_fid, OP_FINITE_SET_RANGE); } bool is_unique_set(expr const *n) const { return is_app_of(n, m_fid, OP_FINITE_SET_UNIQUE_SET); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_UNARY(is_singleton); MATCH_UNARY(is_size); MATCH_BINARY(is_union); @@ -148,6 +150,7 @@ public: MATCH_BINARY(is_filter); MATCH_BINARY(is_range); MATCH_BINARY(is_unique_set); + END_DISABLE_WARNING; }; class finite_set_util : public finite_set_recognizers { diff --git a/src/ast/fpa/fpa2bv_converter.cpp b/src/ast/fpa/fpa2bv_converter.cpp index d2431174e8..7f17935123 100644 --- a/src/ast/fpa/fpa2bv_converter.cpp +++ b/src/ast/fpa/fpa2bv_converter.cpp @@ -3237,8 +3237,9 @@ void fpa2bv_converter::mk_to_fp_unsigned(func_decl * f, unsigned num, expr * con // exp < bv_sz (+sign bit which is [0]) unsigned exp_worst_case_sz = (unsigned)((log((double)bv_sz) / log((double)2)) + 1.0); - if (exp_sz < exp_worst_case_sz) { - // exp_sz < exp_worst_case_sz and exp >= 0. + if (exp_sz <= exp_worst_case_sz) { + // round() interprets exp as signed, so replace positive values that + // cannot be represented before it consumes the narrowed exponent. // Take the maximum legal exponent; this // allows us to keep the most precision. expr_ref max_exp(m), max_exp_bvsz(m), zero_sig_sz(m); diff --git a/src/ast/fpa_decl_plugin.cpp b/src/ast/fpa_decl_plugin.cpp index e255f4b108..533383484b 100644 --- a/src/ast/fpa_decl_plugin.cpp +++ b/src/ast/fpa_decl_plugin.cpp @@ -1091,6 +1091,13 @@ bool fpa_util::is_considered_uninterpreted(func_decl * f, unsigned n, expr* cons scoped_mpf sv(fm()); if (!is_rm_numeral(rm, rmv) || !is_numeral(x, sv)) return false; if (is_nan(x) || is_inf(x)) return true; + // A finite value whose (unbiased) binary exponent is at least bv_sz has + // magnitude >= 2^bv_sz, so it cannot fit into a bv_sz-bit signed or + // unsigned integer and the conversion is unspecified. Detect this here to + // avoid calling to_sbv_mpq, which rejects exponents that do not fit into + // an int (throwing "exponents over 31 bits are not supported"). + if (plugin().fm().exp(sv) >= (mpf_exp_t)bv_sz) + return true; unsynch_mpq_manager& mpqm = plugin().fm().mpq_manager(); scoped_mpq r(mpqm); plugin().fm().to_sbv_mpq(rmv, sv, r); diff --git a/src/ast/fpa_decl_plugin.h b/src/ast/fpa_decl_plugin.h index 39b3fc33c4..a32d045ac8 100644 --- a/src/ast/fpa_decl_plugin.h +++ b/src/ast/fpa_decl_plugin.h @@ -22,6 +22,7 @@ Revision History: #include "util/id_gen.h" #include "ast/arith_decl_plugin.h" #include "ast/bv_decl_plugin.h" +#include "util/manage_warnings.h" #include "util/mpf.h" enum fpa_sort_kind { @@ -366,6 +367,8 @@ public: bool is_considered_uninterpreted(func_decl* f, unsigned n, expr* const* args); + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_TERNARY(is_fp); + END_DISABLE_WARNING; }; diff --git a/src/ast/normal_forms/nnf.cpp b/src/ast/normal_forms/nnf.cpp index 219cea3f86..84079bf7c8 100644 --- a/src/ast/normal_forms/nnf.cpp +++ b/src/ast/normal_forms/nnf.cpp @@ -512,10 +512,12 @@ struct nnf::imp { fr.m_i = 1; if (!visit(t->get_arg(0), !fr.m_pol, fr.m_in_q)) return false; + Z3_fallthrough; case 1: fr.m_i = 2; if (!visit(t->get_arg(1), fr.m_pol, fr.m_in_q)) return false; + Z3_fallthrough; default: break; } @@ -544,18 +546,22 @@ struct nnf::imp { fr.m_i = 1; if (!visit(t->get_arg(0), true, fr.m_in_q)) return false; + Z3_fallthrough; case 1: fr.m_i = 2; if (!visit(t->get_arg(0), false, fr.m_in_q)) return false; + Z3_fallthrough; case 2: fr.m_i = 3; if (!visit(t->get_arg(1), fr.m_pol, fr.m_in_q)) return false; + Z3_fallthrough; case 3: fr.m_i = 4; if (!visit(t->get_arg(2), fr.m_pol, fr.m_in_q)) return false; + Z3_fallthrough; default: break; } @@ -589,18 +595,22 @@ struct nnf::imp { fr.m_i = 1; if (!visit(t->get_arg(0), true, fr.m_in_q)) return false; + Z3_fallthrough; case 1: fr.m_i = 2; if (!visit(t->get_arg(0), false, fr.m_in_q)) return false; + Z3_fallthrough; case 2: fr.m_i = 3; if (!visit(t->get_arg(1), true, fr.m_in_q)) return false; + Z3_fallthrough; case 3: fr.m_i = 4; if (!visit(t->get_arg(1), false, fr.m_in_q)) return false; + Z3_fallthrough; default: break; } diff --git a/src/ast/rewriter/CMakeLists.txt b/src/ast/rewriter/CMakeLists.txt index 9f4d7fe436..4061c1de0e 100644 --- a/src/ast/rewriter/CMakeLists.txt +++ b/src/ast/rewriter/CMakeLists.txt @@ -41,9 +41,10 @@ z3_add_component(rewriter seq_eq_solver.cpp seq_derive.cpp seq_monadic.cpp - seq_subset.cpp seq_split.cpp + seq_subset.cpp seq_derive.cpp + seq_monadic.cpp seq_range_collapse.cpp seq_range_predicate.cpp seq_rewriter.cpp diff --git a/src/ast/rewriter/arith_rewriter.cpp b/src/ast/rewriter/arith_rewriter.cpp index b22ce62738..d002158800 100644 --- a/src/ast/rewriter/arith_rewriter.cpp +++ b/src/ast/rewriter/arith_rewriter.cpp @@ -662,16 +662,26 @@ br_status arith_rewriter::factor_le_ge_eq(expr * arg1, expr * arg2, op_kind kind expr* f = *opt_f; expr_ref f2 = remove_factor(f, arg1); expr* z = m_util.mk_numeral(rational(0), m_util.is_int(arg1)); - result = m.mk_or(m_util.mk_eq(f, z), m_util.mk_eq(f2, z)); + { + auto _seq665_0 = m_util.mk_eq(f, z); + auto _seq665_1 = m_util.mk_eq(f2, z); + result = m.mk_or(_seq665_0, _seq665_1); + } switch (kind) { case EQ: break; - case GE: - result = m.mk_or(m.mk_iff(m_util.mk_ge(f, z), m_util.mk_ge(f2, z)), result); + case GE: { + auto _seq0 = m_util.mk_ge(f, z); + auto _seq1 = m_util.mk_ge(f2, z); + result = m.mk_or(m.mk_iff(_seq0, _seq1), result); break; - case LE: - result = m.mk_or(m.mk_not(m.mk_iff(m_util.mk_ge(f, z), m_util.mk_ge(f2, z))), result); - break; + } + case LE: { + auto _seq0 = m_util.mk_ge(f, z); + auto _seq1 = m_util.mk_ge(f2, z); + result = m.mk_or(m.mk_not(m.mk_iff(_seq0, _seq1)), result); + break; + } } return BR_REWRITE3; } @@ -859,7 +869,11 @@ bool arith_rewriter::is_arith_term(expr * n) const { br_status arith_rewriter::mk_eq_core(expr * arg1, expr * arg2, expr_ref & result) { br_status st = BR_FAILED; if (m_eq2ineq) { - result = m.mk_and(m_util.mk_le(arg1, arg2), m_util.mk_ge(arg1, arg2)); + { + auto _seq862_0 = m_util.mk_le(arg1, arg2); + auto _seq862_1 = m_util.mk_ge(arg1, arg2); + result = m.mk_and(_seq862_0, _seq862_1); + } st = BR_REWRITE2; } else if (m_arith_lhs || is_arith_term(arg1) || is_arith_term(arg2)) { @@ -908,8 +922,11 @@ bool arith_rewriter::mk_eq_mod(expr* arg1, expr* arg2, expr_ref& result) { rational g = gcd(p, k, a, b); if (g == 1) { expr_ref nb(m_util.mk_numeral(b, true), m); - result = m.mk_eq(m_util.mk_mod(u, y), - m_util.mk_mod(m_util.mk_mul(nb, arg2), y)); + { + auto _seq911_0 = m_util.mk_mod(u, y); + auto _seq911_1 = m_util.mk_mod(m_util.mk_mul(nb, arg2), y); + result = m.mk_eq(_seq911_0, _seq911_1); + } return true; } } @@ -1229,10 +1246,17 @@ br_status arith_rewriter::mk_div_core(expr * arg1, expr * arg2, expr_ref & resul TRACE(div_bug, tout << "v1: " << v1 << ", v2: " << v2 << "\n";); if (!v1.is_one() || !v2.is_one()) { v1 /= v2; - result = m_util.mk_mul(m_util.mk_numeral(v1, false), - m_util.mk_div(b, d)); + { + auto _seq1232_0 = m_util.mk_numeral(v1, false); + auto _seq1232_1 = m_util.mk_div(b, d); + result = m_util.mk_mul(_seq1232_0, _seq1232_1); + } expr_ref z(m_util.mk_real(0), m); - result = m.mk_ite(m.mk_eq(d, z), m_util.mk_div(arg1, z), result); + { + auto _seq1235_0 = m.mk_eq(d, z); + auto _seq1235_1 = m_util.mk_div(arg1, z); + result = m.mk_ite(_seq1235_0, _seq1235_1, result); + } return BR_REWRITE2; } } @@ -1242,7 +1266,11 @@ br_status arith_rewriter::mk_div_core(expr * arg1, expr * arg2, expr_ref & resul } br_status arith_rewriter::mk_idivides(unsigned k, expr * arg, expr_ref & result) { - result = m.mk_eq(m_util.mk_mod(arg, m_util.mk_int(k)), m_util.mk_int(0)); + { + auto _seq1245_0 = m_util.mk_mod(arg, m_util.mk_int(k)); + auto _seq1245_1 = m_util.mk_int(0); + result = m.mk_eq(_seq1245_0, _seq1245_1); + } return BR_REWRITE2; } @@ -1267,9 +1295,14 @@ br_status arith_rewriter::mk_idiv_core(expr * arg1, expr * arg2, expr_ref & resu if (is_num2 && v2.is_zero()) { return BR_FAILED; } - if (arg1 == arg2) { - expr_ref zero(m_util.mk_int(0), m); - result = m.mk_ite(m.mk_eq(arg1, zero), m_util.mk_idiv(zero, zero), m_util.mk_int(1)); + if (arg1 == arg2) { + expr_ref zero(m_util.mk_int(0), m); + { + auto _seq1272_0 = m.mk_eq(arg1, zero); + auto _seq1272_1 = m_util.mk_idiv(zero, zero); + auto _seq1272_2 = m_util.mk_int(1); + result = m.mk_ite(_seq1272_0, _seq1272_1, _seq1272_2); + } return BR_REWRITE3; } if (is_num2 && v2.is_pos() && m_util.is_add(arg1)) { @@ -1294,9 +1327,13 @@ br_status arith_rewriter::mk_idiv_core(expr * arg1, expr * arg2, expr_ref & resu return BR_REWRITE3; } } - if (get_divides(arg1, arg2, result)) { - expr_ref zero(m_util.mk_int(0), m); - result = m.mk_ite(m.mk_eq(zero, arg2), m_util.mk_idiv(arg1, zero), result); + if (get_divides(arg1, arg2, result)) { + expr_ref zero(m_util.mk_int(0), m); + { + auto _seq1299_0 = m.mk_eq(zero, arg2); + auto _seq1299_1 = m_util.mk_idiv(arg1, zero); + result = m.mk_ite(_seq1299_0, _seq1299_1, result); + } return BR_REWRITE_FULL; } #if 0 @@ -1366,13 +1403,13 @@ expr_ref arith_rewriter::remove_divisor(expr* arg, expr* num, expr* den) { num = args1.empty() ? m_util.mk_int(1) : m_util.mk_mul(args1.size(), args1.data()); den = args2.empty() ? m_util.mk_int(1) : m_util.mk_mul(args2.size(), args2.data()); expr_ref d(m_util.mk_idiv(num, den), m); - expr_ref nd(m_util.mk_idiv(m_util.mk_uminus(num), m_util.mk_uminus(den)), m); - return expr_ref(m.mk_ite(m.mk_eq(zero, arg), - m_util.mk_idiv(zero, zero), - m.mk_ite(m_util.mk_ge(arg, zero), - d, - nd)), - m); + auto _sequm0 = m_util.mk_uminus(num); + auto _sequm1 = m_util.mk_uminus(den); + expr_ref nd(m_util.mk_idiv(_sequm0, _sequm1), m); + auto _seqi0 = m.mk_eq(zero, arg); + auto _seqi1 = m_util.mk_idiv(zero, zero); + auto _seqi2 = m.mk_ite(m_util.mk_ge(arg, zero), d, nd); + return expr_ref(m.mk_ite(_seqi0, _seqi1, _seqi2), m); } void arith_rewriter::flat_mul(expr* e, ptr_buffer& args) { @@ -1424,7 +1461,11 @@ br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & resul if (arg1 == arg2 && !is_num2) { expr_ref zero(m_util.mk_int(0), m); - result = m.mk_ite(m.mk_eq(arg2, zero), m_util.mk_mod(zero, zero), zero); + { + auto _seq1427_0 = m.mk_eq(arg2, zero); + auto _seq1427_1 = m_util.mk_mod(zero, zero); + result = m.mk_ite(_seq1427_0, _seq1427_1, zero); + } return BR_DONE; } @@ -1440,9 +1481,11 @@ br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & resul // for y = 0, both sides evaluate to mod0(mod0(x,0),0). if (!is_num2 && m_util.is_int(arg2)) { expr_ref zero(m_util.mk_int(0), m); - result = m.mk_ite(m.mk_eq(arg2, zero), - m_util.mk_mod(m_util.mk_mod(t1, zero), zero), - arg1); + { + auto _seq1443_0 = m.mk_eq(arg2, zero); + auto _seq1443_1 = m_util.mk_mod(m_util.mk_mod(t1, zero), zero); + result = m.mk_ite(_seq1443_0, _seq1443_1, arg1); + } return BR_REWRITE2; } } @@ -1517,7 +1560,11 @@ br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & resul expr* x = nullptr, * y = nullptr, * z = nullptr; if (is_num2 && v2.is_pos() && m_util.is_mul(arg1, x, y) && m_util.is_numeral(x, v1, is_int) && v1 > 0 && divides(v1, v2)) { - result = m_util.mk_mul(m_util.mk_int(v1), m_util.mk_mod(y, m_util.mk_int(v2/v1))); + { + auto _seq1520_0 = m_util.mk_int(v1); + auto _seq1520_1 = m_util.mk_mod(y, m_util.mk_int(v2 / v1)); + result = m_util.mk_mul(_seq1520_0, _seq1520_1); + } return BR_REWRITE1; } @@ -1594,9 +1641,11 @@ br_status arith_rewriter::mk_rem_core(expr * arg1, expr * arg2, expr_ref & resul } else if (m_elim_rem) { expr * mod = m_util.mk_mod(arg1, arg2); - result = m.mk_ite(m_util.mk_ge(arg2, m_util.mk_numeral(rational(0), true)), - mod, - m_util.mk_uminus(mod)); + { + auto _seq1597_0 = m_util.mk_ge(arg2, m_util.mk_numeral(rational(0), true)); + auto _seq1597_1 = m_util.mk_uminus(mod); + result = m.mk_ite(_seq1597_0, mod, _seq1597_1); + } TRACE(elim_rem, tout << "result: " << mk_ismt2_pp(result, m) << "\n";); return BR_REWRITE3; } @@ -1639,8 +1688,11 @@ br_status arith_rewriter::mk_shl_core(unsigned sz, expr* arg1, expr* arg2, expr_ if (is_num_y) { if (y >= sz) result = m_util.mk_int(0); - else - result = m_util.mk_mod(m_util.mk_mul(arg1, m_util.mk_int(rational::power_of_two(y.get_unsigned()))), m_util.mk_int(N)); + else { + auto _seq1643_0 = m_util.mk_mul(arg1, m_util.mk_int(rational::power_of_two(y.get_unsigned()))); + auto _seq1643_1 = m_util.mk_int(N); + result = m_util.mk_mod(_seq1643_0, _seq1643_1); + } return BR_REWRITE1; } if (is_num_x && x == 0) { @@ -1809,26 +1861,35 @@ br_status arith_rewriter::mk_power_core(expr * arg1, expr * arg2, expr_ref & res if (is_num_y && y.is_minus_one()) { result = m_util.mk_div(m_util.mk_real(1), ensure_real(arg1)); - result = m.mk_ite(m.mk_eq(arg1, m_util.mk_numeral(rational(0), m_util.is_int(arg1))), - m_util.mk_real(0), - result); + { + auto _seq1812_0 = m.mk_eq(arg1, m_util.mk_numeral(rational(0), m_util.is_int(arg1))); + auto _seq1812_1 = m_util.mk_real(0); + result = m.mk_ite(_seq1812_0, _seq1812_1, result); + } return BR_REWRITE2; } if (is_num_y && y.is_neg()) { - // (^ t -k) --> (^ (/ 1 t) k) - result = m_util.mk_power(m_util.mk_div(m_util.mk_numeral(rational(1), false), arg1), - m_util.mk_numeral(-y, false)); - result = m.mk_ite(m.mk_eq(arg1, m_util.mk_numeral(rational(0), m_util.is_int(arg1))), - m_util.mk_real(0), - result); + { + auto _seq1820_0 = m_util.mk_div(m_util.mk_numeral(rational(1), false), arg1); + auto _seq1820_1 = m_util.mk_numeral(-y, false); + result = m_util.mk_power(_seq1820_0, _seq1820_1); + } + { + auto _seq1822_0 = m.mk_eq(arg1, m_util.mk_numeral(rational(0), m_util.is_int(arg1))); + auto _seq1822_1 = m_util.mk_real(0); + result = m.mk_ite(_seq1822_0, _seq1822_1, result); + } return BR_REWRITE3; } if (is_num_y && !y.is_int() && !numerator(y).is_one()) { - // (^ t (/ p q)) --> (^ (^ t (/ 1 q)) p) - result = m_util.mk_power(m_util.mk_power(ensure_real(arg1), m_util.mk_numeral(rational(1)/denominator(y), false)), - m_util.mk_numeral(numerator(y), false)); + { + auto _seq1830_0 = + m_util.mk_power(ensure_real(arg1), m_util.mk_numeral(rational(1) / denominator(y), false)); + auto _seq1830_1 = m_util.mk_numeral(numerator(y), false); + result = m_util.mk_power(_seq1830_0, _seq1830_1); + } return BR_REWRITE3; } @@ -2045,7 +2106,11 @@ br_status arith_rewriter::mk_is_int(expr * arg, expr_ref & result) { } br_status arith_rewriter::mk_abs_core(expr * arg, expr_ref & result) { - result = m.mk_ite(m_util.mk_ge(arg, m_util.mk_numeral(rational(0), m_util.is_int(arg))), arg, m_util.mk_uminus(arg)); + { + auto _seq2048_0 = m_util.mk_ge(arg, m_util.mk_numeral(rational(0), m_util.is_int(arg))); + auto _seq2048_1 = m_util.mk_uminus(arg); + result = m.mk_ite(_seq2048_0, arg, _seq2048_1); + } return BR_REWRITE2; } @@ -2138,7 +2203,9 @@ bool arith_rewriter::is_pi_integer_offset(expr * t, expr * & m) { } app * arith_rewriter::mk_sqrt(rational const & k) { - return m_util.mk_power(m_util.mk_numeral(k, false), m_util.mk_numeral(rational(1, 2), false)); + auto _seq2141_0 = m_util.mk_numeral(k, false); + auto _seq2141_1 = m_util.mk_numeral(rational(1, 2), false); + return m_util.mk_power(_seq2141_0, _seq2141_1); } // Return a constant representing sin(k * pi). @@ -2173,21 +2240,25 @@ expr * arith_rewriter::mk_sin_value(rational const & k) { return neg ? m_util.mk_uminus(result) : result; } if (k_prime == rational(1, 3) || k_prime == rational(2, 3)) { - // sin(pi/3) == sin(2/3 pi) == Sqrt(3)/2 - // sin(4/3 pi) == sin(5/3 pi) == - Sqrt(3)/2 - expr * result = m_util.mk_div(mk_sqrt(rational(3)), m_util.mk_numeral(rational(2), false)); + auto _seq2178_0 = mk_sqrt(rational(3)); + auto _seq2178_1 = m_util.mk_numeral(rational(2), false); + expr* result = m_util.mk_div(_seq2178_0, _seq2178_1); return neg ? m_util.mk_uminus(result) : result; } if (k_prime == rational(1, 12) || k_prime == rational(11, 12)) { - // sin(1/12 pi) == sin(11/12 pi) == [sqrt(6) - sqrt(2)]/4 - // sin(13/12 pi) == sin(23/12 pi) == -[sqrt(6) - sqrt(2)]/4 - expr * result = m_util.mk_div(m_util.mk_sub(mk_sqrt(rational(6)), mk_sqrt(rational(2))), m_util.mk_numeral(rational(4), false)); + auto _seq2242_0 = mk_sqrt(rational(6)); + auto _seq2242_1 = mk_sqrt(rational(2)); + auto _seq2184_0 = m_util.mk_sub(_seq2242_0, _seq2242_1); + auto _seq2184_1 = m_util.mk_numeral(rational(4), false); + expr* result = m_util.mk_div(_seq2184_0, _seq2184_1); return neg ? m_util.mk_uminus(result) : result; } if (k_prime == rational(5, 12) || k_prime == rational(7, 12)) { - // sin(5/12 pi) == sin(7/12 pi) == [sqrt(6) + sqrt(2)]/4 - // sin(17/12 pi) == sin(19/12 pi) == -[sqrt(6) + sqrt(2)]/4 - expr * result = m_util.mk_div(m_util.mk_add(mk_sqrt(rational(6)), mk_sqrt(rational(2))), m_util.mk_numeral(rational(4), false)); + auto _seq2248_0 = mk_sqrt(rational(6)); + auto _seq2248_1 = mk_sqrt(rational(2)); + auto _seq2190_0 = m_util.mk_add(_seq2248_0, _seq2248_1); + auto _seq2190_1 = m_util.mk_numeral(rational(4), false); + expr* result = m_util.mk_div(_seq2190_0, _seq2190_1); return neg ? m_util.mk_uminus(result) : result; } return nullptr; @@ -2201,8 +2272,13 @@ br_status arith_rewriter::mk_sin_core(expr * arg, expr_ref & result) { return BR_DONE; } if (m_util.is_acos(arg, x)) { - // sin(acos(x)) == sqrt(1 - x^2) - result = m_util.mk_power(m_util.mk_sub(m_util.mk_real(1), m_util.mk_mul(x,x)), m_util.mk_numeral(rational(1,2), false)); + { + auto _seq2265_0 = m_util.mk_real(1); + auto _seq2265_1 = m_util.mk_mul(x, x); + auto _seq2205_0 = m_util.mk_sub(_seq2265_0, _seq2265_1); + auto _seq2205_1 = m_util.mk_numeral(rational(1, 2), false); + result = m_util.mk_power(_seq2205_0, _seq2205_1); + } return BR_REWRITE_FULL; } rational k; @@ -2365,7 +2441,11 @@ br_status arith_rewriter::mk_tan_core(expr * arg, expr_ref & result) { end: if (m_expand_tan) { - result = m_util.mk_div(m_util.mk_sin(arg), m_util.mk_cos(arg)); + { + auto _seq2368_0 = m_util.mk_sin(arg); + auto _seq2368_1 = m_util.mk_cos(arg); + result = m_util.mk_div(_seq2368_0, _seq2368_1); + } return BR_REWRITE2; } return BR_FAILED; @@ -2401,14 +2481,18 @@ br_status arith_rewriter::mk_asin_core(expr * arg, expr_ref & result) { if (k.is_one()) { // asin(1) == pi/2 // asin(-1) == -pi/2 - result = m_util.mk_mul(m_util.mk_numeral(rational(neg ? -1 : 1, 2), false), m_util.mk_pi()); + auto _seqp0 = m_util.mk_numeral(rational(neg ? -1 : 1, 2), false); + auto _seqp1 = m_util.mk_pi(); + result = m_util.mk_mul(_seqp0, _seqp1); return BR_REWRITE2; } if (k == rational(1, 2)) { // asin(1/2) == pi/6 // asin(-1/2) == -pi/6 - result = m_util.mk_mul(m_util.mk_numeral(rational(neg ? -1 : 1, 6), false), m_util.mk_pi()); + auto _seqp0 = m_util.mk_numeral(rational(neg ? -1 : 1, 6), false); + auto _seqp1 = m_util.mk_pi(); + result = m_util.mk_mul(_seqp0, _seqp1); return BR_REWRITE2; } } @@ -2428,8 +2512,11 @@ br_status arith_rewriter::mk_acos_core(expr * arg, expr_ref & result) { rational k; if (is_numeral(arg, k)) { if (k.is_zero()) { - // acos(0) = pi/2 - result = m_util.mk_mul(m_util.mk_numeral(rational(1, 2), false), m_util.mk_pi()); + { + auto _seq2432_0 = m_util.mk_numeral(rational(1, 2), false); + auto _seq2432_1 = m_util.mk_pi(); + result = m_util.mk_mul(_seq2432_0, _seq2432_1); + } return BR_REWRITE2; } if (k.is_one()) { @@ -2443,13 +2530,19 @@ br_status arith_rewriter::mk_acos_core(expr * arg, expr_ref & result) { return BR_DONE; } if (k == rational(1, 2)) { - // acos(1/2) = pi/3 - result = m_util.mk_mul(m_util.mk_numeral(rational(1, 3), false), m_util.mk_pi()); + { + auto _seq2447_0 = m_util.mk_numeral(rational(1, 3), false); + auto _seq2447_1 = m_util.mk_pi(); + result = m_util.mk_mul(_seq2447_0, _seq2447_1); + } return BR_REWRITE2; } if (k == rational(-1, 2)) { - // acos(-1/2) = 2/3 pi - result = m_util.mk_mul(m_util.mk_numeral(rational(2, 3), false), m_util.mk_pi()); + { + auto _seq2452_0 = m_util.mk_numeral(rational(2, 3), false); + auto _seq2452_1 = m_util.mk_pi(); + result = m_util.mk_mul(_seq2452_0, _seq2452_1); + } return BR_REWRITE2; } } @@ -2465,14 +2558,20 @@ br_status arith_rewriter::mk_atan_core(expr * arg, expr_ref & result) { } if (k.is_one()) { - // atan(1) == pi/4 - result = m_util.mk_mul(m_util.mk_numeral(rational(1, 4), false), m_util.mk_pi()); + { + auto _seq2469_0 = m_util.mk_numeral(rational(1, 4), false); + auto _seq2469_1 = m_util.mk_pi(); + result = m_util.mk_mul(_seq2469_0, _seq2469_1); + } return BR_REWRITE2; } if (k.is_minus_one()) { - // atan(-1) == -pi/4 - result = m_util.mk_mul(m_util.mk_numeral(rational(-1, 4), false), m_util.mk_pi()); + { + auto _seq2475_0 = m_util.mk_numeral(rational(-1, 4), false); + auto _seq2475_1 = m_util.mk_pi(); + result = m_util.mk_mul(_seq2475_0, _seq2475_1); + } return BR_REWRITE2; } diff --git a/src/ast/rewriter/array_rewriter.cpp b/src/ast/rewriter/array_rewriter.cpp index 5bad27defe..8947bae759 100644 --- a/src/ast/rewriter/array_rewriter.cpp +++ b/src/ast/rewriter/array_rewriter.cpp @@ -392,7 +392,11 @@ br_status array_rewriter::mk_select_core(unsigned num_args, expr * const * args, args1.append(num_args-1, args + 1); args2.push_back(el); args2.append(num_args-1, args + 1); - result = m().mk_ite(c, m_util.mk_select(num_args, args1.data()), m_util.mk_select(num_args, args2.data())); + { + auto _seq395_0 = m_util.mk_select(num_args, args1.data()); + auto _seq395_1 = m_util.mk_select(num_args, args2.data()); + result = m().mk_ite(c, _seq395_0, _seq395_1); + } return BR_REWRITE2; } diff --git a/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp b/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp index b9d885e018..798218bc0d 100644 --- a/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp +++ b/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp @@ -23,6 +23,7 @@ Notes: #include "ast/rewriter/bool_rewriter.h" #include "ast/rewriter/th_rewriter.h" #include "util/ref_util.h" +#include "util/manage_warnings.h" #include "ast/ast_smt2_pp.h" struct blaster_cfg { @@ -246,9 +247,11 @@ void OP(expr * arg, expr_ref & result) { \ result = mk_mkbv(m_out); \ } + START_DISABLE_EXTRA_SEMI_WARNING; MK_UNARY_REDUCE(reduce_not, mk_not); MK_UNARY_REDUCE(reduce_redor, mk_redor); MK_UNARY_REDUCE(reduce_redand, mk_redand); + END_DISABLE_WARNING; #define MK_BIN_REDUCE(OP, BB_OP) \ void OP(expr * arg1, expr * arg2, expr_ref & result) { \ @@ -260,6 +263,7 @@ void OP(expr * arg1, expr * arg2, expr_ref & result) { \ result = mk_mkbv(m_out); \ } + START_DISABLE_EXTRA_SEMI_WARNING; MK_BIN_REDUCE(reduce_shl, mk_shl); MK_BIN_REDUCE(reduce_ashr, mk_ashr); MK_BIN_REDUCE(reduce_lshr, mk_lshr); @@ -270,6 +274,7 @@ void OP(expr * arg1, expr * arg2, expr_ref & result) { \ MK_BIN_REDUCE(reduce_smod, mk_smod); MK_BIN_REDUCE(reduce_ext_rotate_left, mk_ext_rotate_left); MK_BIN_REDUCE(reduce_ext_rotate_right, mk_ext_rotate_right); + END_DISABLE_WARNING; #define MK_BIN_AC_REDUCE(OP, BIN_OP, BB_OP) \ MK_BIN_REDUCE(BIN_OP, BB_OP); \ @@ -283,12 +288,14 @@ void OP(unsigned num_args, expr * const * args, expr_ref & result) { \ } \ } + START_DISABLE_EXTRA_SEMI_WARNING; MK_BIN_AC_REDUCE(reduce_add, reduce_bin_add, mk_adder); MK_BIN_AC_REDUCE(reduce_mul, reduce_bin_mul, mk_multiplier); MK_BIN_AC_REDUCE(reduce_and, reduce_bin_and, mk_and); MK_BIN_AC_REDUCE(reduce_or, reduce_bin_or, mk_or); MK_BIN_AC_REDUCE(reduce_xor, reduce_bin_xor, mk_xor); + END_DISABLE_WARNING; #define MK_BIN_PRED_REDUCE(OP, BB_OP) \ @@ -299,12 +306,14 @@ void OP(expr * arg1, expr * arg2, expr_ref & result) { m_blaster.BB_OP(m_in1.size(), m_in1.data(), m_in2.data(), result); \ } + START_DISABLE_EXTRA_SEMI_WARNING; MK_BIN_PRED_REDUCE(reduce_eq, mk_eq); MK_BIN_PRED_REDUCE(reduce_sle, mk_sle); MK_BIN_PRED_REDUCE(reduce_ule, mk_ule); MK_BIN_PRED_REDUCE(reduce_umul_no_overflow, mk_umul_no_overflow); MK_BIN_PRED_REDUCE(reduce_smul_no_overflow, mk_smul_no_overflow); MK_BIN_PRED_REDUCE(reduce_smul_no_underflow, mk_smul_no_underflow); + END_DISABLE_WARNING; #define MK_PARAMETRIC_UNARY_REDUCE(OP, BB_OP) \ void OP(expr * arg, unsigned n, expr_ref & result) { \ @@ -315,7 +324,9 @@ void OP(expr * arg, unsigned n, expr_ref & result) { \ result = mk_mkbv(m_out); \ } +START_DISABLE_EXTRA_SEMI_WARNING; MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend); +END_DISABLE_WARNING; void reduce_ite(expr * arg1, expr * arg2, expr * arg3, expr_ref & result) { m_in1.reset(); diff --git a/src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h b/src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h index 87785d8f82..04585c4c20 100644 --- a/src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h +++ b/src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h @@ -20,6 +20,7 @@ Revision History: #include "util/rational.h" #include "util/common_msgs.h" +#include "util/manage_warnings.h" #include "ast/rewriter/bit_blaster/bit_blaster_tpl.h" #include "ast/ast_pp.h" #include "ast/rewriter/rewriter_types.h" @@ -1075,12 +1076,14 @@ void bit_blaster_tpl::NAME(unsigned sz, expr * const * a_bits, expr * const } \ } +START_DISABLE_EXTRA_SEMI_WARNING; MK_BINARY(mk_and, mk_and); MK_BINARY(mk_or, mk_or); MK_BINARY(mk_xor, mk_xor); MK_BINARY(mk_xnor, mk_iff); MK_BINARY(mk_nand, mk_nand); MK_BINARY(mk_nor, mk_nor); +END_DISABLE_WARNING; template void bit_blaster_tpl::mk_redand(unsigned sz, expr * const * a_bits, expr_ref_vector & out_bits) { diff --git a/src/ast/rewriter/bv2int_translator.cpp b/src/ast/rewriter/bv2int_translator.cpp index 042e018558..3da2c0e8d5 100644 --- a/src/ast/rewriter/bv2int_translator.cpp +++ b/src/ast/rewriter/bv2int_translator.cpp @@ -188,7 +188,9 @@ expr_ref bv2int_translator::mk_le(expr* x, expr* y) { return expr_ref(a.mk_le(x, y), m); if (a.is_numeral(x)) return expr_ref(a.mk_ge(y, x), m); - return expr_ref(a.mk_le(a.mk_sub(x, y), a.mk_numeral(rational(0), x->get_sort())), m); + auto _seq0 = a.mk_sub(x, y); + auto _seq1 = a.mk_numeral(rational(0), x->get_sort()); + return expr_ref(a.mk_le(_seq0, _seq1), m); } expr_ref bv2int_translator::mk_lt(expr* x, expr* y) { @@ -364,7 +366,11 @@ void bv2int_translator::translate_bv(app* e) { rational N = bv_size(e); expr* x = umod(e, 0), * y = umod(e, 1); expr* signx = a.mk_ge(x, a.mk_int(N / 2)); - r = m.mk_ite(signx, a.mk_int(-1), a.mk_int(0)); + { + auto _seq367_0 = a.mk_int(-1); + auto _seq367_1 = a.mk_int(0); + r = m.mk_ite(signx, _seq367_0, _seq367_1); + } IF_VERBOSE(4, verbose_stream() << "ashr " << mk_bounded_pp(e, m) << " " << bv.get_bv_size(e) << "\n"); for (unsigned i = 0; i < sz; ++i) { expr* d = a.mk_idiv(x, a.mk_int(rational::power_of_two(i))); @@ -422,7 +428,10 @@ void bv2int_translator::translate_bv(app* e) { case OP_INT2BV: m_int2bv.push_back(e); ctx.push(push_back_vector(m_int2bv)); - r = arg(0); + // Normalize the integer argument to [0, 2^N) so that bitwise operations + // on int_to_bv produce correct results when the argument is negative or + // otherwise outside the valid range. + r = umod(e, 0); break; case OP_UBV2INT: m_bv2int.push_back(e); @@ -431,7 +440,12 @@ void bv2int_translator::translate_bv(app* e) { break; case OP_BCOMP: bv_expr = e->get_arg(0); - r = m.mk_ite(m.mk_eq(umod(bv_expr, 0), umod(bv_expr, 1)), a.mk_int(1), a.mk_int(0)); + { + auto _seq434_0 = m.mk_eq(umod(bv_expr, 0), umod(bv_expr, 1)); + auto _seq434_1 = a.mk_int(1); + auto _seq434_2 = a.mk_int(0); + r = m.mk_ite(_seq434_0, _seq434_1, _seq434_2); + } break; case OP_BSMOD_I: case OP_BSMOD: { @@ -448,8 +462,16 @@ void bv2int_translator::translate_bv(app* e) { // x >= 0, y >= 0 -> u r = a.mk_uminus(u); r = m.mk_ite(m.mk_and(m.mk_not(signx), signy), add(u, y), r); - r = m.mk_ite(m.mk_and(signx, m.mk_not(signy)), a.mk_sub(y, u), r); - r = m.mk_ite(m.mk_and(m.mk_not(signx), m.mk_not(signy)), u, r); + { + auto _seq451_0 = m.mk_and(signx, m.mk_not(signy)); + auto _seq451_1 = a.mk_sub(y, u); + r = m.mk_ite(_seq451_0, _seq451_1, r); + } + { + auto _seq0 = m.mk_not(signx); + auto _seq1 = m.mk_not(signy); + r = m.mk_ite(m.mk_and(_seq0, _seq1), u, r); + } r = if_eq(u, 0, a.mk_int(0), r); r = if_eq(y, 0, x, r); break; @@ -471,8 +493,16 @@ void bv2int_translator::translate_bv(app* e) { x = m.mk_ite(signx, a.mk_sub(a.mk_int(N), x), x); y = m.mk_ite(signy, a.mk_sub(a.mk_int(N), y), y); expr* d = a.mk_idiv(x, y); - r = m.mk_ite(m.mk_iff(signx, signy), d, a.mk_uminus(d)); - r = if_eq(y, 0, m.mk_ite(signx, a.mk_int(1), a.mk_int(-1)), r); + { + auto _seq474_0 = m.mk_iff(signx, signy); + auto _seq474_1 = a.mk_uminus(d); + r = m.mk_ite(_seq474_0, d, _seq474_1); + } + { + auto _seq0 = a.mk_int(1); + auto _seq1 = a.mk_int(-1); + r = if_eq(y, 0, m.mk_ite(signx, _seq0, _seq1), r); + } break; } case OP_BSREM_I: @@ -486,7 +516,11 @@ void bv2int_translator::translate_bv(app* e) { expr* absx = m.mk_ite(signx, a.mk_sub(a.mk_int(N), x), x); expr* absy = m.mk_ite(signy, a.mk_sub(a.mk_int(N), y), y); expr* d = a.mk_idiv(absx, absy); - d = m.mk_ite(m.mk_iff(signx, signy), d, a.mk_uminus(d)); + { + auto _seq489_0 = m.mk_iff(signx, signy); + auto _seq489_1 = a.mk_uminus(d); + d = m.mk_ite(_seq489_0, d, _seq489_1); + } r = a.mk_sub(x, mul(d, y)); r = if_eq(y, 0, x, r); break; @@ -666,6 +700,9 @@ expr* bv2int_translator::amod(expr* bv_expr, expr* x, rational const& N) { r = x; else if (a.is_mod(x, t, e) && a.is_numeral(t, v) && 0 <= v && v < N) r = x; + else if (a.is_mod(x, t, e) && a.is_numeral(e, v) && v == N) + // mod(t, N) is already in [0, N); no need to wrap it again. + r = x; else if (a.is_numeral(x, v)) r = a.mk_int(mod(v, N)); else if (is_bounded(x, N)) diff --git a/src/ast/rewriter/bv_rewriter.cpp b/src/ast/rewriter/bv_rewriter.cpp index b2ae76dd78..0181b3fa20 100644 --- a/src/ast/rewriter/bv_rewriter.cpp +++ b/src/ast/rewriter/bv_rewriter.cpp @@ -383,8 +383,11 @@ br_status bv_rewriter::rw_leq_overflow(bool is_signed, expr * a, expr * b, expr_ } else { SASSERT(lower.is_pos()); - result = m.mk_and(m_util.mk_ule(mk_numeral(lower, sz), common), - m_util.mk_ule(common, mk_numeral(upper, sz))); + { + auto _seq386_0 = m_util.mk_ule(mk_numeral(lower, sz), common); + auto _seq386_1 = m_util.mk_ule(common, mk_numeral(upper, sz)); + result = m.mk_and(_seq386_0, _seq386_1); + } } return BR_REWRITE2; } @@ -593,8 +596,11 @@ br_status bv_rewriter::mk_leq_core(bool is_signed, expr * a, expr * b, expr_ref expr * b_2 = to_app(b)->get_arg(1); unsigned sz1 = get_bv_size(b_1); unsigned sz2 = get_bv_size(b_2); - result = m.mk_and(m.mk_eq(m_mk_extract(sz2+sz1-1, sz2, a), b_1), - m_util.mk_ule(m_mk_extract(sz2-1, 0, a), b_2)); + { + auto _seq596_0 = m.mk_eq(m_mk_extract(sz2+sz1-1, sz2, a), b_1); + auto _seq596_1 = m_util.mk_ule(m_mk_extract(sz2-1, 0, a), b_2); + result = m.mk_and(_seq596_0, _seq596_1); + } return BR_REWRITE3; } #else @@ -869,7 +875,11 @@ br_status bv_rewriter::mk_extract(unsigned high, unsigned low, expr * arg, expr_ expr* c = nullptr, *t = nullptr, *e = nullptr; if (m.is_ite(arg, c, t, e) && (t->get_ref_count() == 1 || e->get_ref_count() == 1 || !m.is_ite(t) || !m.is_ite(e))) { - result = m.mk_ite(c, m_mk_extract(high, low, t), m_mk_extract(high, low, e)); + { + auto _seq872_0 = m_mk_extract(high, low, t); + auto _seq872_1 = m_mk_extract(high, low, e); + result = m.mk_ite(c, _seq872_0, _seq872_1); + } return BR_REWRITE2; } @@ -932,9 +942,11 @@ br_status bv_rewriter::mk_bv_shl(expr * arg1, expr * arg2, expr_ref & result) { if (m_util.is_bv_shl(arg1, x, y)) { expr_ref sum(m_util.mk_bv_add(y, arg2), m); expr_ref cond(m_util.mk_ule(y, sum), m); - result = m.mk_ite(cond, - m_util.mk_bv_shl(x, sum), - mk_zero(bv_size)); + { + auto _seq935_0 = m_util.mk_bv_shl(x, sum); + auto _seq935_1 = mk_zero(bv_size); + result = m.mk_ite(cond, _seq935_0, _seq935_1); + } return BR_REWRITE3; } @@ -1078,7 +1090,11 @@ br_status bv_rewriter::mk_bv_ashr(expr * arg1, expr * arg2, expr_ref & result) { // (bvlshr x k) -> (concat bv0:k (extract [n-1:k] x)) unsigned k = r2.get_unsigned(); - result = m_util.mk_concat(mk_zero(k), m_mk_extract(bv_size - 1, k, arg1)); + { + auto _seq1081_0 = mk_zero(k); + auto _seq1081_1 = m_mk_extract(bv_size - 1, k, arg1); + result = m_util.mk_concat(_seq1081_0, _seq1081_1); + } return BR_REWRITE2; } #if 0 @@ -1114,10 +1130,12 @@ br_status bv_rewriter::mk_bv_sdiv_core(expr * arg1, expr * arg2, bool hi_div0, e return BR_REWRITE1; } else { - // The "hardware interpretation" for (bvsdiv x 0) is (ite (bvslt x #x0000) #x0001 #xffff) - result = m.mk_ite(m.mk_app(get_fid(), OP_SLT, arg1, mk_zero(bv_size)), - mk_one(bv_size), - mk_numeral(rational::power_of_two(bv_size) - numeral(1), bv_size)); + { + auto _seq1118_0 = m.mk_app(get_fid(), OP_SLT, arg1, mk_zero(bv_size)); + auto _seq1118_1 = mk_one(bv_size); + auto _seq1118_2 = mk_numeral(rational::power_of_two(bv_size) - numeral(1), bv_size); + result = m.mk_ite(_seq1118_0, _seq1118_1, _seq1118_2); + } return BR_REWRITE2; } } @@ -1143,9 +1161,12 @@ br_status bv_rewriter::mk_bv_sdiv_core(expr * arg1, expr * arg2, bool hi_div0, e } bv_size = get_bv_size(arg2); - result = m.mk_ite(m.mk_eq(arg2, mk_zero(bv_size)), - m_util.mk_bv_sdiv0(arg1), - m_util.mk_bv_sdiv_i(arg1, arg2)); + { + auto _seq1146_0 = m.mk_eq(arg2, mk_zero(bv_size)); + auto _seq1146_1 = m_util.mk_bv_sdiv0(arg1); + auto _seq1146_2 = m_util.mk_bv_sdiv_i(arg1, arg2); + result = m.mk_ite(_seq1146_0, _seq1146_1, _seq1146_2); + } return BR_REWRITE2; } @@ -1198,9 +1219,12 @@ br_status bv_rewriter::mk_bv_udiv_core(expr * arg1, expr * arg2, bool hi_div0, e } bv_size = get_bv_size(arg2); - result = m.mk_ite(m.mk_eq(arg2, mk_zero(bv_size)), - m_util.mk_bv_udiv0(arg1), - m_util.mk_bv_udiv_i(arg1, arg2)); + { + auto _seq1201_0 = m.mk_eq(arg2, mk_zero(bv_size)); + auto _seq1201_1 = m_util.mk_bv_udiv0(arg1); + auto _seq1201_2 = m_util.mk_bv_udiv_i(arg1, arg2); + result = m.mk_ite(_seq1201_0, _seq1201_1, _seq1201_2); + } TRACE(bv_udiv, tout << mk_pp(arg1, m) << "\n" << mk_pp(arg2, m) << "\n---->\n" << mk_pp(result, m) << "\n";); return BR_REWRITE2; @@ -1245,9 +1269,12 @@ br_status bv_rewriter::mk_bv_srem_core(expr * arg1, expr * arg2, bool hi_div0, e } bv_size = get_bv_size(arg2); - result = m.mk_ite(m.mk_eq(arg2, mk_zero(bv_size)), - m.mk_app(get_fid(), OP_BSREM0, arg1), - m.mk_app(get_fid(), OP_BSREM_I, arg1, arg2)); + { + auto _seq1248_0 = m.mk_eq(arg2, mk_zero(bv_size)); + auto _seq1248_1 = m.mk_app(get_fid(), OP_BSREM0, arg1); + auto _seq1248_2 = m.mk_app(get_fid(), OP_BSREM_I, arg1, arg2); + result = m.mk_ite(_seq1248_0, _seq1248_1, _seq1248_2); + } return BR_REWRITE2; } @@ -1335,9 +1362,11 @@ br_status bv_rewriter::mk_bv_urem_core(expr * arg1, expr * arg2, bool hi_div0, e // urem(0, x) ==> ite(x = 0, urem0(x), 0) if (is_num1 && r1.is_zero()) { expr * zero = arg1; - result = m.mk_ite(m.mk_eq(arg2, zero), - m_util.mk_bv_urem0(zero), - zero); + { + auto _seq1338_0 = m.mk_eq(arg2, zero); + auto _seq1338_1 = m_util.mk_bv_urem0(zero); + result = m.mk_ite(_seq1338_0, _seq1338_1, zero); + } return BR_REWRITE2; } @@ -1347,9 +1376,11 @@ br_status bv_rewriter::mk_bv_urem_core(expr * arg1, expr * arg2, bool hi_div0, e bv_size = get_bv_size(arg1); expr * x_minus_1 = arg1; expr * minus_one = mk_numeral(rational::power_of_two(bv_size) - numeral(1), bv_size); - result = m.mk_ite(m.mk_eq(x, mk_zero(bv_size)), - m_util.mk_bv_urem0(minus_one), - x_minus_1); + { + auto _seq1350_0 = m.mk_eq(x, mk_zero(bv_size)); + auto _seq1350_1 = m_util.mk_bv_urem0(minus_one); + result = m.mk_ite(_seq1350_0, _seq1350_1, x_minus_1); + } return BR_REWRITE2; } } @@ -1377,9 +1408,12 @@ br_status bv_rewriter::mk_bv_urem_core(expr * arg1, expr * arg2, bool hi_div0, e } bv_size = get_bv_size(arg2); - result = m.mk_ite(m.mk_eq(arg2, mk_zero(bv_size)), - m_util.mk_bv_urem0(arg1), - m_util.mk_bv_urem_i(arg1, arg2)); + { + auto _seq1380_0 = m.mk_eq(arg2, mk_zero(bv_size)); + auto _seq1380_1 = m_util.mk_bv_urem0(arg1); + auto _seq1380_2 = m_util.mk_bv_urem_i(arg1, arg2); + result = m.mk_ite(_seq1380_0, _seq1380_1, _seq1380_2); + } return BR_REWRITE2; } @@ -1441,8 +1475,16 @@ br_status bv_rewriter::mk_bv_smod_core(expr * arg1, expr * arg2, bool hi_div0, e unsigned nb = r2.get_num_bits(); expr_ref a1(m_util.mk_bv_smod(a, arg2), m); expr_ref a2(m_util.mk_bv_smod(b, arg2), m); - a1 = m_util.mk_concat( mk_zero(bv_size - nb), m_mk_extract(nb-1,0,a1)); - a2 = m_util.mk_concat( mk_zero(bv_size - nb), m_mk_extract(nb-1,0,a2)); + { + auto _seq1444_0 = mk_zero(bv_size - nb); + auto _seq1444_1 = m_mk_extract(nb-1,0,a1); + a1 = m_util.mk_concat(_seq1444_0, _seq1444_1); + } + { + auto _seq1445_0 = mk_zero(bv_size - nb); + auto _seq1445_1 = m_mk_extract(nb-1,0,a2); + a2 = m_util.mk_concat(_seq1445_0, _seq1445_1); + } result = m_util.mk_bv_mul(a1, a2); std::cout << result << "\n"; result = m_util.mk_bv_smod(result, arg2); @@ -1458,9 +1500,12 @@ br_status bv_rewriter::mk_bv_smod_core(expr * arg1, expr * arg2, bool hi_div0, e } bv_size = get_bv_size(arg2); - result = m.mk_ite(m.mk_eq(arg2, mk_zero(bv_size)), - m.mk_app(get_fid(), OP_BSMOD0, arg1), - m.mk_app(get_fid(), OP_BSMOD_I, arg1, arg2)); + { + auto _seq1461_0 = m.mk_eq(arg2, mk_zero(bv_size)); + auto _seq1461_1 = m.mk_app(get_fid(), OP_BSMOD0, arg1); + auto _seq1461_2 = m.mk_app(get_fid(), OP_BSMOD_I, arg1, arg2); + result = m.mk_ite(_seq1461_0, _seq1461_1, _seq1461_2); + } return BR_REWRITE2; } @@ -1677,7 +1722,11 @@ br_status bv_rewriter::mk_concat(unsigned num_args, expr * const * args, expr_re ptr_buffer args1, args2; for (unsigned i = 0; i < new_args.size(); ++i) args1.push_back(y), args2.push_back(z); - result = m.mk_ite(x, m_util.mk_concat(args1), m_util.mk_concat(args2)); + { + auto _seq1680_0 = m_util.mk_concat(args1); + auto _seq1680_1 = m_util.mk_concat(args2); + result = m.mk_ite(x, _seq1680_0, _seq1680_1); + } return BR_REWRITE2; } } @@ -2152,13 +2201,21 @@ br_status bv_rewriter::mk_bv_not(expr * arg, expr_ref & result) { expr* x, *y, *z; if (m.is_ite(arg, x, y, z) && m_util.is_numeral(y, val, bv_size)) { val = bitwise_not(bv_size, val); - result = m.mk_ite(x, m_util.mk_numeral(val, bv_size), m_util.mk_bv_not(z)); + { + auto _seq2155_0 = m_util.mk_numeral(val, bv_size); + auto _seq2155_1 = m_util.mk_bv_not(z); + result = m.mk_ite(x, _seq2155_0, _seq2155_1); + } return BR_REWRITE2; } if (m.is_ite(arg, x, y, z) && m_util.is_numeral(z, val, bv_size)) { val = bitwise_not(bv_size, val); - result = m.mk_ite(x, m_util.mk_bv_not(y), m_util.mk_numeral(val, bv_size)); + { + auto _seq2161_0 = m_util.mk_bv_not(y); + auto _seq2161_1 = m_util.mk_numeral(val, bv_size); + result = m.mk_ite(x, _seq2161_0, _seq2161_1); + } return BR_REWRITE2; } @@ -2325,9 +2382,12 @@ br_status bv_rewriter::mk_bv_comp(expr * arg1, expr * arg2, expr_ref & result) { return BR_DONE; } - result = m.mk_ite(m.mk_eq(arg1, arg2), - mk_one(1), - mk_zero(1)); + { + auto _seq2328_0 = m.mk_eq(arg1, arg2); + auto _seq2328_1 = mk_one(1); + auto _seq2328_2 = mk_zero(1); + result = m.mk_ite(_seq2328_0, _seq2328_1, _seq2328_2); + } return BR_REWRITE2; } @@ -2603,8 +2663,9 @@ br_status bv_rewriter::mk_blast_eq_value(expr * lhs, expr * rhs, expr_ref & resu ptr_buffer new_args; for (unsigned i = 0; i < sz; ++i) { bool bit0 = (v % two).is_zero(); - new_args.push_back(m.mk_eq(m_mk_extract(i,i, lhs), - mk_numeral(bit0 ? 0 : 1, 1))); + auto _seq0 = m_mk_extract(i, i, lhs); + auto _seq1 = mk_numeral(bit0 ? 0 : 1, 1); + new_args.push_back(m.mk_eq(_seq0, _seq1)); div(v, two, v); } result = m.mk_and(new_args); @@ -2648,8 +2709,11 @@ br_status bv_rewriter::mk_eq_concat(expr * lhs, expr * rhs, expr_ref & result) { unsigned rsz1 = sz1 - low1; unsigned rsz2 = sz2 - low2; if (rsz1 == rsz2) { - new_eqs.push_back(m.mk_eq(m_mk_extract(sz1 - 1, low1, arg1), - m_mk_extract(sz2 - 1, low2, arg2))); + { + auto _seq2651_0 = m_mk_extract(sz1 - 1, low1, arg1); + auto _seq2651_1 = m_mk_extract(sz2 - 1, low2, arg2); + new_eqs.push_back(m.mk_eq(_seq2651_0, _seq2651_1)); + } low1 = 0; low2 = 0; --i1; @@ -2657,15 +2721,21 @@ br_status bv_rewriter::mk_eq_concat(expr * lhs, expr * rhs, expr_ref & result) { continue; } else if (rsz1 < rsz2) { - new_eqs.push_back(m.mk_eq(m_mk_extract(sz1 - 1, low1, arg1), - m_mk_extract(rsz1 + low2 - 1, low2, arg2))); + { + auto _seq2660_0 = m_mk_extract(sz1 - 1, low1, arg1); + auto _seq2660_1 = m_mk_extract(rsz1 + low2 - 1, low2, arg2); + new_eqs.push_back(m.mk_eq(_seq2660_0, _seq2660_1)); + } low1 = 0; low2 += rsz1; --i1; } else { - new_eqs.push_back(m.mk_eq(m_mk_extract(rsz2 + low1 - 1, low1, arg1), - m_mk_extract(sz2 - 1, low2, arg2))); + { + auto _seq2667_0 = m_mk_extract(rsz2 + low1 - 1, low1, arg1); + auto _seq2667_1 = m_mk_extract(sz2 - 1, low2, arg2); + new_eqs.push_back(m.mk_eq(_seq2667_0, _seq2667_1)); + } low1 += rsz2; low2 = 0; --i2; @@ -2810,8 +2880,11 @@ br_status bv_rewriter::mk_mul_eq(expr * lhs, expr * rhs, expr_ref & result) { } } if (found) { - result = m.mk_eq(m_util.mk_numeral(c2_inv_val*c_val, sz), - m_util.mk_bv_mul(m_util.mk_numeral(c2_inv_val, sz), rhs)); + { + auto _seq2813_0 = m_util.mk_numeral(c2_inv_val * c_val, sz); + auto _seq2813_1 = m_util.mk_bv_mul(m_util.mk_numeral(c2_inv_val, sz), rhs); + result = m.mk_eq(_seq2813_0, _seq2813_1); + } return BR_REWRITE3; } } @@ -3102,10 +3175,11 @@ br_status bv_rewriter::mk_distinct(unsigned num_args, expr * const * args, expr_ br_status bv_rewriter::mk_bvsmul_overflow(unsigned num, expr * const * args, expr_ref & result) { SASSERT(num == 2); - result = m.mk_or( - m.mk_not(m_util.mk_bvsmul_no_ovfl(args[0], args[1])), - m.mk_not(m_util.mk_bvsmul_no_udfl(args[0], args[1])) - ); + { + auto _seq3105_0 = m.mk_not(m_util.mk_bvsmul_no_ovfl(args[0], args[1])); + auto _seq3105_1 = m.mk_not(m_util.mk_bvsmul_no_udfl(args[0], args[1])); + result = m.mk_or(_seq3105_0, _seq3105_1); + } return BR_REWRITE_FULL; } @@ -3271,7 +3345,11 @@ br_status bv_rewriter::mk_bvsdiv_overflow(unsigned num, expr * const * args, exp auto sz = get_bv_size(args[1]); auto minSigned = mk_numeral(rational::power_of_two(sz-1), sz); auto minusOne = mk_numeral(rational::power_of_two(sz) - 1, sz); - result = m.mk_and(m.mk_eq(args[0], minSigned), m.mk_eq(args[1], minusOne)); + { + auto _seq3274_0 = m.mk_eq(args[0], minSigned); + auto _seq3274_1 = m.mk_eq(args[1], minusOne); + result = m.mk_and(_seq3274_0, _seq3274_1); + } return BR_REWRITE_FULL; } diff --git a/src/ast/rewriter/bv_rewriter.h b/src/ast/rewriter/bv_rewriter.h index 713a0790bb..746b8b7b07 100644 --- a/src/ast/rewriter/bv_rewriter.h +++ b/src/ast/rewriter/bv_rewriter.h @@ -22,6 +22,7 @@ Notes: #include "ast/bv_decl_plugin.h" #include "ast/arith_decl_plugin.h" #include "ast/rewriter/mk_extract_proc.h" +#include "util/manage_warnings.h" class bv_rewriter_core { protected: @@ -237,12 +238,14 @@ public: return result; } + START_DISABLE_EXTRA_SEMI_WARNING; MK_BV_BINARY(mk_bv_urem); MK_BV_BINARY(mk_ule); MK_BV_BINARY(mk_sle); MK_BV_BINARY(mk_bv_add); MK_BV_BINARY(mk_bv_mul); MK_BV_BINARY(mk_bv_sub); + END_DISABLE_WARNING; expr_ref mk_ubv2int(expr* a) { diff --git a/src/ast/rewriter/enum2bv_rewriter.cpp b/src/ast/rewriter/enum2bv_rewriter.cpp index 8210cdc931..699d320e82 100644 --- a/src/ast/rewriter/enum2bv_rewriter.cpp +++ b/src/ast/rewriter/enum2bv_rewriter.cpp @@ -73,9 +73,10 @@ struct enum2bv_rewriter::imp { unsigned domain_size = m_dt.get_datatype_num_constructors(s); if (is_unate(s)) { expr_ref one(m_bv.mk_numeral(rational::one(), 1), m); - for (unsigned i = 0; i + 2 < domain_size; ++i) { - bounds.push_back(m.mk_implies(m.mk_eq(one, m_bv.mk_extract(i + 1, i + 1, x)), - m.mk_eq(one, m_bv.mk_extract(i, i, x)))); + for (unsigned i = 0; i + 2 < domain_size; ++i) { + auto _seq77_0 = m.mk_eq(one, m_bv.mk_extract(i + 1, i + 1, x)); + auto _seq77_1 = m.mk_eq(one, m_bv.mk_extract(i, i, x)); + bounds.push_back(m.mk_implies(_seq77_0, _seq77_1)); } } else { @@ -167,7 +168,9 @@ struct enum2bv_rewriter::imp { ptr_vector const& cs = *m_dt.get_datatype_constructors(s); f_def = m.mk_const(cs[nc-1]); for (unsigned i = nc - 1; i-- > 0; ) { - f_def = m.mk_ite(m.mk_eq(result, value2bv(i, s)), m.mk_const(cs[i]), f_def); + auto _seq170_0 = m.mk_eq(result, value2bv(i, s)); + auto _seq170_1 = m.mk_const(cs[i]); + f_def = m.mk_ite(_seq170_0, _seq170_1, f_def); } m_imp.m_enum2def.insert(f, f_def); m_imp.m_enum2bv.insert(f, f_fresh); diff --git a/src/ast/rewriter/factor_rewriter.cpp b/src/ast/rewriter/factor_rewriter.cpp index 89354b2369..0955f2598d 100644 --- a/src/ast/rewriter/factor_rewriter.cpp +++ b/src/ast/rewriter/factor_rewriter.cpp @@ -141,8 +141,16 @@ void factor_rewriter::mk_is_negative(expr_ref& result, expr_ref_vector& eqs) { pos0 = pos; } else { - tmp = m().mk_or(m().mk_and(pos, pos0), m().mk_and(neg, neg0)); - neg0 = m().mk_or(m().mk_and(neg, pos0), m().mk_and(pos, neg0)); + { + auto _seq144_0 = m().mk_and(pos, pos0); + auto _seq144_1 = m().mk_and(neg, neg0); + tmp = m().mk_or(_seq144_0, _seq144_1); + } + { + auto _seq145_0 = m().mk_and(neg, pos0); + auto _seq145_1 = m().mk_and(pos, neg0); + neg0 = m().mk_or(_seq145_0, _seq145_1); + } pos0 = tmp; } } diff --git a/src/ast/rewriter/finite_set_axioms.cpp b/src/ast/rewriter/finite_set_axioms.cpp index 5392ba7426..6af20f873d 100644 --- a/src/ast/rewriter/finite_set_axioms.cpp +++ b/src/ast/rewriter/finite_set_axioms.cpp @@ -219,8 +219,12 @@ void finite_set_axioms::in_range_axiom(expr *x, expr *a) { arith_util arith(m); expr_ref x_in_a(u.mk_in(x, a), m); - expr_ref lo_le_x(arith.mk_le(arith.mk_sub(lo, x), arith.mk_int(0)), m); - expr_ref x_le_hi(arith.mk_le(arith.mk_sub(x, hi), arith.mk_int(0)), m); + auto _seqa0 = arith.mk_sub(lo, x); + auto _seqa1 = arith.mk_int(0); + expr_ref lo_le_x(arith.mk_le(_seqa0, _seqa1), m); + auto _seqb0 = arith.mk_sub(x, hi); + auto _seqb1 = arith.mk_int(0); + expr_ref x_le_hi(arith.mk_le(_seqb0, _seqb1), m); m_rewriter(lo_le_x); m_rewriter(x_le_hi); expr_ref nx_le_hi(m.mk_not(x_le_hi), m); @@ -247,7 +251,9 @@ void finite_set_axioms::in_range_axiom(expr* r) { return; arith_util a(m); - expr_ref lo_le_hi(a.mk_le(a.mk_sub(lo, hi), a.mk_int(0)), m); + auto _seq0 = a.mk_sub(lo, hi); + auto _seq1 = a.mk_int(0); + expr_ref lo_le_hi(a.mk_le(_seq0, _seq1), m); m_rewriter(lo_le_hi); add_binary("range-bounds", r, nullptr, m.mk_not(lo_le_hi), u.mk_in(lo, r)); @@ -339,7 +345,17 @@ void finite_set_axioms::size_ub_axiom(expr *sz) { else if (u.is_empty(e)) add_unit("size", e, m.mk_eq(sz, a.mk_int(0))); else if (u.is_union(e, x, y)) { - ineq = a.mk_le(sz, a.mk_add(u.mk_size(x), u.mk_size(y))); + // upper bound: |A ∪ B| ≤ |A| + |B| + auto szx = u.mk_size(x); + auto szy = u.mk_size(y); + ineq = a.mk_le(sz, a.mk_add(szx, szy)); + m_rewriter(ineq); + add_unit("size", e, ineq); + // lower bounds: |A ∪ B| ≥ |A| and |A ∪ B| ≥ |B| + ineq = a.mk_le(szx, sz); + m_rewriter(ineq); + add_unit("size", e, ineq); + ineq = a.mk_le(szy, sz); m_rewriter(ineq); add_unit("size", e, ineq); } @@ -367,7 +383,14 @@ void finite_set_axioms::size_ub_axiom(expr *sz) { add_unit("size", e, ineq); } else if (u.is_range(e, x, y)) { - ineq = a.mk_eq(sz, m.mk_ite(a.mk_le(x, y), a.mk_add(a.mk_sub(y, x), a.mk_int(1)), a.mk_int(0))); + { + auto _seq370_0 = a.mk_le(x, y); + auto _seq376_0 = a.mk_sub(y, x); + auto _seq376_1 = a.mk_int(1); + auto _seq370_1 = a.mk_add(_seq376_0, _seq376_1); + auto _seq370_2 = a.mk_int(0); + ineq = a.mk_eq(sz, m.mk_ite(_seq370_0, _seq370_1, _seq370_2)); + } m_rewriter(ineq); add_unit("size", e, ineq); } @@ -404,4 +427,4 @@ void finite_set_axioms::extensionality_axiom(expr *a, expr* b) { // (a != b) => (x in diff_ab != x in diff_ba) add_ternary("extensionality", a, b, a_eq_b, ndiff_in_a, ndiff_in_b); add_ternary("extensionality", a, b, a_eq_b, diff_in_a, diff_in_b); -} \ No newline at end of file +} diff --git a/src/ast/rewriter/finite_set_rewriter.cpp b/src/ast/rewriter/finite_set_rewriter.cpp index b86f211f1e..d84edab778 100644 --- a/src/ast/rewriter/finite_set_rewriter.cpp +++ b/src/ast/rewriter/finite_set_rewriter.cpp @@ -204,8 +204,16 @@ br_status finite_set_rewriter::mk_size(expr * arg, expr_ref & result) { if (u.is_range(arg, lower, upper)) { // size(range(a, b)) -> b - a + 1 expr_ref size_expr(m); - size_expr = a.mk_add(a.mk_sub(upper, lower), a.mk_int(1)); - result = m.mk_ite(a.mk_gt(lower, upper), a.mk_int(0), size_expr); + { + auto _seq207_0 = a.mk_sub(upper, lower); + auto _seq207_1 = a.mk_int(1); + size_expr = a.mk_add(_seq207_0, _seq207_1); + } + { + auto _seq208_0 = a.mk_gt(lower, upper); + auto _seq208_1 = a.mk_int(0); + result = m.mk_ite(_seq208_0, _seq208_1, size_expr); + } return BR_REWRITE3; } // Size is already in normal form, no simplifications @@ -234,7 +242,11 @@ br_status finite_set_rewriter::mk_in(expr * elem, expr * set, expr_ref & result) expr *lo = nullptr, *hi = nullptr; if (u.is_range(set, lo, hi)) { arith_util a(m); - result = m.mk_and(a.mk_le(lo, elem), a.mk_le(elem, hi)); + { + auto _seq237_0 = a.mk_le(lo, elem); + auto _seq237_1 = a.mk_le(elem, hi); + result = m.mk_and(_seq237_0, _seq237_1); + } return BR_REWRITE2; } // NB we don't rewrite (set.in x (set.union s t)) to (or (set.in x s) (set.in x t)) diff --git a/src/ast/rewriter/fpa_rewriter.cpp b/src/ast/rewriter/fpa_rewriter.cpp index c2c888885b..f7308be21b 100644 --- a/src/ast/rewriter/fpa_rewriter.cpp +++ b/src/ast/rewriter/fpa_rewriter.cpp @@ -493,8 +493,11 @@ br_status fpa_rewriter::mk_lt(expr * arg1, expr * arg2, expr_ref & result) { return BR_DONE; } if (m_util.is_ninf(arg1)) { - // -oo < arg2 --> not(arg2 = -oo) and not(arg2 = NaN) - result = m().mk_and(m().mk_not(m().mk_eq(arg2, arg1)), mk_neq_nan(arg2)); + { + auto _seq497_0 = m().mk_not(m().mk_eq(arg2, arg1)); + auto _seq497_1 = mk_neq_nan(arg2); + result = m().mk_and(_seq497_0, _seq497_1); + } return BR_REWRITE3; } if (m_util.is_ninf(arg2)) { @@ -508,8 +511,11 @@ br_status fpa_rewriter::mk_lt(expr * arg1, expr * arg2, expr_ref & result) { return BR_DONE; } if (m_util.is_pinf(arg2)) { - // arg1 < +oo --> not(arg1 = +oo) and not(arg1 = NaN) - result = m().mk_and(m().mk_not(m().mk_eq(arg1, arg2)), mk_neq_nan(arg1)); + { + auto _seq512_0 = m().mk_not(m().mk_eq(arg1, arg2)); + auto _seq512_1 = mk_neq_nan(arg1); + result = m().mk_and(_seq512_0, _seq512_1); + } return BR_REWRITE3; } @@ -721,6 +727,14 @@ br_status fpa_rewriter::mk_to_bv(func_decl * f, expr * arg1, expr * arg2, bool i if (m_fm.is_nan(v) || m_fm.is_inf(v)) return mk_to_bv_unspecified(f, result); + // A finite value whose (unbiased) binary exponent is at least bv_sz has + // magnitude >= 2^bv_sz and therefore does not fit into a bv_sz-bit signed + // or unsigned integer; the conversion is unspecified. Handle it here to + // avoid calling to_sbv_mpq, which rejects exponents that do not fit into + // an int (throwing "exponents over 31 bits are not supported"). + if (m_fm.exp(v) >= (mpf_exp_t)bv_sz) + return mk_to_bv_unspecified(f, result); + bv_util bu(m()); scoped_mpq q(m_fm.mpq_manager()); m_fm.to_sbv_mpq(rmv, v, q); diff --git a/src/ast/rewriter/pb2bv_rewriter.cpp b/src/ast/rewriter/pb2bv_rewriter.cpp index 95d06f3a22..6c566edaff 100644 --- a/src/ast/rewriter/pb2bv_rewriter.cpp +++ b/src/ast/rewriter/pb2bv_rewriter.cpp @@ -618,7 +618,11 @@ struct pb2bv_rewriter::imp { return expr_ref(m.mk_true(), m); } expr_ref_vector fmls(m); - fmls.push_back(m.mk_implies(m.mk_not(out[0]), mk_seg_le_rec(outs, coeffs, i + 1, k))); + { + auto _seq621_0 = m.mk_not(out[0]); + auto _seq621_1 = mk_seg_le_rec(outs, coeffs, i + 1, k); + fmls.push_back(m.mk_implies(_seq621_0, _seq621_1)); + } rational k1; for (unsigned j = 0; j + 1 < out.size(); ++j) { k1 = k - rational(j+1)*c; @@ -626,7 +630,11 @@ struct pb2bv_rewriter::imp { fmls.push_back(m.mk_not(out[j])); break; } - fmls.push_back(m.mk_implies(m.mk_and(out[j], m.mk_not(out[j+1])), mk_seg_le_rec(outs, coeffs, i + 1, k1))); + { + auto _seq629_0 = m.mk_and(out[j], m.mk_not(out[j + 1])); + auto _seq629_1 = mk_seg_le_rec(outs, coeffs, i + 1, k1); + fmls.push_back(m.mk_implies(_seq629_0, _seq629_1)); + } } return ::mk_and(fmls); } diff --git a/src/ast/rewriter/quant_hoist.cpp b/src/ast/rewriter/quant_hoist.cpp index 7b1c25cf1c..ddbcd7e9b8 100644 --- a/src/ast/rewriter/quant_hoist.cpp +++ b/src/ast/rewriter/quant_hoist.cpp @@ -249,7 +249,11 @@ private: pull_quantifier(t1, qt, vars, tt1, use_fresh, rewrite_ok); nt1 = m.mk_not(t1); pull_quantifier(nt1, qt, vars, ntt1, use_fresh, rewrite_ok); - result = m.mk_and(m.mk_or(ntt1, tt2), m.mk_or(tt1, tt3)); + { + auto _seq252_0 = m.mk_or(ntt1, tt2); + auto _seq252_1 = m.mk_or(tt1, tt3); + result = m.mk_and(_seq252_0, _seq252_1); + } } else { result = m.mk_ite(t1, tt2, tt3); @@ -263,7 +267,11 @@ private: nt2 = m.mk_not(t2); pull_quantifier(nt1, qt, vars, ntt1, use_fresh, rewrite_ok); pull_quantifier(nt2, qt, vars, ntt2, use_fresh, rewrite_ok); - result = m.mk_and(m.mk_or(ntt1, tt2), m.mk_or(ntt2, tt1)); + { + auto _seq266_0 = m.mk_or(ntt1, tt2); + auto _seq266_1 = m.mk_or(ntt2, tt1); + result = m.mk_and(_seq266_0, _seq266_1); + } } else { // the formula contains a quantifier, but it is "inaccessible" diff --git a/src/ast/rewriter/seq_axioms.cpp b/src/ast/rewriter/seq_axioms.cpp index c309afa59b..21ed7d9e37 100644 --- a/src/ast/rewriter/seq_axioms.cpp +++ b/src/ast/rewriter/seq_axioms.cpp @@ -290,7 +290,11 @@ namespace seq { return false; } expr_ref l2(m), l1(l, m); - l2 = mk_sub(mk_len(s), a.mk_int(1)); + { + auto _seq287_0 = mk_len(s); + auto _seq287_1 = a.mk_int(1); + l2 = mk_sub(_seq287_0, _seq287_1); + } m_rewrite(l1); m_rewrite(l2); return l1 == l2; @@ -315,7 +319,11 @@ namespace seq { if (!a.is_numeral(i, i1) || !i1.is_one()) return false; expr_ref l2(m), l1(l, m); - l2 = mk_sub(mk_len(s), a.mk_int(1)); + { + auto _seq312_0 = mk_len(s); + auto _seq312_1 = a.mk_int(1); + l2 = mk_sub(_seq312_0, _seq312_1); + } m_rewrite(l1); m_rewrite(l2); return l1 == l2; @@ -478,8 +486,11 @@ namespace seq { expr_ref len_s = mk_len(s); expr_ref mone(a.mk_int(-1), m); add_clause(~cnt, s_eq_empty, ~mk_literal(seq.str.mk_contains(seq.str.mk_substr(t,zero,a.mk_add(i,len_s,mone)),s))); - add_clause(~cnt, s_eq_empty, mk_seq_eq(seq.str.mk_substr(t,zero,a.mk_add(i,len_s)), - seq.str.mk_concat(seq.str.mk_substr(t,zero,i), s))); + { + auto _seq475_0 = seq.str.mk_substr(t, zero, a.mk_add(i, len_s)); + auto _seq475_1 = seq.str.mk_concat(seq.str.mk_substr(t, zero, i), s); + add_clause(~cnt, s_eq_empty, mk_seq_eq(_seq475_0, _seq475_1)); + } #endif } else { @@ -718,9 +729,13 @@ namespace seq { TRACE(seq, tout << mk_pp(e, m) << "\n";); expr_ref ge0 = mk_ge(e, 0); expr* s = nullptr; - VERIFY (seq.str.is_stoi(e, s)); - add_clause(mk_ge(e, -1)); // stoi(s) >= -1 - add_clause(mk_eq(seq.str.mk_stoi(seq.str.mk_empty(s->get_sort())), a.mk_int(-1))); + VERIFY (seq.str.is_stoi(e, s)); + add_clause(mk_ge(e, -1)); + { + auto _seq717_0 = seq.str.mk_stoi(seq.str.mk_empty(s->get_sort())); + auto _seq717_1 = a.mk_int(-1); + add_clause(mk_eq(_seq717_0, _seq717_1)); + } // add_clause(~mk_eq_empty(s), mk_eq(e, a.mk_int(-1))); // s = "" => stoi(s) = -1 add_clause(~ge0, is_digit(mk_nth(s, 0))); // stoi(s) >= 0 => is_digit(nth(s,0)) add_clause(~ge0, mk_ge(mk_len(s), 1)); // stoi(s) >= 0 => len(s) >= 1 @@ -807,7 +822,11 @@ namespace seq { p *= 10; } es.reverse(); - eq = m.mk_eq(seq.str.mk_ubv2s(b), seq.str.mk_concat(es, seq.str.mk_string_sort())); + { + auto _seq804_0 = seq.str.mk_ubv2s(b); + auto _seq804_1 = seq.str.mk_concat(es, seq.str.mk_string_sort()); + eq = m.mk_eq(_seq804_0, _seq804_1); + } SASSERT(pow < rational::power_of_two(sz)); if (k == 0) add_clause(ge10k1, eq); @@ -879,7 +898,11 @@ namespace seq { expr_ref eq(m); unsigned sz = bv.get_bv_size(bv_sort); for (unsigned i = 0; i < 10; ++i) { - eq = m.mk_eq(m_sk.mk_ubv2ch(bv.mk_numeral(i, sz)), seq.mk_char('0' + i)); + { + auto _seq876_0 = m_sk.mk_ubv2ch(bv.mk_numeral(i, sz)); + auto _seq876_1 = seq.mk_char('0' + i); + eq = m.mk_eq(_seq876_0, _seq876_1); + } add_clause(eq); } } @@ -1021,8 +1044,10 @@ namespace seq { */ void axioms::str_to_code_axiom(expr* n) { expr* e = nullptr; - VERIFY(seq.str.is_to_code(n, e)); - expr_ref len_is1 = mk_eq(mk_len(e), a.mk_int(1)); + VERIFY(seq.str.is_to_code(n, e)); + auto _seq1019_0 = mk_len(e); + auto _seq1019_1 = a.mk_int(1); + expr_ref len_is1 = mk_eq(_seq1019_0, _seq1019_1); add_clause(~len_is1, mk_ge(n, 0)); add_clause(~len_is1, mk_le(n, seq.max_char())); add_clause(~len_is1, mk_eq(n, seq.mk_char2int(mk_nth(e, 0)))); @@ -1042,7 +1067,11 @@ namespace seq { expr_ref ge = mk_ge(e, 0); expr_ref le = mk_le(e, seq.max_char()); expr_ref emp = expr_ref(seq.str.mk_is_empty(n), m); - add_clause(~ge, ~le, mk_eq(mk_len(n), a.mk_int(1))); + { + auto _seq1039_0 = mk_len(n); + auto _seq1039_1 = a.mk_int(1); + add_clause(~ge, ~le, mk_eq(_seq1039_0, _seq1039_1)); + } if (!seq.str.is_to_code(e)) add_clause(~ge, ~le, mk_eq(seq.str.mk_to_code(n), e)); add_clause(ge, emp); @@ -1175,12 +1204,20 @@ namespace seq { auto s = purify(_s); auto t = purify(_t); expr_ref lit = expr_ref(e, m); - expr_ref s_gt_t = mk_ge(mk_sub(mk_len(s), mk_len(t)), 1); + auto _seql0 = mk_len(s); + auto _seql1 = mk_len(t); + expr_ref s_gt_t = mk_ge(mk_sub(_seql0, _seql1), 1); #if 0 expr_ref x = m_sk.mk_pre(t, mk_sub(mk_len(t), mk_len(s))); - expr_ref y = m_sk.mk_tail(t, mk_sub(mk_len(s), a.mk_int(1))); + auto _seq1182_0 = mk_len(s); + auto _seq1182_1 = a.mk_int(1); + expr_ref y = m_sk.mk_tail(t, mk_sub(_seq1182_0, _seq1182_1)); add_clause(lit, s_gt_t, mk_seq_eq(t, mk_concat(x, y))); - add_clause(lit, s_gt_t, mk_eq(mk_len(y), mk_len(s))); + { + auto _seq1184_0 = mk_len(y); + auto _seq1184_1 = mk_len(s); + add_clause(lit, s_gt_t, mk_eq(_seq1184_0, _seq1184_1)); + } add_clause(lit, s_gt_t, ~mk_eq(y, s)); #else sort* char_sort = nullptr; @@ -1202,12 +1239,21 @@ namespace seq { auto s = purify(_s); auto t = purify(_t); expr_ref lit = expr_ref(e, m); - expr_ref s_gt_t = mk_ge(mk_sub(mk_len(s), mk_len(t)), 1); + auto _seql0 = mk_len(s); + auto _seql1 = mk_len(t); + expr_ref s_gt_t = mk_ge(mk_sub(_seql0, _seql1), 1); #if 0 - expr_ref x = m_sk.mk_pre(t, mk_len(s)); - expr_ref y = m_sk.mk_tail(t, mk_sub(mk_sub(mk_len(t), mk_len(s)), a.mk_int(1))); + expr_ref x = m_sk.mk_pre(t, mk_len(s)); auto _seq1241_0 = mk_len(t); + auto _seq1241_1 = mk_len(s); + auto _seq1209_0 = mk_sub(_seq1241_0, _seq1241_1); + auto _seq1209_1 = a.mk_int(1); + expr_ref y = m_sk.mk_tail(t, mk_sub(_seq1209_0, _seq1209_1)); add_clause(lit, s_gt_t, mk_seq_eq(t, mk_concat(x, y))); - add_clause(lit, s_gt_t, mk_eq(mk_len(x), mk_len(s))); + { + auto _seq1211_0 = mk_len(x); + auto _seq1211_1 = mk_len(s); + add_clause(lit, s_gt_t, mk_eq(_seq1211_0, _seq1211_1)); + } add_clause(lit, s_gt_t, ~mk_eq(x, s)); #else @@ -1439,6 +1485,4 @@ namespace seq { add_clause(eq_uv, ~len_eq, ~mk_eq(a, b)); add_clause(eq_uv, ~len_eq, mk_eq(up_len, vp_len)); } - - } diff --git a/src/ast/rewriter/seq_derive.cpp b/src/ast/rewriter/seq_derive.cpp index 2b0a5b56fa..1e0db83a4f 100644 --- a/src/ast/rewriter/seq_derive.cpp +++ b/src/ast/rewriter/seq_derive.cpp @@ -412,14 +412,35 @@ namespace seq { in_range = m_util.mk_le(m_ele, c_hi); else if (hi_trivial) in_range = m_util.mk_le(c_lo, m_ele); - else - in_range = m.mk_and(m_util.mk_le(c_lo, m_ele), m_util.mk_le(m_ele, c_hi)); + else { + auto _seq416_0 = m_util.mk_le(c_lo, m_ele); + auto _seq416_1 = m_util.mk_le(m_ele, c_hi); + in_range = m.mk_and(_seq416_0, _seq416_1); + } return mk_ite(in_range, eps, empty); } - // Fallback: stuck derivative - return expr_ref(re().mk_derivative(m_ele, re().mk_range(lo, hi)), m); + // One or both bounds are symbolic. By SMT-LIB semantics re.range(lo,hi) + // accepts a single character c iff lo and hi are both single-character + // strings and lo[0] <= c <= hi[0]. Build the symbolic derivative + // ite(len(lo)=1 ∧ len(hi)=1 ∧ lo[0] ≤ ele ∧ ele ≤ hi[0], ε, ∅) + // omitting length conditions for bounds that are already known to be + // concrete single-character strings. + expr_ref_vector conds(m); + expr_ref zero(m_autil.mk_int(0), m); + if (!u().str.is_unit_string(lo, c_lo)) { + conds.push_back(m.mk_eq(u().str.mk_length(lo), m_autil.mk_int(1))); + c_lo = u().str.mk_nth_i(lo, zero); + } + if (!u().str.is_unit_string(hi, c_hi)) { + conds.push_back(m.mk_eq(u().str.mk_length(hi), m_autil.mk_int(1))); + c_hi = u().str.mk_nth_i(hi, zero); + } + conds.push_back(m_util.mk_le(c_lo, m_ele)); + conds.push_back(m_util.mk_le(m_ele, c_hi)); + expr_ref in_range = m_br.mk_and(conds); + return mk_ite(in_range, eps, empty); } expr_ref derive::derive_of_pred(expr* pred, sort* seq_sort) { @@ -489,26 +510,27 @@ namespace seq { result = re().mk_reverse(r); else if (re().is_reverse(r, r1)) result = r1; - else if (re().is_concat(r, r1, r2)) - result = re().mk_concat(mk_regex_reverse(r2), mk_regex_reverse(r1)); - else if (m.is_ite(r, c, r1, r2)) - result = m.mk_ite(c, mk_regex_reverse(r1), mk_regex_reverse(r2)); - else if (re().is_union(r, r1, r2)) { + else if (re().is_concat(r, r1, r2)) { + auto _seq0 = mk_regex_reverse(r2); + auto _seq1 = mk_regex_reverse(r1); + result = re().mk_concat(_seq0, _seq1); + } else if (m.is_ite(r, c, r1, r2)) { + auto _seq0 = mk_regex_reverse(r1); + auto _seq1 = mk_regex_reverse(r2); + result = m.mk_ite(c, _seq0, _seq1); + } else if (re().is_union(r, r1, r2)) { auto a1 = mk_regex_reverse(r1); auto b1 = mk_regex_reverse(r2); result = re().mk_union(a1, b1); - } - else if (re().is_intersection(r, r1, r2)) { + } else if (re().is_intersection(r, r1, r2)) { auto a1 = mk_regex_reverse(r1); auto b1 = mk_regex_reverse(r2); result = re().mk_inter(a1, b1); - } - else if (re().is_diff(r, r1, r2)) { + } else if (re().is_diff(r, r1, r2)) { auto a1 = mk_regex_reverse(r1); auto b1 = mk_regex_reverse(r2); result = re().mk_diff(a1, b1); - } - else if (re().is_star(r, r1)) + } else if (re().is_star(r, r1)) result = re().mk_star(mk_regex_reverse(r1)); else if (re().is_plus(r, r1)) result = re().mk_plus(mk_regex_reverse(r1)); @@ -833,7 +855,11 @@ namespace seq { if (m.is_ite(e, c1, t1, el1) && m.is_ite(s, c2, t2, el2) && c1 == c2) { set.set(i, set.back()); set.pop_back(); - e = mk_ite(c1, mk_union(t1, t2), mk_union(el1, el2)); + { + auto _seq824_0 = mk_union(t1, t2); + auto _seq824_1 = mk_union(el1, el2); + e = mk_ite(c1, _seq824_0, _seq824_1); + } changed = true; break; } @@ -892,10 +918,16 @@ namespace seq { // nested inter/union leaves, so states stay ground either way. expr *u1 = nullptr, *u2 = nullptr; if (m_derivative_kind == derivative_kind::antimirov_t) { - if (re().is_union(a, u1, u2)) - return mk_union(mk_inter(u1, b), mk_inter(u2, b)); - if (re().is_union(b, u1, u2)) - return mk_union(mk_inter(a, u1), mk_inter(a, u2)); + if (re().is_union(a, u1, u2)) { + auto _seq0 = mk_inter(u1, b); + auto _seq1 = mk_inter(u2, b); + return mk_union(_seq0, _seq1); + } + if (re().is_union(b, u1, u2)) { + auto _seq0 = mk_inter(a, u1); + auto _seq1 = mk_inter(a, u2); + return mk_union(_seq0, _seq1); + } } // Base case: build raw intersection @@ -993,10 +1025,16 @@ namespace seq { // state is shared rather than growing into ~(Σ*a ∪ ε ∪ ...), which // otherwise defeats dead-state detection on loop ∩ comp regexes. expr* e1 = nullptr, *e2 = nullptr; - if (re().is_union(a, e1, e2)) - return mk_inter(mk_complement(e1), mk_complement(e2)); - if (re().is_intersection(a, e1, e2)) - return mk_union(mk_complement(e1), mk_complement(e2)); + if (re().is_union(a, e1, e2)) { + auto _seq0 = mk_complement(e1); + auto _seq1 = mk_complement(e2); + return mk_inter(_seq0, _seq1); + } + if (re().is_intersection(a, e1, e2)) { + auto _seq0 = mk_complement(e1); + auto _seq1 = mk_complement(e2); + return mk_union(_seq0, _seq1); + } return expr_ref(re().mk_complement(a), m); } diff --git a/src/ast/rewriter/seq_eq_solver.cpp b/src/ast/rewriter/seq_eq_solver.cpp index a77aaa55ba..73b814fd60 100644 --- a/src/ast/rewriter/seq_eq_solver.cpp +++ b/src/ast/rewriter/seq_eq_solver.cpp @@ -408,7 +408,9 @@ namespace seq { return true; } - expr_ref eq_length(m.mk_eq(a.mk_int(lenX), seq.str.mk_length(X)), m); + auto _seq0 = a.mk_int(lenX); + auto _seq1 = seq.str.mk_length(X); + expr_ref eq_length(m.mk_eq(_seq0, _seq1), m); expr* val = ctx.expr2rep(eq_length); if (!m.is_false(val)) { expr_ref Y(seq.str.mk_concat(lenX.get_unsigned(), units.data(), X->get_sort()), m); diff --git a/src/ast/rewriter/seq_monadic.cpp b/src/ast/rewriter/seq_monadic.cpp index 7987407047..2d5f868084 100644 --- a/src/ast/rewriter/seq_monadic.cpp +++ b/src/ast/rewriter/seq_monadic.cpp @@ -7,16 +7,16 @@ Module Name: Abstract: - Continuation-regex split service and intersection non-emptiness. See - seq_monadic.h. + Whole-language monadic decomposition for regex membership. See seq_monadic.h. + Automaton-based (product-reachability); reach(q) is never materialized as a regex. - Automaton-based (product/derivative reachability) and element-sort agnostic: - guard feasibility and successor states are computed entirely by the symbolic - derivative engine (seq_rewriter::brz_derivative_cofactors, which prunes - infeasible guards internally), so there is no character-specific reasoning in - this module. A single global derivative-transition graph is grown lazily and - recycled across every regex, so no derivative is computed twice. th_rewriter is - used to normalize the intersection regex. + Generic in the element sort. The decomposition, liveness and product-reachability + are element-agnostic; only the *guard algebra* over the derivative cofactor guards + depends on the element sort. For the character sort it is the exact, compact + seq::range_predicate; for any other element sort it is a candidate-basis over the + element values mentioned by the guards (sound and complete for the + {true,false,=,<=,and,or,not} grammar the derivatives emit). The same guard algebra + yields the concrete element used to build a witness sequence. Author: @@ -25,14 +25,14 @@ Author: Shady parts: - epsilon transitions appear not accounted for when computing reaching states. - If a regex R contains N by taking a set of epsilon transitions, then it is nullable relative + If a regex R contains N by taking a set of epsilon transitions, then it is nullable relative to N. It suggests a use for a version of nullability that is relative to N. Deal also with when N itself has epsilon transitions to N1, .., Nk. - witness extraction is plain wrong. It should generally rely on a choice function that takes a Boolean expression F[(:var 0)] with a single free variable and synthesize a value for the free - variable such that the expression is true. - For character predicates we can assume that the Boolean expressions are range predicates and we can + variable such that the expression is true. + For character predicates we can assume that the Boolean expressions are range predicates and we can use utilities for range predicates. For other types use some best effort, say F is of the form (= (:var 0) value). Expose the witness function in a self-contained module outside of this file. @@ -53,430 +53,585 @@ Shady parts: --*/ #include "ast/rewriter/seq_monadic.h" +#include "ast/rewriter/seq_range_collapse.h" +#include "ast/arith_decl_plugin.h" +#include "ast/bv_decl_plugin.h" #include #include -#include +#include +#include +#include +#include -namespace seq { +namespace { - // ------------------------------------------------------------------ - // global derivative-transition graph (shared / recycled across regexes) - // ------------------------------------------------------------------ +// A conjunction of derivative cofactor guards over the element variable v0 = (:var 0), +// interpreted as the set of element values satisfying it. Two representations by +// element sort: +// * character sort: the exact, compact seq::range_predicate. +// * any other sort: the guard predicate kept symbolically and decided by a candidate +// basis -- the element values mentioned in the guards, plus one fresh value. This +// is sound and complete for the {true,false,=,<=,and,or,not} grammar the derivatives +// emit (over a general element sort only equalities appear). +class guard_set { + ast_manager& m; + seq_util& u; + sort* m_sort; + expr* m_v0; + bool m_is_char; + bool m_ok = true; // false: an unsupported guard was conjoined + seq::range_predicate m_rp; // char representation + expr_ref m_guard; // generic representation (conjunction over v0) - lbool split_manager::nullable(expr* s) { - expr_ref nb = m_rw.is_nullable(s); - return m.is_true(nb) ? l_true : m.is_false(nb) ? l_false : l_undef; - } + // ---- generic path: candidate basis ---- - unsigned split_manager::intern_state(expr* s) { - unsigned id; - if (m_state_id.find(s, id)) - return id; // recycle the global state - id = m_gstate.size(); - m_state_id.insert(s, id); - m_gstate.push_back(s); - m_pin.push_back(s); - m_gmaybe_null.push_back(nullable(s) != l_false); // unknown nullability => keep (conservative) - m_gexpanded.push_back(false); - m_gsucc.push_back(svector()); - return id; - } - - void split_manager::expand_state(unsigned i, bool& ok) { - ok = true; - if (m_gexpanded[i]) - return; // successors already computed once - if (!m.inc()) { ok = false; return; } - expr* s = m_gstate[i]; // captured before any interning realloc - expr_ref_pair_vector cof(m); - m_rw.brz_derivative_cofactors(s, cof); - svector edges; - for (auto const& [g, t] : cof) { - if (re().is_empty(t)) continue; // engine already pruned infeasible guards - unsigned k = intern_state(t); // may realloc m_gsucc: collect edges first - m_pin.push_back(g); - edges.push_back(gedge{ g, k }); - } - for (gedge const& e : edges) // m_gsucc stable now (no more interning) - m_gsucc[i].push_back(e); - m_gexpanded[i] = true; - } - - // ------------------------------------------------------------------ - // live-state / reachability machinery (projected out of the global graph) - // ------------------------------------------------------------------ - - void split_manager::build_graph(expr* R, ptr_vector& states, - vector>& succ, - bool_vector& maybe_null, bool& ok) { - ok = true; - states.reset(); - succ.reset(); - maybe_null.reset(); - obj_map local; // state expr -> local index - svector l2g; // local index -> global id - auto local_of = [&](expr* s) -> unsigned { - unsigned li; - if (local.find(s, li)) return li; - unsigned gid = intern_state(s); - li = states.size(); - local.insert(s, li); - l2g.push_back(gid); - states.push_back(s); - maybe_null.push_back(m_gmaybe_null[gid]); - succ.push_back(svector()); - return li; - }; - local_of(R); - const unsigned STATE_CAP = 1u << 12; - for (unsigned i = 0; i < states.size(); ++i) { - if (states.size() > STATE_CAP || !m.inc()) { ok = false; return; } - unsigned gid = l2g[i]; - expand_state(gid, ok); - if (!ok) return; - svector tgts; // snapshot: local_of may realloc m_gsucc - for (gedge const& e : m_gsucc[gid]) - tgts.push_back(e.target); - for (unsigned t : tgts) { - // hoist local_of out of the subscript: it may push_back onto succ - // (reallocating it), which would dangle a succ[i] taken first. - unsigned li = local_of(m_gstate[t]); - succ[i].push_back(li); - } - } - } - - // Backward closure of `seed` over the transition graph `succ`: mark every - // state that can reach an already-marked one, then collect the marked states - // into `out`. `seed` is used in place as the working set. - static void collect_backward_closure(vector> const& succ, bool_vector& seed, - ptr_vector const& states, ptr_vector& out) { - const unsigned n = states.size(); - for (bool ch = true; ch; ) { - ch = false; - for (unsigned i = 0; i < n; ++i) - if (!seed[i]) - for (unsigned j : succ[i]) - if (seed[j]) { seed[i] = true; ch = true; break; } - } - for (unsigned i = 0; i < n; ++i) - if (seed[i]) out.push_back(states.get(i)); - } - - void split_manager::reachable_states(expr* R, expr* accept_target, - ptr_vector& out, bool& ok) { - ptr_vector states; - vector> succ; - bool_vector maybe_null; // membership acceptance seed - build_graph(R, states, succ, maybe_null, ok); - if (!ok) return; - if (!accept_target) { // membership: seed = nullable states - collect_backward_closure(succ, maybe_null, states, out); + // element values compared to v0 by the equalities in `g`. + void collect_consts(expr* g, ptr_vector& out) const { + expr* a = nullptr, * b = nullptr; + if (m.is_and(g) || m.is_or(g)) { + for (expr* arg : *to_app(g)) collect_consts(arg, out); return; } - bool_vector reach; // reach: seed = the target state N - reach.resize(states.size(), false); - bool found = false; - for (unsigned i = 0; i < states.size(); ++i) - if (states.get(i) == accept_target) { reach[i] = true; found = true; break; } - if (found) // N unreachable => no midpoints - collect_backward_closure(succ, reach, states, out); + if (m.is_not(g, a)) { collect_consts(a, out); return; } + if (m.is_eq(g, a, b)) { + if (a == m_v0 && b != m_v0) out.push_back(b); + else if (b == m_v0 && a != m_v0) out.push_back(a); + } } - // ------------------------------------------------------------------ - // intersection non-emptiness - // ------------------------------------------------------------------ - - // A component is a membership (nullable) component when N_i is null or - // the epsilon regex; otherwise it is a reach component with structural target N_i. - static bool is_membership(seq_util::rex& re, cont_regex const& cr) { - expr* N = cr.second.get(); - return N == nullptr || re.is_epsilon(N); - } - - // Flatten the operands of a (possibly nested) re.inter into `out`. - static void flatten_inter(seq_util::rex& re, expr* e, ptr_vector& out) { + // evaluate `g` at v0 := cand ; l_undef on a construct outside the grammar. + lbool eval_at(expr* g, expr* cand) const { expr* a = nullptr, * b = nullptr; - if (re.is_intersection(e, a, b)) { - flatten_inter(re, a, out); - flatten_inter(re, b, out); + if (m.is_true(g)) return l_true; + if (m.is_false(g)) return l_false; + if (m.is_not(g, a)) { + lbool r = eval_at(a, cand); + return r == l_undef ? l_undef : (r == l_true ? l_false : l_true); + } + if (m.is_and(g)) { + lbool r = l_true; + for (expr* arg : *to_app(g)) { + lbool e = eval_at(arg, cand); + if (e == l_false) return l_false; + if (e == l_undef) r = l_undef; + } + return r; + } + if (m.is_or(g)) { + lbool r = l_false; + for (expr* arg : *to_app(g)) { + lbool e = eval_at(arg, cand); + if (e == l_true) return l_true; + if (e == l_undef) r = l_undef; + } + return r; + } + if (m.is_eq(g, a, b)) { + expr* other = (a == m_v0) ? b : (b == m_v0 ? a : nullptr); + if (!other) return l_undef; + if (other == m_v0) return l_true; + return (cand == other) ? l_true : l_false; // canonical values: identity == equality + } + return l_undef; + } + + // a value of m_sort distinct from every element of `consts`, if one can be built. + bool mk_fresh(ptr_vector const& consts, expr_ref& out) const { + if (m.is_bool(m_sort)) { + bool hasT = false, hasF = false; + for (expr* c : consts) { if (m.is_true(c)) hasT = true; else if (m.is_false(c)) hasF = true; } + if (!hasT) { out = m.mk_true(); return true; } + if (!hasF) { out = m.mk_false(); return true; } + return false; + } + arith_util a(m); + if (a.is_int_real(m_sort)) { + rational mx(0); bool any = false; + for (expr* c : consts) { + rational v; + if (a.is_numeral(c, v)) { if (!any || v > mx) mx = v; any = true; } + } + out = a.mk_numeral(any ? mx + rational(1) : rational(0), a.is_int(m_sort)); + return true; + } + bv_util bv(m); + if (bv.is_bv_sort(m_sort)) { + unsigned sz = bv.get_bv_size(m_sort); + for (unsigned k = 0; k <= consts.size(); ++k) { + rational kv(k); + bool clash = false; + for (expr* c : consts) { + rational v; unsigned bsz = 0; + if (bv.is_numeral(c, v, bsz) && v == kv) { clash = true; break; } + } + if (!clash) { out = bv.mk_numeral(kv, sz); return true; } + } + return false; + } + return false; + } + + lbool generic_eval(expr_ref* witness) const { + ptr_vector consts; + collect_consts(m_guard, consts); + bool saw_undef = false; + for (expr* c : consts) { + lbool r = eval_at(m_guard, c); + if (r == l_true) { if (witness) *witness = expr_ref(c, m); return l_true; } + if (r == l_undef) saw_undef = true; + } + expr_ref fresh(m); + if (mk_fresh(consts, fresh)) { + lbool r = eval_at(m_guard, fresh); + if (r == l_true) { if (witness) *witness = fresh; return l_true; } + if (r == l_undef) saw_undef = true; } else - out.push_back(e); + saw_undef = true; // the "distinct from all mentioned values" region is untested + return saw_undef ? l_undef : l_false; } - // Beyond `depth_cap` elements the length no longer changes acceptance, so the - // BFS caps the depth component of its visited key there to stay finite. - static unsigned depth_cap(unsigned lo, unsigned hi) { return hi == UINT_MAX ? lo : hi; } - - // Reconstruct the per-position guard sequence of the accepting node `cur` by - // walking its parent chain and reversing. `Node` has `.parent` (int) and - // `.guard` (expr*); the root (parent < 0) contributes no guard. - template - static void emit_witness(std::vector const& nodes, int cur, expr_ref_vector& seq) { - ptr_vector gs; - for (int j = cur; j >= 0 && nodes[j].parent >= 0; j = nodes[j].parent) - gs.push_back(nodes[j].guard); - for (unsigned k = gs.size(); k-- > 0; ) - seq.push_back(gs[k]); +public: + guard_set(ast_manager& _m, seq_util& _u, sort* elem_sort, expr* v0) + : m(_m), u(_u), m_sort(elem_sort), m_v0(v0), + m_is_char(_u.is_char(elem_sort)), + m_rp(_u.max_char()), m_guard(_m) { + if (m_is_char) m_rp = seq::range_predicate::top(u.max_char()); + else m_guard = m.mk_true(); } - // Shared bounded BFS with witness reconstruction, used by both the membership - // and the product intersection search. It explores states of type `State` up - // to depth `hi`, deduping on (key_of(state), min(depth, depth_cap)) so the walk - // stays finite even for hi == UINT_MAX. The callbacks abstract the two engines: - // key_of(state) -- comparable dedup key for the state - // accept(state) -> lbool -- l_true accepting / l_false not / l_undef unknown - // expand(state, out) -- append (successor, incoming-guard) pairs; return - // false on a resource limit - // Returns l_true with the per-position guard witness in `seq`, l_false, or - // l_undef (resource limit or an undecidable acceptance encountered en route). - template - static lbool bounded_search(ast_manager& m, State const& start, unsigned lo, unsigned hi, - KeyOf key_of, Accept accept, Expand expand, expr_ref_vector& seq) { - struct node { State st; unsigned depth; int parent; expr* guard; }; - std::vector nodes; - const unsigned cap = depth_cap(lo, hi); - auto vkey = [&](State const& s, unsigned d) { - return std::make_pair(key_of(s), d < cap ? d : cap); - }; - std::set visited; - nodes.push_back(node{ start, 0, -1, nullptr }); - visited.insert(vkey(start, 0)); - bool undecided = false; - for (size_t head = 0; head < nodes.size(); ++head) { - if (!m.inc()) return l_undef; - int cur = (int) head; - State st = nodes[cur].st; // copy: `nodes` may grow below - unsigned depth = nodes[cur].depth; - if (depth >= lo && depth <= hi) { - switch (accept(st)) { - case l_true: emit_witness(nodes, cur, seq); return l_true; - case l_undef: undecided = true; break; // cannot claim l_false - case l_false: break; - } - } - if (depth >= hi) - continue; // cannot extend further - std::vector> next; - if (!expand(st, next)) return l_undef; - for (auto const& [ns, g] : next) - if (visited.insert(vkey(ns, depth + 1)).second) - nodes.push_back(node{ ns, depth + 1, cur, g }); + bool ok() const { return m_ok; } + + // AND in a cofactor guard g (a Boolean over v0). + void conjoin(expr* g) { + if (!m_ok) return; + if (m_is_char) { + seq::range_predicate s(u.max_char()); + if (!seq::guard_to_range_predicate(u, m_v0, g, s)) { m_ok = false; return; } + m_rp = m_rp & s; } - return undecided ? l_undef : l_false; + else + m_guard = m.mk_and(m_guard, g); } - lbool split_manager::intersect(vector const& crs, unsigned lo, unsigned hi, - expr_ref_vector& seq) { - seq.reset(); - unsigned n = crs.size(); - if (n == 0) { - // universal language: contains a word of every length; non-empty iff lo <= hi - if (lo > hi) return l_false; - for (unsigned k = 0; k < lo; ++k) - seq.push_back(m.mk_true()); // trivial guard: any element admissible + // l_false = empty, l_true = non-empty (sets *witness if non-null to a concrete + // element of the set), l_undef = unknown / unsupported guard. + lbool eval(expr_ref* witness) const { + if (!m_ok) return l_undef; + if (m_is_char) { + if (m_rp.is_empty()) return l_false; + if (witness) *witness = expr_ref(u.mk_char(m_rp[0].first), m); return l_true; } - // Fast, robust path when every component is a membership (nullable) component: - // the intersection is non-empty iff some reachable product state is nullable. - bool all_memb = true; - for (auto const& cr : crs) - if (!is_membership(re(), cr)) { all_memb = false; break; } - if (all_memb) - return intersect_membership(crs, lo, hi, seq); - - // General case: a tuple product search that also handles reach targets - // N != epsilon via structural target matching. - return intersect_product(crs, lo, hi, seq); + return generic_eval(witness); } +}; - lbool split_manager::intersect_membership(vector const& crs, unsigned lo, - unsigned hi, expr_ref_vector& seq) { - unsigned n = crs.size(); - // The normalized intersection regex; the derivative engine handles guard - // feasibility and successor computation internally. A single (interned, - // globally cached) state is searched: acceptance is nullability, successors - // are the cached cofactor edges. - expr_ref P(crs[0].first.get(), m); - for (unsigned i = 1; i < n; ++i) - P = re().mk_inter(P, crs[i].first.get()); - m_th(P); - unsigned r0 = intern_state(P.get()); +} - auto key_of = [](unsigned st) { return st; }; - auto accept = [&](unsigned st) { - return m_gmaybe_null[st] ? nullable(m_gstate[st]) : l_false; - }; - auto expand = [&](unsigned st, std::vector>& out) { - bool ok = true; - expand_state(st, ok); - if (!ok) return false; - for (gedge const& e : m_gsucc[st]) // no interning here => m_gsucc stable - out.push_back({ e.target, e.guard }); - return true; - }; - return bounded_search(m, r0, lo, hi, key_of, accept, expand, seq); - } +expr_ref seq_monadic::der_elem(expr* r, expr* elem) { + expr_ref d = m_rw.mk_derivative(elem, r); // mk_derivative(element, regex) + // Normalize: for a general element sort the derivative by a non-matching constant can + // leave a ground guard (e.g. (= 1 2)) unfolded; simplifying collapses such dead + // branches to re.empty so nullability/emptiness stay decidable. + expr_ref d2(m); + m_thrw(d, d2); + return d2; +} - lbool split_manager::intersect_product(vector const& crs, unsigned lo, - unsigned hi, expr_ref_vector& seq) { - unsigned n = crs.size(); - - bool_vector memb; // per component: membership (nullable) vs reach - ptr_vector tgt; // per component: reach target (or null) - svector start; // start tuple - for (auto const& cr : crs) { - bool mb = is_membership(re(), cr); - memb.push_back(mb); - tgt.push_back(mb ? nullptr : cr.second.get()); - start.push_back(cr.first.get()); - m_pin.push_back(cr.first.get()); - if (!mb) m_pin.push_back(cr.second.get()); +void seq_monadic::live_states(expr* R, ptr_vector& out, bool& ok) { + ok = true; + obj_map id; + expr_ref_vector states(m); + vector> succ; + bool_vector maybe_null; + auto intern = [&](expr* s) -> unsigned { + unsigned k; + if (id.find(s, k)) return k; + k = states.size(); + id.insert(s, k); + states.push_back(s); + succ.push_back(svector()); + expr_ref nb = m_rw.is_nullable(s); + maybe_null.push_back(!m.is_false(nb)); // unknown nullability => keep (conservative) + return k; + }; + intern(R); + const unsigned STATE_CAP = 1u << 12; + for (unsigned i = 0; i < states.size(); ++i) { + if (states.size() > STATE_CAP || !m.inc()) { ok = false; return; } + expr_ref_pair_vector cof(m); + m_rw.brz_derivative_cofactors(states.get(i), cof); + for (auto const& [g, t] : cof) { + if (re().is_empty(t)) continue; + unsigned k = intern(t); // MUST precede succ[i] indexing: intern may + succ[i].push_back(k); // grow (realloc) succ, invalidating succ[i]& } - - // Search state is the product tuple; acceptance is per-component (nullable - // for membership, structural target match for reach); successors are the - // cofactors of inter(st_0,...,st_{n-1}) decomposed positionally. - auto key_of = [](svector const& st) { - std::vector k; - k.reserve(st.size()); - for (expr* e : st) k.push_back(e->get_id()); - return k; - }; - auto accept = [&](svector const& st) -> lbool { - for (unsigned i = 0; i < n; ++i) { - if (!memb[i]) { - if (st[i] != tgt[i]) return l_false; // reach: structural target - continue; - } - switch (nullable(st[i])) { - case l_true: continue; - case l_false: return l_false; - case l_undef: return l_undef; - } - } - return l_true; - }; - // The engine prunes infeasible joint guards and yields the product successor - // as the re.inter of the per-component derivatives -- but we must NOT assume - // it keeps them in source order (mk_inter subset-collapses, De-Morgan-merges, - // and may reorder operands). So we recover the correspondence by IDENTITY: - // each operand of the joint target is matched to the component whose own - // derivative-target set contains it. A cofactor whose operands cannot be - // assigned bijectively (a merge dropped one, or the match is ambiguous) sets - // `collapsed`, softening a final l_false to l_undef -- we cannot certify - // emptiness through an edge we could not decompose. - bool collapsed = false; - auto expand = [&](svector const& st, std::vector, expr*>>& out) { - // Per-component derivative targets (order-independent recovery dictionary). - std::vector> comp_succ(n); - for (unsigned i = 0; i < n; ++i) { - expr_ref_pair_vector ci(m); - m_rw.brz_derivative_cofactors(st[i], ci); - for (auto const& [gi, ti] : ci) - if (!re().is_empty(ti)) - comp_succ[i].push_back(ti); - } - // The unique operand of `ops` that is a derivative target of component i, - // or null if none / more than one (ambiguous). - auto derivative_of = [&](unsigned i, ptr_vector const& ops) -> expr* { - expr* hit = nullptr; - for (expr* op : ops) - for (expr* ti : comp_succ[i]) - if (op == ti) { - if (hit && hit != op) return nullptr; // ambiguous - hit = op; - break; - } - return hit; - }; - - expr_ref P(st[0], m); - for (unsigned i = 1; i < n; ++i) - P = re().mk_inter(P, st[i]); - expr_ref_pair_vector cof(m); - m_rw.brz_derivative_cofactors(P, cof); - for (auto const& [g, t] : cof) { - if (re().is_empty(t)) continue; - svector nst; - if (n == 1) - nst.push_back(t); - else { - ptr_vector ops; - flatten_inter(re(), t, ops); - nst.resize(n, nullptr); - bool ok_assign = (ops.size() == n); - for (unsigned i = 0; ok_assign && i < n; ++i) - if (!(nst[i] = derivative_of(i, ops))) - ok_assign = false; - for (unsigned i = 0; ok_assign && i < n; ++i) // require a bijection - for (unsigned j = i + 1; j < n; ++j) - if (nst[i] == nst[j]) ok_assign = false; - if (!ok_assign) { collapsed = true; continue; } - } - for (expr* s : nst) m_pin.push_back(s); - m_pin.push_back(g); - out.push_back({ nst, g }); - } - return true; - }; - lbool r = bounded_search>(m, start, lo, hi, key_of, accept, expand, seq); - return (r == l_false && collapsed) ? l_undef : r; } + unsigned n = states.size(); + bool_vector live; + live.resize(n, false); + for (unsigned i = 0; i < n; ++i) + live[i] = maybe_null[i]; + for (bool ch = true; ch; ) { + ch = false; + for (unsigned i = 0; i < n; ++i) + if (!live[i]) + for (unsigned j : succ[i]) + if (live[j]) { live[i] = true; ch = true; break; } + } + for (unsigned i = 0; i < n; ++i) + if (live[i]) { out.push_back(states.get(i)); m_pin.push_back(states.get(i)); } +} - bool split_manager::test_intersect(vector const& crs) { - // one-sided cheap check: an obviously-empty start (or reach target) state - // certainly makes the intersection empty. Normalize via th_rewriter first so - // that e.g. concat(empty, epsilon) collapses to the empty regex. - expr_ref tmp(m); - for (auto const& cr : crs) { - m_th(cr.first, tmp); - if (re().is_empty(tmp)) - return false; - if (cr.second.get()) { - m_th(cr.second, tmp); - if (re().is_empty(tmp)) - return false; +lbool seq_monadic::product_nonempty(svector const& comps, expr_ref* witness_word) { + unsigned n = comps.size(); + if (n == 0) { + if (witness_word) + *witness_word = expr_ref(u().str.mk_empty(m_seq_sort), m); + return l_true; + } + expr_ref var0(m.mk_var(0, m_elem_sort), m); // the element variable the guards range over + + svector start; + for (auto const& c : comps) + start.push_back(c.state); + + auto id_key = [&](svector const& st) { + std::vector k; + k.reserve(st.size()); + for (expr* e : st) k.push_back(e->get_id()); + return k; + }; + typedef std::vector key; + + bool undecided = false; + auto is_accept = [&](svector const& st) -> bool { + for (unsigned i = 0; i < n; ++i) { + if (comps[i].target) { + if (st[i] != comps[i].target) return false; + } + else { + expr_ref nb = m_rw.is_nullable(st[i]); + if (m.is_true(nb)) continue; + if (m.is_false(nb)) return false; + undecided = true; return false; } } return true; + }; + + std::set visited; + std::vector> work; + // tree of first-discovery edges for witness reconstruction (only built when a + // witness is requested): child-key -> (parent-key, element read on the edge). + std::map> parent; + key start_key = id_key(start); + + auto reconstruct = [&](key end_key) -> expr_ref { + ptr_vector elems; // collected in accept..start order + key k = end_key; + while (k != start_key) { + auto it = parent.find(k); + if (it == parent.end()) break; // safety (should not happen) + elems.push_back(it->second.second); + k = it->second.first; + } + expr_ref_vector es(m); // start..accept order + for (unsigned idx = elems.size(); idx-- > 0; ) + es.push_back(u().str.mk_unit(elems[idx])); + if (es.empty()) + return expr_ref(u().str.mk_empty(m_seq_sort), m); + return expr_ref(u().str.mk_concat(es.size(), es.data(), m_seq_sort), m); + }; + + work.push_back(start); + visited.insert(start_key); + + while (!work.empty()) { + if (m_budget == 0) { m_giveup = true; return l_undef; } + --m_budget; + if (!m.inc()) + return l_undef; + svector st = work.back(); + work.pop_back(); + if (is_accept(st)) { + if (witness_word) + *witness_word = reconstruct(id_key(st)); + return l_true; + } + if (undecided) + return l_undef; + + // per-component cofactor branches (target, guard); pin both, they outlive `cof`. + std::vector>> branches(n); + for (unsigned i = 0; i < n; ++i) { + expr_ref_pair_vector cof(m); + m_rw.brz_derivative_cofactors(st[i], cof); + for (auto const& [g, t] : cof) { + if (re().is_empty(t)) continue; + m_pin.push_back(t); + m_pin.push_back(g); + branches[i].push_back(std::make_pair((expr*) t, (expr*) g)); + } + } + + // joint transitions = cartesian product of the branches with the guards + // conjoined; prune as soon as the accumulated guard is empty, bail on unknown. + svector cur; + cur.resize(n); + key st_key = id_key(st); + bool bail = false; + std::function rec = + [&](unsigned i, guard_set const& acc) { + if (bail) return; + if (i == n) { + key ck = id_key(cur); + if (visited.find(ck) == visited.end()) { + visited.insert(ck); + if (witness_word) { + expr_ref e(m); + if (acc.eval(&e) == l_true) { + m_pin.push_back(e); + parent[ck] = std::make_pair(st_key, e.get()); + } + } + work.push_back(cur); + } + return; + } + for (auto const& pr : branches[i]) { + guard_set nacc = acc; + nacc.conjoin(pr.second); + lbool ne = nacc.eval(nullptr); + if (ne == l_undef) { bail = true; return; } // non-range / unknown guard + if (ne == l_false) continue; // empty joint guard: prune + cur[i] = pr.first; + rec(i + 1, nacc); + if (bail) return; + } + }; + guard_set top(m, u(), m_elem_sort, var0); + rec(0, top); + if (bail) + return l_undef; } - - // ------------------------------------------------------------------ - // seq::split / seq::split_iterator - // ------------------------------------------------------------------ - - split_iterator::split_iterator(split_manager& sm, cont_regex const& cr) { - m_sm = &sm; - m_R = cr.first.get(); - m_N = cr.second.get(); - bool ok = true; - bool membership = (m_N == nullptr) || sm.re().is_epsilon(m_N); - sm.reachable_states(m_R, membership ? nullptr : m_N, m_mids, ok); - if (!ok) { m_failed = true; m_mids.reset(); } - } - - split_pair split_iterator::operator*() const { - ast_manager& m = m_sm->mgr(); - expr* mid = m_mids[m_pos]; - cont_regex left(expr_ref(m_R, m), expr_ref(mid, m)); - cont_regex right(expr_ref(mid, m), m_N ? expr_ref(m_N, m) : expr_ref(m)); - return split_pair(left, right); - } - - split_iterator& split_iterator::operator++() { - if (m_pos < m_mids.size()) ++m_pos; - return *this; - } - - split::split(split_manager& sm, expr* r) - : m_sm(sm), m_R(r, sm.mgr()), m_N(sm.mgr()) {} - - split::split(split_manager& sm, cont_regex const& cr) - : m_sm(sm), m_R(cr.first), m_N(cr.second) {} - - split_iterator split::begin() { - return split_iterator(m_sm, cont_regex(m_R, m_N)); - } + return l_false; +} + +bool seq_monadic::parse_term(expr* t, svector& atoms, expr*& the_var) { + if (u().str.is_concat(t)) { + app* a = to_app(t); + for (unsigned i = 0; i < a->get_num_args(); ++i) + if (!parse_term(a->get_arg(i), atoms, the_var)) + return false; + return true; + } + if (u().str.is_empty(t)) + return true; // epsilon: contributes nothing + zstring s; + if (u().str.is_string(t, s)) { + for (unsigned i = 0; i < s.length(); ++i) + atoms.push_back(atom{ false, nullptr, u().str.mk_char(s, i) }); + return true; + } + if (u().str.is_unit(t)) { // seq.unit of a constant element + expr* elem = to_app(t)->get_arg(0); + if (m.is_value(elem)) { + atoms.push_back(atom{ false, nullptr, elem }); + return true; + } + return false; // symbolic (non-constant) unit: unsupported + } + // uninterpreted 0-ary constant of sequence sort => a sequence variable + if (is_app(t) && to_app(t)->get_num_args() == 0 && + to_app(t)->get_family_id() == null_family_id) { + the_var = t; // mark that at least one variable occurs + atoms.push_back(atom{ true, t, nullptr }); + return true; + } + return false; +} + +void seq_monadic::decompose(svector const& atoms, unsigned i, expr* R, + vector& out, bool& ok) { + if (!ok) + return; + if (m_giveup) { ok = false; return; } + m_pin.push_back(R); + if (i == atoms.size()) { + expr_ref nb = m_rw.is_nullable(R); + if (m.is_true(nb)) + out.push_back(disjunct()); // empty conjunction = true + else if (!m.is_false(nb)) + ok = false; // undecidable nullability => bail + return; + } + atom const& a = atoms[i]; + if (!a.is_var) { + expr_ref d = der_elem(R, a.elem); + decompose(atoms, i + 1, d, out, ok); + return; + } + if (i + 1 == atoms.size()) { // last atom: membership component a.var in R + disjunct D; + D.push_back(component{ a.var, R, nullptr }); + out.push_back(D); + return; + } + // a variable with a non-empty rest: split over the live states q of R (midpoints) + ptr_vector Q; + live_states(R, Q, ok); + if (!ok) + return; + const unsigned DISJUNCT_CAP = 1u << 13; + for (expr* q : Q) { + vector sub; + decompose(atoms, i + 1, q, sub, ok); + if (!ok) + return; + for (disjunct const& sd : sub) { + if (out.size() > DISJUNCT_CAP || m_budget == 0) { m_giveup = true; ok = false; return; } + --m_budget; + disjunct D(sd); + D.push_back(component{ a.var, R, q }); // reach component: a.var drives R -> q + out.push_back(D); + } + } + simplify_dnf(out); +} + +void seq_monadic::simplify_dnf(vector& dnf) { + std::set>> seen; + vector result; + for (disjunct const& D : dnf) { + bool dead = false; + for (auto const& c : D) + if (re().is_empty(c.state)) { dead = true; break; } + if (dead) + continue; + std::vector> sig; + sig.reserve(D.size()); + for (auto const& c : D) + sig.push_back(std::make_tuple(c.var->get_id(), c.state->get_id(), + c.target ? c.target->get_id() : UINT_MAX)); + std::sort(sig.begin(), sig.end()); + if (seen.insert(sig).second) + result.push_back(D); + } + dnf.swap(result); +} + +lbool seq_monadic::solve(expr* term, expr* R) { + obj_map none; + return solve(term, R, none, nullptr); +} + +lbool seq_monadic::solve(expr* term, expr* R, obj_map const& var_extra) { + return solve(term, R, var_extra, nullptr); +} + +bool seq_monadic::build_membership_dnf(expr* term, expr* R, vector& dnf) { + if (!u().is_re(R, m_seq_sort)) + return false; + if (!u().is_seq(m_seq_sort, m_elem_sort)) + return false; + svector atoms; + expr* the_var = nullptr; + if (!parse_term(term, atoms, the_var)) + return false; + if (!the_var) + return false; // no variable: ground membership, not our case + m_pin.push_back(R); + bool ok = true; + decompose(atoms, 0, R, dnf, ok); + return ok; +} + +lbool seq_monadic::decide_dnf(vector const& dnf, obj_map const& var_extra, + obj_map* model) { + bool any_undef = false; + for (disjunct const& D : dnf) { + // group components by variable, add the extra per-variable constraints + obj_map idx; + vector> groups; + ptr_vector group_var; + auto bucket = [&](expr* v) -> unsigned { + unsigned gi; + if (idx.find(v, gi)) return gi; + gi = groups.size(); idx.insert(v, gi); + groups.push_back(svector()); + group_var.push_back(v); + return gi; + }; + for (auto const& c : D) + groups[bucket(c.var)].push_back(c); + for (auto const& kv : var_extra) + groups[bucket(kv.m_key)].push_back(component{ kv.m_key, kv.m_value, nullptr }); + + bool has_empty = false, has_undef = false; + obj_map local; // var -> witness for this disjunct + for (unsigned gi = 0; gi < groups.size(); ++gi) { + expr_ref w(m); + lbool ne = product_nonempty(groups[gi], model ? &w : nullptr); + if (ne == l_false) { has_empty = true; break; } // this variable has no value + if (ne == l_undef) { has_undef = true; continue; } + if (model) { m_pin.push_back(w); local.insert(group_var[gi], w.get()); } + } + if (has_empty) continue; + if (has_undef) { any_undef = true; continue; } + if (model) + for (auto const& kv : local) + model->insert(kv.m_key, kv.m_value); + return l_true; // all variables satisfiable => sat + } + return any_undef ? l_undef : l_false; +} + +lbool seq_monadic::solve(expr* term, expr* R, obj_map const& var_extra, + obj_map* model) { + m_pin.reset(); + m_budget = 200000; // global work budget: bail fast on DNF explosion + m_giveup = false; + vector dnf; + if (!build_membership_dnf(term, R, dnf)) + return l_undef; + return decide_dnf(dnf, var_extra, model); +} + +lbool seq_monadic::solve_and(vector> const& mems, + obj_map const& var_extra, obj_map* model) { + if (mems.empty()) + return l_undef; + m_pin.reset(); + m_budget = 200000; + m_giveup = false; + // Multiply the per-membership DNFs: combined = { d ++ e : d in combined, e in dnf_i }. + // A variable shared by several memberships thus gets several components in the same + // disjunct, which decide_dnf/product_nonempty intersect -- enforcing one consistent + // value across all memberships (the joint solve the harness could not do per-term). + vector combined; + combined.push_back(disjunct()); // { true } + const unsigned DNF_CAP = 1u << 14; + for (auto const& tr : mems) { + vector dnf_i; + if (!build_membership_dnf(tr.first, tr.second, dnf_i)) + return l_undef; + vector next; + for (disjunct const& d : combined) { + for (disjunct const& e : dnf_i) { + if (next.size() > DNF_CAP || m_budget == 0) { m_giveup = true; return l_undef; } + --m_budget; + disjunct D(d); + for (auto const& c : e) + D.push_back(c); + next.push_back(D); + } + } + combined.swap(next); + simplify_dnf(combined); + if (combined.empty()) + return l_false; // no viable disjunct left => unsat + } + return decide_dnf(combined, var_extra, model); } diff --git a/src/ast/rewriter/seq_monadic.h b/src/ast/rewriter/seq_monadic.h index 45dfc5ff0b..2406778623 100644 --- a/src/ast/rewriter/seq_monadic.h +++ b/src/ast/rewriter/seq_monadic.h @@ -7,34 +7,42 @@ Module Name: Abstract: - Continuation-regex split service and intersection non-emptiness for regular - expressions, following the design sketched in - paper/bench/eval/monadic-vs-nielsen-eval.md. + Whole-language monadic decomposition for regex membership of a term that is a + concatenation of sequence variables and constant elements, e.g. x.a.x in R. + Generic in the element sort: characters are one instance, but the procedure works + for any sequence element sort (the guard algebra falls back from the exact character + range_predicate to a candidate-basis over the element values mentioned by the + derivatives). - * A continuation regex (seq::cont_regex) is a pair of regexes. R is - the start state and N is the accept state. A word w is accepted iff - delta_w(R) == N, with one distinguished case: when N is the epsilon regex - (the regex accepting the empty sequence) acceptance is ordinary membership - w in L(R), i.e. delta_w(R) is nullable. This is because the Brzozowski - derivative folds the epsilon tail into nullability (the epsilon state is not - structurally reachable for looping nullable regexes). Every regex R is - embedded as the continuation regex . + Self-contained decision procedure: NO Nielsen splitting (seq_split), NO minterms, + and NO materialization of reach(q) as a regex. It relies only on the symbolic + Brzozowski derivative (brz_derivative_cofactors as a transition regex) and on + automaton product-reachability for emptiness. - * seq::split exposes, for a continuation regex, an (opaque) iterator of - seq::split_pair splits: uv in ==> u in /\ v in , - where R' ranges over the live cofactors of R that can still reach N. + Method. For a term x.u in R and the whole-language split, x drives the derivative + automaton of R from R to some live state q, and the rest u must be accepted from q: - * seq::split_manager owns the live-state / reachability machinery shared across - regexes, and decides emptiness of an intersection of continuation regexes. - It maintains one global derivative-transition graph and recycles the states - (and their computed nullability / cofactor successors) across every regex it - processes, so the same derivative is never recomputed. + x.u in R <=> OR_{q live} ( x reaches q in A_R /\ u in q ). - The module is element-sort agnostic: it does NOT hard-code any character - reasoning. Guard feasibility and successor computation are delegated entirely - to the symbolic derivative engine (seq_rewriter::brz_derivative_cofactors, which - prunes infeasible guards internally and, on an re.inter, yields the product - successor in source order) and to th_rewriter for normalization. + Decomposing u recursively (a leading constant is consumed by a derivative, a leading + variable splits again, the last variable is a plain membership) yields a DNF whose + disjuncts are conjunctions of per-variable *components*: + + - reach component : the variable's value drives the + derivative automaton from state0 to q + - membership component : the variable's value is in L(state0) + + reach(q) is therefore NEVER built as a regex (which state-elimination would blow up + super-polynomially for lattice-shaped automata). Instead the constraints on a + variable are decided directly by a lazy product-reachability search over tuples of + component states: a product state accepts iff every reach component is at its target + and every membership component is nullable; transitions are the product of the + components' cofactor branches with pairwise-conjoined range guards (minterm-free). + This stays in the product-of-state-counts regime, never the path-enumeration (k!) + regime of regex state-elimination. + + Supports single / multiple / repeated variables, and per-variable extra constraints + (base membership + length-regex) via `var_extra`. Author: @@ -50,154 +58,91 @@ Author: #include "util/vector.h" #include -namespace seq { +class seq_monadic { + ast_manager& m; + seq_rewriter& m_rw; + th_rewriter m_thrw; // normalizes constant-element derivatives (folds + // ground guards so dead states become re.empty) + sort* m_seq_sort = nullptr; // sequence sort of the regex under analysis + sort* m_elem_sort = nullptr; // element sort of that sequence sort + expr_ref_vector m_pin; // pins derivative states / witnesses referenced later + unsigned m_budget = 0; // global work budget (decompose disjuncts + product pops) + bool m_giveup = false; // set when the budget is exhausted - // A continuation regex : start state R, accept state N. A word w is - // accepted iff delta_w(R) == N. When N is the epsilon regex (or null), the - // accept condition is ordinary membership (delta_w(R) is nullable). - typedef std::pair cont_regex; + seq_util& u() const { return m_rw.u(); } + seq_util::rex& re() const { return m_rw.u().re; } - // A split of uv in into u in and v in . - typedef std::pair split_pair; + // A term atom: a sequence variable or a constant element (a value of the element sort). + struct atom { bool is_var; expr* var; expr* elem; }; - class split_manager; + // A component of one variable's constraint. As the variable's value w is read, + // the current state is derived from `state`; the component accepts when + // target ? (current == target) -- reach component (w drives A from state to target) + // : nullable(current) -- membership component (w in L(state)) + struct component { expr* var; expr* state; expr* target; }; - // Opaque, lazy iterator over the splits of a continuation regex. The internal - // state (the enumerated midpoints R') is computed on construction. `failed()` - // reports a non-ground regex or a resource limit reached while computing - // derivatives. - class split_iterator { - friend class split; - split_manager* m_sm = nullptr; - expr* m_R = nullptr; // start state of the continuation regex - expr* m_N = nullptr; // accept state (epsilon/null => membership) - ptr_vector m_mids; // enumerated live midpoints R' - unsigned m_pos = 0; // current midpoint index - bool m_failed = false; // non-ground regex / resource limit + typedef svector disjunct; // a conjunction of components (a DNF disjunct) - split_iterator(split_manager& sm, cont_regex const& cr); // begin + // Brzozowski derivative of regex `r` by the concrete element `elem`. + expr_ref der_elem(expr* r, expr* elem); - bool at_end() const { return m_failed || m_pos >= m_mids.size(); } + // Live reachable derivative states of R (BFS over cofactor targets + liveness + // least-fixpoint). These are the split states q. Sets `ok` false on a cap overrun. + void live_states(expr* R, ptr_vector& out, bool& ok); - public: - split_iterator() = default; // end sentinel + // Product-reachability emptiness of a conjunction of components (all on one + // variable). l_false = empty (unsat), l_true = non-empty (sat), l_undef = gave up + // (cap overrun, non-range guard, or undecidable nullability). + // On l_true, if `witness_word` is non-null it is set to a concrete sequence term + // (over the element sort) whose value drives every component to acceptance + // simultaneously -- i.e. a witness value for the variable the components constrain. + lbool product_nonempty(svector const& comps, expr_ref* witness_word = nullptr); - split_pair operator*() const; - split_iterator& operator++(); - bool operator==(split_iterator const& other) const { return at_end() && other.at_end(); } - bool operator!=(split_iterator const& other) const { return !(*this == other); } - bool failed() const { return m_failed; } - }; + // Flatten a str.++ term into atoms; false on an unsupported shape (non-constant unit). + bool parse_term(expr* term, svector& atoms, expr*& the_var); - // A continuation regex together with the manager that can split it. - class split { - split_manager& m_sm; - expr_ref m_R; - expr_ref m_N; - public: - split(split_manager& sm, expr* r); - split(split_manager& sm, cont_regex const& cr); - split_iterator begin(); - split_iterator end() { return split_iterator(); } - }; + // Monadic decomposition: append to `out` the DNF disjuncts for atoms[i..] in R, + // threading the current derivative state R. `ok` false on give-up. + void decompose(svector const& atoms, unsigned i, expr* R, + vector& out, bool& ok); - // Manages live states / abstract reachability across the regexes it processes, - // and decides emptiness of intersections of continuation regexes. One global - // derivative-transition graph is grown lazily and shared across every regex, so - // states, their nullability and their cofactor successors are computed once. - class split_manager { - friend class split; - friend class split_iterator; + // Drop disjuncts with a syntactically-empty component and dedup identical disjuncts. + void simplify_dnf(vector& dnf); - // A cofactor transition of the global graph: on a guard (a predicate over the - // element variable (:var 0)) the derivative moves to the target state. - struct gedge { expr* guard; unsigned target; }; + // Build the DNF over primitive per-variable components for one membership term in R. + // Sets m_seq_sort/m_elem_sort; false on an unsupported shape or give-up. + bool build_membership_dnf(expr* term, expr* R, vector& dnf); - ast_manager& m; - seq_rewriter& m_rw; - th_rewriter m_th; // regex normalization (element-sort agnostic) - expr_ref_vector m_pin; // keeps interned states / guards alive + // Decide a DNF (over primitive components): sat iff some disjunct has every variable + // group non-empty. On l_true, fills `model` (var -> witness) if non-null. + lbool decide_dnf(vector const& dnf, obj_map const& var_extra, + obj_map* model); - // Global reachability graph, reused across every processed regex. - obj_map m_state_id; // regex state -> global id - ptr_vector m_gstate; // global id -> state - bool_vector m_gmaybe_null; // per state: !is_false(is_nullable) - bool_vector m_gexpanded; // per state: cofactor successors computed - vector> m_gsucc; // per state: (guard, target) edges +public: + seq_monadic(seq_rewriter& rw) : m(rw.m()), m_rw(rw), m_thrw(rw.m()), m_pin(rw.m()) {} - seq_util& u() const { return m_rw.u(); } - seq_util::rex& re() const { return m_rw.u().re; } + // Decide (str.in_re term R) for a term that is a concatenation of string variables + // (possibly repeated / several distinct) and constant characters. + // l_true = sat, l_false = unsat, l_undef = unsupported shape / gave up. + lbool solve(expr* term, expr* R); - // Tri-state nullability of a state: l_true / l_false when the derivative - // engine decides it, l_undef when it cannot. - lbool nullable(expr* s); + // As above, with extra per-variable constraints (e.g. a base membership intersected + // with a length-regex): `var_extra` maps a variable to a regex it must also satisfy. + lbool solve(expr* term, expr* R, obj_map const& var_extra); - // Intern a state into the global graph (recycles an existing global state), - // computing its nullability lazily. Returns its global id. - unsigned intern_state(expr* s); + // As above; on l_true, if `model` is non-null it is populated with var -> witness, + // where each witness is a concrete sequence term (over the element sort) giving one + // satisfying assignment. Witness terms are pinned by the solver and remain valid + // until the next call to solve(). + lbool solve(expr* term, expr* R, obj_map const& var_extra, + obj_map* model); - // Compute (once) the cofactor successors of the global state `i`, recycling - // any target states already present in the graph. Sets `ok` false on a - // resource limit. - void expand_state(unsigned i, bool& ok); - - // Reachable derivative states of R with their transition graph and per-state - // (possible) nullability, projected out of the global graph. Sets `ok` false - // on cap overrun / resource limit. - void build_graph(expr* R, ptr_vector& states, - vector>& succ, bool_vector& maybe_null, bool& ok); - - // Derivative states reachable from R that can still reach an accepting - // state. `accept_target` == null selects membership acceptance (the seed - // is the nullable states); otherwise it is reach acceptance (the seed is - // the state structurally equal to `accept_target`, i.e. N). - void reachable_states(expr* R, expr* accept_target, ptr_vector& out, bool& ok); - - // Non-emptiness of an all-membership intersection: BFS over the normalized - // product state inter(R_0,...,R_{n-1}) with an is_nullable acceptance test. - lbool intersect_membership(vector const& crs, unsigned lo, unsigned hi, - expr_ref_vector& seq); - - // Product-reachability of a tuple of continuation regexes (handles general N, - // i.e. reach targets N != epsilon), decomposing the engine's product successor. - lbool intersect_product(vector const& crs, unsigned lo, unsigned hi, - expr_ref_vector& seq); - - public: - split_manager(seq_rewriter& rw) - : m(rw.m()), m_rw(rw), m_th(rw.m()), m_pin(rw.m()) {} - - ast_manager& mgr() const { return m; } - seq_rewriter& rw() const { return m_rw; } - - void pin(expr* e) { m_pin.push_back(e); } - - // Embed a regex R as the continuation regex . The - // epsilon accept-state marks the membership (nullable) case uniformly. - cont_regex embed(expr* r) { - sort* ss = nullptr; - VERIFY(u().is_re(r, ss)); - expr_ref eps(re().mk_epsilon(ss), m); - expr_ref start(re().mk_concat(r, eps), m); - return cont_regex(start, eps); - } - - split mk_split(expr* r) { return split(*this, r); } - split mk_split(cont_regex const& cr) { return split(*this, cr); } - - // Emptiness of the intersection of the continuation regexes `crs`, restricted - // to words of at least `lo` and at most `hi` elements (hi == UINT_MAX for no - // upper bound). A component accepts a word w iff delta_w(R_i) == N_i, - // where an epsilon (or null) N_i means the nullable/membership case. Feasibility - // is decided by the derivative engine (element-sort agnostic). On l_true a - // witness is returned in `seq`: one guard predicate over (:var 0) per position. - // l_false = empty, l_true = non-empty, l_undef = gave up - // (cap overrun, undecidable nullability, or a product target that could not - // be decomposed). - lbool intersect(vector const& crs, unsigned lo, unsigned hi, expr_ref_vector& seq); - - // Cheap, sound one-sided partial check: false only when the intersection is - // certainly empty; true otherwise (may be a false positive). - bool test_intersect(vector const& crs); - }; -} + // Decide a CONJUNCTION of memberships AND_i (term_i in R_i) jointly: a variable + // shared across memberships is constrained consistently (the DNFs are multiplied and + // each variable's constraints intersected). This is the natural extension of single- + // membership solving to a Boolean combination of memberships (a disjunction is the + // union of DNFs; a negated membership ~(t in R) is just t in complement(R)). + // var_extra / model as above. l_true = sat, l_false = unsat, l_undef = gave up. + lbool solve_and(vector> const& mems, + obj_map const& var_extra, obj_map* model = nullptr); +}; diff --git a/src/ast/rewriter/seq_range_collapse.cpp b/src/ast/rewriter/seq_range_collapse.cpp index 7f072a6458..e7249ae6a8 100644 --- a/src/ast/rewriter/seq_range_collapse.cpp +++ b/src/ast/rewriter/seq_range_collapse.cpp @@ -21,66 +21,66 @@ Authors: namespace seq { - // Cofactor path condition `pred` (a Boolean over x = (:var 0)) -> the canonical - // range_predicate (union of ranges) of the characters satisfying it. Returns - // false on a construct outside {true,false,and,or,not,=,char.<=} over x. - static bool pred_to_rp(ast_manager &m, seq_util &sq, expr *x, expr *pred, - range_predicate &out) { - unsigned maxc = sq.max_char(); - expr *a = nullptr, *b = nullptr; + // Cofactor guard `guard` (a Boolean over the character variable v0 = (:var 0)) -> + // the canonical range_predicate (union of ranges) of the characters satisfying it. + // Returns false on a construct outside {true,false,and,or,not,=,char.<=} over v0. + bool guard_to_range_predicate(seq_util& u, expr* v0, expr* guard, range_predicate& out) { + ast_manager& m = u.get_manager(); + unsigned maxc = u.max_char(); + expr* a = nullptr, * b = nullptr; unsigned c = 0; - if (m.is_true(pred)) { + if (m.is_true(guard)) { out = range_predicate::top(maxc); return true; } - if (m.is_false(pred)) { + if (m.is_false(guard)) { out = range_predicate::empty(maxc); return true; } - if (m.is_eq(pred, a, b)) { - if (a == x && sq.is_const_char(b, c)) { + if (m.is_eq(guard, a, b)) { + if (a == v0 && u.is_const_char(b, c)) { out = range_predicate::singleton(c, maxc); return true; } - if (b == x && sq.is_const_char(a, c)) { + if (b == v0 && u.is_const_char(a, c)) { out = range_predicate::singleton(c, maxc); return true; } return false; } - if (sq.is_char_le(pred, a, b)) { - if (b == x && sq.is_const_char(a, c)) { + if (u.is_char_le(guard, a, b)) { + if (b == v0 && u.is_const_char(a, c)) { out = range_predicate::range(c, maxc, maxc); return true; } - if (a == x && sq.is_const_char(b, c)) { + if (a == v0 && u.is_const_char(b, c)) { out = range_predicate::range(0, c, maxc); return true; } return false; } - if (m.is_not(pred, a)) { + if (m.is_not(guard, a)) { range_predicate s(maxc); - if (!pred_to_rp(m, sq, x, a, s)) + if (!guard_to_range_predicate(u, v0, a, s)) return false; out = ~s; return true; } - if (m.is_and(pred)) { + if (m.is_and(guard)) { out = range_predicate::top(maxc); - for (expr *arg : *to_app(pred)) { + for (expr *arg : *to_app(guard)) { range_predicate s(maxc); - if (!pred_to_rp(m, sq, x, arg, s)) + if (!guard_to_range_predicate(u, v0, arg, s)) return false; out = out & s; } return true; } - if (m.is_or(pred)) { + if (m.is_or(guard)) { out = range_predicate::empty(maxc); - for (expr *arg : *to_app(pred)) { + for (expr *arg : *to_app(guard)) { range_predicate s(maxc); - if (!pred_to_rp(m, sq, x, arg, s)) + if (!guard_to_range_predicate(u, v0, arg, s)) return false; out = out | s; } @@ -183,7 +183,7 @@ namespace seq { auto body = q->get_expr(); sort *char_sort = q->get_decl_sort(0); expr_ref var(m.mk_var(0, char_sort), m); - if (u.get_char_plugin().get_family_id() == char_sort->get_family_id() && pred_to_rp(m, u, var, body, out)) + if (u.get_char_plugin().get_family_id() == char_sort->get_family_id() && guard_to_range_predicate(u, var, body, out)) return true; } @@ -225,15 +225,33 @@ namespace seq { // fragment recognized by pred_to_rp, so regex_to_range_predicate // round-trips it back to the same range_predicate. expr_ref_vector ranges(m); + + for (unsigned i = 0; i < n; ++i) { + auto [lo, hi] = p[i]; + ranges.push_back(mk_single_range_regex(u, lo, hi, re_sort)); + } + std::sort(ranges.data(), ranges.data() + ranges.size(), + [](expr *a, expr *b) { return a->get_id() < b->get_id(); }); + expr_ref acc(ranges.get(n - 1), m); + for (unsigned i = n - 1; i-- > 0;) + acc = expr_ref(u.re.mk_union(ranges.get(i), acc), m); + return acc; + #if 0 expr_ref bound(m.mk_var(0, char_sort), m); symbol char_sym("ch"); auto &ch = u.get_char_plugin(); for (unsigned i = 0; i < n; ++i) { auto [lo, hi] = p[i]; - ranges.push_back(m.mk_and(ch.mk_le(ch.mk_char(lo), bound), ch.mk_le(bound, ch.mk_char(hi)))); + { + auto _seq251_0 = ch.mk_le(ch.mk_char(lo), bound); + auto _seq251_1 = ch.mk_le(bound, ch.mk_char(hi)); + ranges.push_back(m.mk_and(_seq251_0, _seq251_1)); + } } expr_ref body(m.mk_or(ranges), m); - return expr_ref(u.re.mk_of_pred(m.mk_lambda(1, &char_sort, &char_sym, body)), m); + auto lam = m.mk_lambda(1, &char_sort, &char_sym, body); + return expr_ref(u.re.mk_of_pred(lam), m); + #endif } expr_ref unfold_fold(seq_rewriter &rw, expr *r) { diff --git a/src/ast/rewriter/seq_range_collapse.h b/src/ast/rewriter/seq_range_collapse.h index f6effc8ee4..6255ac2294 100644 --- a/src/ast/rewriter/seq_range_collapse.h +++ b/src/ast/rewriter/seq_range_collapse.h @@ -31,6 +31,14 @@ Authors: namespace seq { + /** + * Convert a Boolean guard over the single character variable v0 = (:var 0) -- a + * derivative cofactor path condition -- into the range_predicate of the characters + * satisfying it. Recognizes {true, false, =, char.<=, and, or, not} over v0 and + * concrete characters; returns false (out untouched) on anything else. + */ + bool guard_to_range_predicate(seq_util& u, expr* v0, expr* guard, range_predicate& out); + /** * If r is a boolean combination of character-class regex primitives * over the unsigned character domain [0, max_char], compute the diff --git a/src/ast/rewriter/seq_rewriter.cpp b/src/ast/rewriter/seq_rewriter.cpp index 5d60203192..2a7fc64a49 100644 --- a/src/ast/rewriter/seq_rewriter.cpp +++ b/src/ast/rewriter/seq_rewriter.cpp @@ -103,6 +103,7 @@ br_status seq_rewriter::mk_bool_app(func_decl* f, unsigned n, expr* const* args, case OP_EQ: SASSERT(n == 2); // return mk_eq_helper(args[0], args[1], result); + Z3_fallthrough; default: return BR_FAILED; } @@ -936,7 +937,11 @@ br_status seq_rewriter::mk_seq_extract(expr* a, expr* b, expr* c, expr_ref& resu expr* a1 = nullptr, *b1 = nullptr, *c1 = nullptr; if (str().is_extract(a, a1, b1, c1) && is_suffix(a1, b1, c1) && is_suffix(a, b, c)) { - result = str().mk_substr(a1, m_autil.mk_add(b1, b), m_autil.mk_sub(c1, b)); + { + auto _seq939_0 = m_autil.mk_add(b1, b); + auto _seq939_1 = m_autil.mk_sub(c1, b); + result = str().mk_substr(a1, _seq939_0, _seq939_1); + } return BR_REWRITE3; } rational r1, r2; @@ -957,7 +962,11 @@ br_status seq_rewriter::mk_seq_extract(expr* a, expr* b, expr* c, expr_ref& resu if (r1 >= 0 && pos <= r2) { r2 = std::min(r2 - pos, len); r1 += pos; - result = str().mk_substr(a1, m_autil.mk_numeral(r1, true), m_autil.mk_numeral(r2, true)); + { + auto _seq960_0 = m_autil.mk_numeral(r1, true); + auto _seq960_1 = m_autil.mk_numeral(r2, true); + result = str().mk_substr(a1, _seq960_0, _seq960_1); + } return BR_REWRITE1; } } @@ -990,7 +999,11 @@ br_status seq_rewriter::mk_seq_extract(expr* a, expr* b, expr* c, expr_ref& resu // extract(extract(a, 3, 6), 1, len(extract(a, 3, 6)) - 1) -> extract(a, 4, 5) if (str().is_extract(a, a1, b1, c1) && is_suffix(a, b, c) && m_autil.is_numeral(c1) && m_autil.is_numeral(b1)) { - result = str().mk_substr(a1, m_autil.mk_add(b, b1), m_autil.mk_sub(c1, b)); + { + auto _seq993_0 = m_autil.mk_add(b, b1); + auto _seq993_1 = m_autil.mk_sub(c1, b); + result = str().mk_substr(a1, _seq993_0, _seq993_1); + } return BR_REWRITE2; } @@ -1008,9 +1021,9 @@ br_status seq_rewriter::mk_seq_extract(expr* a, expr* b, expr* c, expr_ref& resu if (pos == 0 && as.forall(is_unit)) { result = str().mk_empty(a->get_sort()); for (unsigned i = 1; i <= as.size(); ++i) { - result = m().mk_ite(m_autil.mk_ge(c, m_autil.mk_int(i)), - str().mk_concat(i, as.data(), a->get_sort()), - result); + auto _seq1011_0 = m_autil.mk_ge(c, m_autil.mk_int(i)); + auto _seq1011_1 = str().mk_concat(i, as.data(), a->get_sort()); + result = m().mk_ite(_seq1011_0, _seq1011_1, result); } return BR_REWRITE_FULL; } @@ -1350,7 +1363,9 @@ br_status seq_rewriter::mk_seq_nth(expr* a, expr* b, expr_ref& result) { expr_ref case2(str().mk_nth_u(str().mk_empty(s->get_sort()), b), m()); expr_ref case3(str().mk_nth_u(a, b), m()); result = case3; - result = m().mk_ite(m_autil.mk_lt(m_autil.mk_add(k, b), str().mk_length(s)), case1, result); + auto _seq0 = m_autil.mk_add(k, b); + auto _seq1 = str().mk_length(s); + result = m().mk_ite(m_autil.mk_lt(_seq0, _seq1), case1, result); result = m().mk_ite(m_autil.mk_ge(k, str().mk_length(s)), case2, result); result = m().mk_ite(m_autil.mk_lt(b, zero()), case3, result); return BR_REWRITE_FULL; @@ -1489,9 +1504,12 @@ br_status seq_rewriter::mk_seq_last_index(expr* a, expr* b, expr_ref& result) { switch (is_suffix(as, bs)) { case l_undef: return BR_FAILED; - case l_true: - result = m_autil.mk_sub(str().mk_length(a), m_autil.mk_int(bs.size() - i)); + case l_true: { + auto _seq0 = str().mk_length(a); + auto _seq1 = m_autil.mk_int(bs.size() - i); + result = m_autil.mk_sub(_seq0, _seq1); return BR_REWRITE3; + } case l_false: as.pop_back(); --i; @@ -1596,7 +1614,11 @@ br_status seq_rewriter::mk_seq_index(expr* a, expr* b, expr* c, expr_ref& result expr_ref a1(m()); a1 = str().mk_concat(as.size() - i, as.data() + i, sort_a); result = str().mk_index(a1, b, m_autil.mk_int(r)); - result = m().mk_ite(m_autil.mk_ge(result, zero()), m_autil.mk_add(m_autil.mk_int(i), result), minus_one()); + { + auto _seq1599_0 = m_autil.mk_ge(result, zero()); + auto _seq1599_1 = m_autil.mk_add(m_autil.mk_int(i), result); + result = m().mk_ite(_seq1599_0, _seq1599_1, minus_one()); + } return BR_REWRITE_FULL; } } @@ -1613,7 +1635,11 @@ br_status seq_rewriter::mk_seq_index(expr* a, expr* b, expr* c, expr_ref& result if (i > 0) { result = str().mk_index( str().mk_concat(as.size() - i, as.data() + i, sort_a), b, c); - result = m().mk_ite(m_autil.mk_ge(result, zero()), m_autil.mk_add(m_autil.mk_int(i), result), minus_one()); + { + auto _seq1616_0 = m_autil.mk_ge(result, zero()); + auto _seq1616_1 = m_autil.mk_add(m_autil.mk_int(i), result); + result = m().mk_ite(_seq1616_0, _seq1616_1, minus_one()); + } return BR_REWRITE_FULL; } @@ -1624,11 +1650,12 @@ br_status seq_rewriter::mk_seq_index(expr* a, expr* b, expr* c, expr_ref& result return BR_DONE; } break; - case same_length_c: - result = m().mk_ite(m_autil.mk_le(c, minus_one()), minus_one(), - m().mk_ite(m().mk_eq(c, zero()), - m().mk_ite(m().mk_eq(a, b), zero(), minus_one()), - minus_one())); + case same_length_c: { + auto _seqa = m_autil.mk_le(c, minus_one()); + auto _seqb = m().mk_eq(c, zero()); + auto _seqc = m().mk_ite(m().mk_eq(a, b), zero(), minus_one()); + result = m().mk_ite(_seqa, minus_one(), m().mk_ite(_seqb, _seqc, minus_one())); + } return BR_REWRITE_FULL; default: break; @@ -1636,8 +1663,13 @@ br_status seq_rewriter::mk_seq_index(expr* a, expr* b, expr* c, expr_ref& result if (is_zero && !as.empty() && str().is_unit(as.get(0))) { expr_ref a1(str().mk_concat(as.size() - 1, as.data() + 1, as[0]->get_sort()), m()); expr_ref b1(str().mk_index(a1, b, c), m()); - result = m().mk_ite(str().mk_prefix(b, a), zero(), - m().mk_ite(m_autil.mk_ge(b1, zero()), m_autil.mk_add(one(), b1), minus_one())); + { + auto _seq1639_0 = str().mk_prefix(b, a); + auto _seq1663_0 = m_autil.mk_ge(b1, zero()); + auto _seq1663_1 = m_autil.mk_add(one(), b1); + auto _seq1639_1 = m().mk_ite(_seq1663_0, _seq1663_1, minus_one()); + result = m().mk_ite(_seq1639_0, zero(), _seq1639_1); + } return BR_REWRITE3; } expr_ref ra(a, m()); @@ -1780,7 +1812,11 @@ br_status seq_rewriter::mk_seq_replace(expr* a, expr* b, expr* c, expr_ref& resu if (cmp == l_true && m_lhs.size() < i + m_rhs.size()) { expr_ref a1(str().mk_concat(i, m_lhs.data(), sort_a), m()); expr_ref a2(str().mk_concat(m_lhs.size()-i, m_lhs.data()+i, sort_a), m()); - result = m().mk_ite(m().mk_eq(a2, b), str().mk_concat(a1, c), a); + { + auto _seq1783_0 = m().mk_eq(a2, b); + auto _seq1783_1 = str().mk_concat(a1, c); + result = m().mk_ite(_seq1783_0, _seq1783_1, a); + } return BR_REWRITE_FULL; } if (cmp == l_true) { @@ -1811,7 +1847,11 @@ br_status seq_rewriter::mk_seq_replace_all(expr* a, expr* b, expr* c, expr_ref& return BR_DONE; } if (a == b) { - result = m().mk_ite(str().mk_is_empty(b), str().mk_empty(a->get_sort()), c); + { + auto _seq1814_0 = str().mk_is_empty(b); + auto _seq1814_1 = str().mk_empty(a->get_sort()); + result = m().mk_ite(_seq1814_0, _seq1814_1, c); + } return BR_REWRITE2; } if (str().is_empty(a) && str().is_empty(c)) { @@ -1908,10 +1948,16 @@ expr_ref seq_rewriter::re_replace_char(expr *r, unsigned a_ch, unsigned b_ch, ex if (ch == a_ch || ch == b_ch) { if (prev < ch) { zstring prev_z(prev), pred_z(ch - 1); - parts.push_back(re().mk_range(str().mk_string(prev_z), str().mk_string(pred_z))); + { + auto _seq1911_0 = str().mk_string(prev_z); + auto _seq1911_1 = str().mk_string(pred_z); + parts.push_back(re().mk_range(_seq1911_0, _seq1911_1)); + } } if (ch == b_ch) { - parts.push_back(re().mk_union(re().mk_to_re(a_str), re().mk_to_re(b_str))); + auto _seq1914_0 = re().mk_to_re(a_str); + auto _seq1914_1 = re().mk_to_re(b_str); + parts.push_back(re().mk_union(_seq1914_0, _seq1914_1)); } // a_ch is simply excluded (not added) prev = ch + 1; @@ -1919,7 +1965,11 @@ expr_ref seq_rewriter::re_replace_char(expr *r, unsigned a_ch, unsigned b_ch, ex } if (prev <= hi) { zstring prev_z(prev), hi_z(hi); - parts.push_back(re().mk_range(str().mk_string(prev_z), str().mk_string(hi_z))); + { + auto _seq1922_0 = str().mk_string(prev_z); + auto _seq1922_1 = str().mk_string(hi_z); + parts.push_back(re().mk_range(_seq1922_0, _seq1922_1)); + } } } if (parts.empty()) { @@ -2153,8 +2203,11 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { SASSERT(as.size() > 1); s2 = s2.extract(s1.length(), s2.length()-s1.length()); bs[0] = str().mk_string(s2); - result = str().mk_prefix(str().mk_concat(as.size()-1, as.data()+1, sort_a), - str().mk_concat(bs.size(), bs.data(), sort_a)); + { + auto _seq2156_0 = str().mk_concat(as.size() - 1, as.data() + 1, sort_a); + auto _seq2156_1 = str().mk_concat(bs.size(), bs.data(), sort_a); + result = str().mk_prefix(_seq2156_0, _seq2156_1); + } TRACE(seq, tout << s1 << " " << s2 << " " << result << "\n";); return BR_REWRITE_FULL; } @@ -2446,13 +2499,14 @@ br_status seq_rewriter::mk_str_sbv2s(expr *a, expr_ref &result) { } bv_size = bv.get_bv_size(a); - result = m().mk_ite( - bv.mk_slt(a,bv.mk_numeral(0, bv_size)), - str().mk_concat( - str().mk_string(zstring("-")), - str().mk_ubv2s(bv.mk_bv_neg(a)) - ), - str().mk_ubv2s(a)); + { + auto _seq2449_0 = bv.mk_slt(a, bv.mk_numeral(0, bv_size)); + auto _seq2499_0 = str().mk_string(zstring("-")); + auto _seq2499_1 = str().mk_ubv2s(bv.mk_bv_neg(a)); + auto _seq2449_1 = str().mk_concat(_seq2499_0, _seq2499_1); + auto _seq2449_2 = str().mk_ubv2s(a); + result = m().mk_ite(_seq2449_0, _seq2449_1, _seq2449_2); + } return BR_REWRITE_FULL; } @@ -2556,10 +2610,12 @@ br_status seq_rewriter::mk_str_stoi(expr* a, expr_ref& result) { expr_ref tail(str().mk_stoi(as.back()), m()); expr_ref head(str().mk_concat(as.size() - 1, as.data(), a->get_sort()), m()); expr_ref stoi_head(str().mk_stoi(head), m()); - result = m().mk_ite(m_autil.mk_ge(stoi_head, zero()), - m_autil.mk_add(m_autil.mk_mul(m_autil.mk_int(10), stoi_head), tail), - minus_one()); - + { + auto _seq2559_0 = m_autil.mk_ge(stoi_head, zero()); + auto _seq2559_1 = m_autil.mk_add(m_autil.mk_mul(m_autil.mk_int(10), stoi_head), tail); + result = m().mk_ite(_seq2559_0, _seq2559_1, minus_one()); + } + result = m().mk_ite(m_autil.mk_ge(tail, zero()), result, tail); @@ -2570,9 +2626,11 @@ br_status seq_rewriter::mk_str_stoi(expr* a, expr_ref& result) { } if (str().is_unit(as.get(0), u) && m_util.is_const_char(u, ch) && '0' == ch) { result = str().mk_concat(as.size() - 1, as.data() + 1, as[0]->get_sort()); - result = m().mk_ite(str().mk_is_empty(result), - zero(), - str().mk_stoi(result)); + { + auto _seq2573_0 = str().mk_is_empty(result); + auto _seq2573_1 = str().mk_stoi(result); + result = m().mk_ite(_seq2573_0, zero(), _seq2573_1); + } return BR_REWRITE_FULL; } @@ -2781,7 +2839,11 @@ br_status seq_rewriter::mk_re_reverse(expr* r, expr_ref& result) { return BR_REWRITE2; } else if (m().is_ite(r, p, r1, r2)) { - result = m().mk_ite(p, re().mk_reverse(r1), re().mk_reverse(r2)); + { + auto _seq2784_0 = re().mk_reverse(r1); + auto _seq2784_1 = re().mk_reverse(r2); + result = m().mk_ite(p, _seq2784_0, _seq2784_1); + } return BR_REWRITE2; } else if (re().is_opt(r, r1)) { @@ -3233,8 +3295,11 @@ bool seq_rewriter::rewrite_contains_pattern(expr* a, expr* b, expr_ref& result) suffix = re().mk_concat(suffix, re().mk_to_re(e)); suffix = re().mk_concat(suffix, full); } - fmls.push_back(m().mk_and(re().mk_in_re(x, prefix), - re().mk_in_re(y, suffix))); + { + auto _seq3217_0 = re().mk_in_re(x, prefix); + auto _seq3217_1 = re().mk_in_re(y, suffix); + fmls.push_back(m().mk_and(_seq3217_0, _seq3217_1)); + } } result = mk_or(fmls); return true; @@ -3439,7 +3504,9 @@ br_status seq_rewriter::mk_str_in_regexp(expr* a, expr* b, expr_ref& result) { #if 0 unsigned len = 0; if (has_fixed_length_constraint(b, len)) { - expr_ref len_lim(m().mk_eq(m_autil.mk_int(len), str().mk_length(a)), m()); + auto _seq0 = m_autil.mk_int(len); + auto _seq1 = str().mk_length(a); + expr_ref len_lim(m().mk_eq(_seq0, _seq1), m()); // this forces derivatives. Perhaps not a good thing for intersections. // alternative is to hoist out the smallest length constraining regex // and keep the result for the sequence expression that is kept without rewriting @@ -3570,7 +3637,11 @@ br_status seq_rewriter::mk_re_concat(expr* a, expr* b, expr_ref& result) { expr* u1 = nullptr, *u2 = nullptr; if (re().is_full_seq(a) && re().is_union(b, u1, u2) && (starts_with_full_seq(u1) || starts_with_full_seq(u2))) { - result = mk_regex_union_normalize(mk_regex_concat(a, u1), mk_regex_concat(a, u2)); + { + auto _seq3554_0 = mk_regex_concat(a, u1); + auto _seq3554_1 = mk_regex_concat(a, u2); + result = mk_regex_union_normalize(_seq3554_0, _seq3554_1); + } return BR_REWRITE2; } if (re().is_intersection(a, u1, u2) && re().is_full_seq(b) && @@ -3664,11 +3735,19 @@ br_status seq_rewriter::mk_re_concat(expr* a, expr* b, expr_ref& result) { // Hoist ite out of concat: concat(ite(c, r1, r2), b) → ite(c, concat(r1, b), concat(r2, b)) expr* c = nullptr; if (m().is_ite(a, c, a1, b1)) { - result = m().mk_ite(c, re().mk_concat(a1, b), re().mk_concat(b1, b)); + { + auto _seq3648_0 = re().mk_concat(a1, b); + auto _seq3648_1 = re().mk_concat(b1, b); + result = m().mk_ite(c, _seq3648_0, _seq3648_1); + } return BR_REWRITE3; } if (m().is_ite(b, c, a1, b1)) { - result = m().mk_ite(c, re().mk_concat(a, a1), re().mk_concat(a, b1)); + { + auto _seq3652_0 = re().mk_concat(a, a1); + auto _seq3652_1 = re().mk_concat(a, b1); + result = m().mk_ite(c, _seq3652_0, _seq3652_1); + } return BR_REWRITE3; } if (re().is_concat(a, a1, a2)) { @@ -3802,11 +3881,19 @@ br_status seq_rewriter::mk_re_union0(expr* a, expr* b, expr_ref& result) { // Hoist ite out of union: union(ite(c, r1, r2), b) → ite(c, union(r1, b), union(r2, b)) expr *c = nullptr, *r1 = nullptr, *r2 = nullptr; if (m().is_ite(a, c, r1, r2)) { - result = m().mk_ite(c, re().mk_union(r1, b), re().mk_union(r2, b)); + { + auto _seq3786_0 = re().mk_union(r1, b); + auto _seq3786_1 = re().mk_union(r2, b); + result = m().mk_ite(c, _seq3786_0, _seq3786_1); + } return BR_REWRITE3; } if (m().is_ite(b, c, r1, r2)) { - result = m().mk_ite(c, re().mk_union(a, r1), re().mk_union(a, r2)); + { + auto _seq3790_0 = re().mk_union(a, r1); + auto _seq3790_1 = re().mk_union(a, r2); + result = m().mk_ite(c, _seq3790_0, _seq3790_1); + } return BR_REWRITE3; } if (try_collapse_re_union(a, b, result)) @@ -3858,7 +3945,11 @@ br_status seq_rewriter::mk_re_complement(expr* a, expr_ref& result) { // Hoist ite out of complement: ~(ite(c, r1, r2)) → ite(c, ~r1, ~r2) expr* c = nullptr; if (m().is_ite(a, c, e1, e2)) { - result = m().mk_ite(c, re().mk_complement(e1), re().mk_complement(e2)); + { + auto _seq3842_0 = re().mk_complement(e1); + auto _seq3842_1 = re().mk_complement(e2); + result = m().mk_ite(c, _seq3842_0, _seq3842_1); + } return BR_REWRITE3; } return BR_FAILED; @@ -3894,11 +3985,19 @@ br_status seq_rewriter::mk_re_inter0(expr* a, expr* b, expr_ref& result) { // Hoist ite out of intersection: inter(ite(c, r1, r2), b) → ite(c, inter(r1, b), inter(r2, b)) expr *c = nullptr, *r1 = nullptr, *r2 = nullptr; if (m().is_ite(a, c, r1, r2)) { - result = m().mk_ite(c, re().mk_inter(r1, b), re().mk_inter(r2, b)); + { + auto _seq3878_0 = re().mk_inter(r1, b); + auto _seq3878_1 = re().mk_inter(r2, b); + result = m().mk_ite(c, _seq3878_0, _seq3878_1); + } return BR_REWRITE3; } if (m().is_ite(b, c, r1, r2)) { - result = m().mk_ite(c, re().mk_inter(a, r1), re().mk_inter(a, r2)); + { + auto _seq3882_0 = re().mk_inter(a, r1); + auto _seq3882_1 = re().mk_inter(a, r2); + result = m().mk_ite(c, _seq3882_0, _seq3882_1); + } return BR_REWRITE3; } if (try_collapse_re_inter(a, b, result)) @@ -4152,8 +4251,11 @@ br_status seq_rewriter::mk_re_star(expr* a, expr_ref& result) { result = re().mk_full_seq(b1->get_sort()); return BR_REWRITE2; } - // Hoist ite out of star: (ite c r1 r2)* → ite(c, r1*, r2*) - result = m().mk_ite(c, re().mk_star(b1), re().mk_star(c1)); + { + auto _seq4137_0 = re().mk_star(b1); + auto _seq4137_1 = re().mk_star(c1); + result = m().mk_ite(c, _seq4137_0, _seq4137_1); + } return BR_REWRITE3; } return BR_FAILED; @@ -4856,8 +4958,11 @@ bool seq_rewriter::reduce_contains(expr* a, expr* b, expr_ref_vector& disj) { if (str().is_string(b, s)) { expr* all = re().mk_full_seq(re().mk_re(b->get_sort())); - disj.push_back(re().mk_in_re(str().mk_concat(m_lhs.size() - i, m_lhs.data() + i, sort_a), - re().mk_concat(all, re().mk_concat(re().mk_to_re(b), all)))); + { + auto _seq4840_0 = str().mk_concat(m_lhs.size() - i, m_lhs.data() + i, sort_a); + auto _seq4840_1 = re().mk_concat(all, re().mk_concat(re().mk_to_re(b), all)); + disj.push_back(re().mk_in_re(_seq4840_0, _seq4840_1)); + } return true; } @@ -5153,8 +5258,12 @@ bool seq_rewriter::reduce_eq_empty(expr* l, expr* r, expr_ref& result) { } // at(s, offset) = "" <=> len(s) <= offset or offset < 0 if (str().is_at(r, s, offset)) { - expr_ref len_s(str().mk_length(s), m()); - result = m().mk_or(m_autil.mk_le(len_s, offset), m_autil.mk_lt(offset, zero())); + expr_ref len_s(str().mk_length(s), m()); + { + auto _seq5138_0 = m_autil.mk_le(len_s, offset); + auto _seq5138_1 = m_autil.mk_lt(offset, zero()); + result = m().mk_or(_seq5138_0, _seq5138_1); + } return true; } return false; diff --git a/src/ast/rewriter/seq_rewriter.h b/src/ast/rewriter/seq_rewriter.h index 47379fa013..01faf965ee 100644 --- a/src/ast/rewriter/seq_rewriter.h +++ b/src/ast/rewriter/seq_rewriter.h @@ -18,7 +18,6 @@ Notes: --*/ #pragma once -#include "seq_split.h" #include "ast/seq_decl_plugin.h" #include "ast/rewriter/seq_derive.h" #include "ast/ast_pp.h" diff --git a/src/ast/rewriter/seq_skolem.h b/src/ast/rewriter/seq_skolem.h index 0aa7f03f3c..f3e75cb68b 100644 --- a/src/ast/rewriter/seq_skolem.h +++ b/src/ast/rewriter/seq_skolem.h @@ -21,6 +21,7 @@ Author: #include "ast/seq_decl_plugin.h" #include "ast/arith_decl_plugin.h" #include "ast/rewriter/th_rewriter.h" +#include "util/manage_warnings.h" namespace seq { @@ -150,7 +151,9 @@ namespace seq { bool is_align(expr const* e) const { return is_skolem(symbol("seq.align.m"), e); } bool is_align_l(expr const* e) const { return is_skolem(symbol("seq.align.l"), e); } bool is_align_r(expr const* e) const { return is_skolem(symbol("seq.align.r"), e); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_BINARY(is_align); + END_DISABLE_WARNING; bool is_post(expr* e, expr*& s, expr*& start); bool is_pre(expr* e, expr*& s, expr*& i); bool is_eq(expr* e, expr*& a, expr*& b) const; diff --git a/src/ast/rewriter/term_enumeration.cpp b/src/ast/rewriter/term_enumeration.cpp index 2397db467b..eba649eacc 100644 --- a/src/ast/rewriter/term_enumeration.cpp +++ b/src/ast/rewriter/term_enumeration.cpp @@ -488,6 +488,106 @@ private: } }; +// ============================================================================ +// sort_stream - self-contained enumeration of terms of a single sort +// ============================================================================ + +/** + * A sort_stream owns a private grammar and bottom_up_enumerator so that + * several streams can be advanced independently and concurrently (as needed + * by the tuple iterator). It is seeded from the user-configured productions + * and, for array sorts, augments the grammar with fresh select operators and + * bound variables, wrapping enumerated bodies into lambdas. + */ +class sort_stream { +public: + sort_stream(ast_manager& m, func_decl_ref_vector const& funcs, expr_ref_vector const& exprs, sort* s) + : m(m), m_grammar(m), m_enum(m_grammar), autil(m), m_sort(s), m_current(m), m_pinned(m) { + for (func_decl* f : funcs) + m_grammar.add_func_decl(f); + for (expr* e : exprs) + m_grammar.add_expr(e); + m_enum.reset(); + init_sort(); + advance(); + } + + // Return the current term (already lambda-wrapped) and advance to the next + // one. Returns nullptr once the stream is exhausted. Returned terms remain + // pinned for the lifetime of the stream. + expr* next() { + if (m_end) + return nullptr; + expr* r = m_current.get(); + advance(); + return r; + } + +private: + ast_manager& m; + grammar m_grammar; + bottom_up_enumerator m_enum; + array_util autil; + sort* m_sort; + expr_ref m_current; + expr_ref_vector m_pinned; + bool m_end = false; + vector m_vars; + vector> m_decls; + vector> m_names; + + void init_sort() { + sort* range = m_sort; + while (autil.is_array(range)) { + m_vars.push_back(expr_ref_vector(m)); + m_decls.push_back(ptr_vector()); + m_names.push_back(vector()); + for (unsigned i = 0; i < get_array_arity(range); ++i) { + m_decls.back().push_back(get_array_domain(range, i)); + m_vars.back().push_back(nullptr); + m_names.back().push_back(symbol()); + } + expr_ref_vector args(m); + args.push_back(m.mk_const("a", range)); + for (unsigned i = 0; i < m_decls.back().size(); ++i) + args.push_back(m.mk_var(i, m_decls.back().get(i))); + app_ref sel(autil.mk_select(args), m); + m_grammar.add_func_decl(sel->get_decl()); + range = get_array_range(range); + } + unsigned n = 0; + for (unsigned i = m_decls.size(); i-- > 0;) { + for (unsigned j = m_decls[i].size(); j-- > 0;) { + m_vars[i][j] = m.mk_var(n, m_decls[i][j]); + m_names[i][j] = symbol(n); + m_grammar.add_expr(m_vars[i].get(j)); + n++; + } + } + m_sort = range; + m_enum.set_target_sort(range); + } + + void mk_lambda() { + if (!m_current) + return; + for (unsigned i = m_decls.size(); i-- > 0;) + m_current = m.mk_lambda(m_decls[i].size(), m_decls[i].data(), m_names[i].data(), m_current); + } + + void advance() { + if (m_end) + return; + m_current = m_enum.next(); + SASSERT(!m_current || m_current->get_sort() == m_sort); + mk_lambda(); + if (!m_current) + m_end = true; + else + m_pinned.push_back(m_current); + } +}; + } // namespace term_enum // ============================================================================ @@ -499,16 +599,21 @@ struct term_enumeration::imp { term_enum::grammar m_grammar; term_enum::bottom_up_enumerator m_bottom_up_enumerator; std::function m_cost; + func_decl_ref_vector m_user_funcs; + expr_ref_vector m_user_exprs; imp(ast_manager& m) : - m(m), m_grammar(m), m_bottom_up_enumerator(m_grammar) {} + m(m), m_grammar(m), m_bottom_up_enumerator(m_grammar), + m_user_funcs(m), m_user_exprs(m) {} void add_production(func_decl* f) { m_grammar.add_func_decl(f); + m_user_funcs.push_back(f); } void add_production(expr* e) { m_grammar.add_expr(e); + m_user_exprs.push_back(e); } void set_cost(std::function const& cost) { @@ -650,6 +755,157 @@ term_enumeration::iterator term_enumeration::terms::end() { return iterator(nullptr); } +// -- tuple iterator implementation -- + +struct term_enumeration::tuple_iterator::timp { + imp& m_imp; + ast_manager& m; + unsigned m_n; + scoped_ptr_vector m_streams; + vector m_terms; // materialized terms per dimension + svector m_done; // per-dimension exhausted flag + unsigned m_rr = 0; // round-robin cursor + vector m_buffer; // pending tuples + unsigned m_buf_idx = 0; + expr_ref_vector m_current; + bool m_end = false; + bool m_dead = false; + + timp(imp& i, unsigned n, sort* const* sorts) : + m_imp(i), m(i.m), m_n(n), m_current(i.m) { + for (unsigned k = 0; k < n; ++k) { + m_streams.push_back(alloc(term_enum::sort_stream, m, i.m_user_funcs, i.m_user_exprs, sorts[k])); + m_terms.push_back(expr_ref_vector(m)); + m_done.push_back(false); + } + if (n == 0) { + m_end = true; + return; + } + advance(); + } + + // Emit all tuples where dimension d is the fresh term t and every other + // dimension ranges over its currently materialized terms. + void emit(unsigned d, expr* t) { + for (unsigned j = 0; j < m_n; ++j) + if (j != d && m_terms[j].empty()) + return; + svector idx; + idx.resize(m_n, 0); + while (true) { + expr_ref_vector tup(m); + for (unsigned j = 0; j < m_n; ++j) + tup.push_back(j == d ? t : m_terms[j].get(idx[j])); + m_buffer.push_back(tup); + bool carried = false; + for (unsigned j = m_n; j-- > 0;) { + if (j == d) + continue; + idx[j]++; + if (idx[j] < m_terms[j].size()) { + carried = true; + break; + } + idx[j] = 0; + } + if (!carried) + break; + } + } + + // Advance one dimension. Returns false if every dimension is exhausted. + bool step() { + for (unsigned tries = 0; tries < m_n; ++tries) { + unsigned d = m_rr; + m_rr = (m_rr + 1) % m_n; + if (m_done[d]) + continue; + expr* t = m_streams[d]->next(); + if (!t) { + m_done[d] = true; + if (m_terms[d].empty()) + m_dead = true; // this dimension yields no terms at all + return true; + } + emit(d, t); + m_terms[d].push_back(t); + return true; + } + return false; + } + + bool fill() { + while (m_buf_idx >= m_buffer.size()) { + if (m_dead) + return false; + if (!step()) + return false; + } + return true; + } + + void advance() { + if (m_end) + return; + if (m_buf_idx >= m_buffer.size()) { + m_buffer.reset(); + m_buf_idx = 0; + if (!fill()) { + m_end = true; + m_current.reset(); + return; + } + } + m_current.reset(); + m_current.append(m_buffer[m_buf_idx]); + m_buf_idx++; + } +}; + +term_enumeration::tuple_iterator::tuple_iterator(imp& i, unsigned n, sort* const* sorts) { + m_imp = alloc(timp, i, n, sorts); +} + +term_enumeration::tuple_iterator::tuple_iterator(std::nullptr_t) { + m_imp = nullptr; +} + +term_enumeration::tuple_iterator::~tuple_iterator() { + dealloc(m_imp); +} + +expr_ref_vector term_enumeration::tuple_iterator::operator*() { + SASSERT(m_imp); + return m_imp->m_current; +} + +term_enumeration::tuple_iterator& term_enumeration::tuple_iterator::operator++() { + if (m_imp) + m_imp->advance(); + return *this; +} + +bool term_enumeration::tuple_iterator::operator==(tuple_iterator const& other) const { + if (!m_imp && !other.m_imp) return true; + if (!m_imp) return other.m_imp->m_end; + if (!other.m_imp) return m_imp->m_end; + return m_imp->m_end == other.m_imp->m_end; +} + +// -- tuples implementation -- + +term_enumeration::tuples::tuples(imp* i, unsigned n, sort* const* sorts) : + m_imp(i), m_sorts(n, sorts) {} + +term_enumeration::tuple_iterator term_enumeration::tuples::begin() { + return tuple_iterator(*m_imp, m_sorts.size(), m_sorts.data()); +} + +term_enumeration::tuple_iterator term_enumeration::tuples::end() { + return tuple_iterator(nullptr); +} + // -- term_enumeration implementation -- term_enumeration::term_enumeration(ast_manager& m) { @@ -676,6 +932,14 @@ term_enumeration::terms term_enumeration::enum_terms(sort* s) { return terms(m_imp, s); } +term_enumeration::tuples term_enumeration::enum_tuples(unsigned n, sort* const* sorts) { + return tuples(m_imp, n, sorts); +} + +term_enumeration::tuples term_enumeration::enum_tuples(sort_ref_vector const& sorts) { + return tuples(m_imp, sorts.size(), sorts.data()); +} + std::ostream& term_enumeration::display(std::ostream& out) const { return m_imp->display(out); } diff --git a/src/ast/rewriter/term_enumeration.h b/src/ast/rewriter/term_enumeration.h index 865b8d4021..5a77dfc03f 100644 --- a/src/ast/rewriter/term_enumeration.h +++ b/src/ast/rewriter/term_enumeration.h @@ -46,5 +46,36 @@ public: terms enum_terms(sort* s); + // -- tuple enumeration -- + // Iterate over vectors of terms, one term per input sort. Produces all + // combinations (dovetailed, since individual streams may be infinite). + + class tuple_iterator { + struct timp; + timp* m_imp; + public: + tuple_iterator(imp& i, unsigned n, sort* const* sorts); + tuple_iterator(std::nullptr_t); + ~tuple_iterator(); + expr_ref_vector operator*(); + tuple_iterator& operator++(); + bool operator!=(tuple_iterator const& other) const { + return !(*this == other); + } + bool operator==(tuple_iterator const& other) const; + }; + + class tuples { + imp* m_imp; + ptr_vector m_sorts; + public: + tuples(imp* i, unsigned n, sort* const* sorts); + tuple_iterator begin(); + tuple_iterator end(); + }; + + tuples enum_tuples(unsigned n, sort* const* sorts); + tuples enum_tuples(sort_ref_vector const& sorts); + std::ostream& display(std::ostream& out) const; }; \ No newline at end of file diff --git a/src/ast/rewriter/th_rewriter.cpp b/src/ast/rewriter/th_rewriter.cpp index e4047a4f61..4e17bba4a4 100644 --- a/src/ast/rewriter/th_rewriter.cpp +++ b/src/ast/rewriter/th_rewriter.cpp @@ -81,6 +81,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { bool m_rewrite_patterns = true; bool m_enable_der = true; bool m_nested_der = false; + bool m_push_quantifiers = false; ast_manager & m() const { return m_b_rw.m(); } @@ -99,6 +100,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { m_rewrite_patterns = p.rewrite_patterns(); m_enable_der = p.enable_der(); m_nested_der = _p.get_bool("nested_der", false); + m_push_quantifiers = _p.get_bool("push_quantifiers", false); } void updt_params(params_ref const & p) { @@ -146,11 +148,19 @@ struct th_rewriter_cfg : public default_rewriter_cfg { expr * x; unsigned val; if (m_bv_rw.is_eq_bit(lhs, x, val)) { - result = m().mk_eq(x, m().mk_ite(rhs, m_bv_rw.mk_numeral(val, 1), m_bv_rw.mk_numeral(1-val, 1))); + { + auto _seq151_0 = m_bv_rw.mk_numeral(val, 1); + auto _seq151_1 = m_bv_rw.mk_numeral(1 - val, 1); + result = m().mk_eq(x, m().mk_ite(rhs, _seq151_0, _seq151_1)); + } return BR_REWRITE2; } if (m_bv_rw.is_eq_bit(rhs, x, val)) { - result = m().mk_eq(x, m().mk_ite(lhs, m_bv_rw.mk_numeral(val, 1), m_bv_rw.mk_numeral(1-val, 1))); + { + auto _seq155_0 = m_bv_rw.mk_numeral(val, 1); + auto _seq155_1 = m_bv_rw.mk_numeral(1 - val, 1); + result = m().mk_eq(x, m().mk_ite(lhs, _seq155_0, _seq155_1)); + } return BR_REWRITE2; } return BR_FAILED; @@ -251,22 +261,28 @@ struct th_rewriter_cfg : public default_rewriter_cfg { template br_status pull_ite_core(func_decl * p, app * ite, app * value, expr_ref & result) { if (m().is_eq(p)) { - result = m().mk_ite(ite->get_arg(0), - mk_eq_value(ite->get_arg(1), value), - mk_eq_value(ite->get_arg(2), value)); + { + auto _seq256_0 = mk_eq_value(ite->get_arg(1), value); + auto _seq256_1 = mk_eq_value(ite->get_arg(2), value); + result = m().mk_ite(ite->get_arg(0), _seq256_0, _seq256_1); + } return BR_REWRITE2; } else { if (SWAP) { - result = m().mk_ite(ite->get_arg(0), - m().mk_app(p, value, ite->get_arg(1)), - m().mk_app(p, value, ite->get_arg(2))); + { + auto _seq263_0 = m().mk_app(p, value, ite->get_arg(1)); + auto _seq263_1 = m().mk_app(p, value, ite->get_arg(2)); + result = m().mk_ite(ite->get_arg(0), _seq263_0, _seq263_1); + } return BR_REWRITE2; } else { - result = m().mk_ite(ite->get_arg(0), - m().mk_app(p, ite->get_arg(1), value), - m().mk_app(p, ite->get_arg(2), value)); + { + auto _seq269_0 = m().mk_app(p, ite->get_arg(1), value); + auto _seq269_1 = m().mk_app(p, ite->get_arg(2), value); + result = m().mk_ite(ite->get_arg(0), _seq269_0, _seq269_1); + } return BR_REWRITE2; } } @@ -309,10 +325,11 @@ struct th_rewriter_cfg : public default_rewriter_cfg { if (m().is_value(args[1]) && args[0]->get_ref_count() == 1) return pull_ite_core(f, to_app(args[0]), to_app(args[1]), result); if (m().is_ite(args[1]) && to_app(args[0])->get_arg(0) == to_app(args[1])->get_arg(0)) { - // (p (ite C A1 B1) (ite C A2 B2)) --> (ite (p A1 A2) (p B1 B2)) - result = m().mk_ite(to_app(args[0])->get_arg(0), - m().mk_app(f, to_app(args[0])->get_arg(1), to_app(args[1])->get_arg(1)), - m().mk_app(f, to_app(args[0])->get_arg(2), to_app(args[1])->get_arg(2))); + { + auto _seq315_0 = m().mk_app(f, to_app(args[0])->get_arg(1), to_app(args[1])->get_arg(1)); + auto _seq315_1 = m().mk_app(f, to_app(args[0])->get_arg(2), to_app(args[1])->get_arg(2)); + result = m().mk_ite(to_app(args[0])->get_arg(0), _seq315_0, _seq315_1); + } return BR_REWRITE2; } } @@ -774,7 +791,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { // exists x . ~(A /\ B) --> (exists x. ~A) \/ (exists x. ~B) // Each rule is a validity, and the distributed sub-quantifiers give the // e-matching engine finer-grained instantiation targets. - bool distribute_quantifier(quantifier * old_q, expr * new_body, expr_ref & result) { + bool push_quantifier(quantifier * old_q, expr * new_body, expr_ref & result) { if (old_q->get_kind() == lambda_k) return false; if (old_q->has_patterns()) @@ -800,6 +817,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { else return false; } + if (args.size() < 2) return false; expr_ref_vector quants(m()); @@ -878,7 +896,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { } return true; } - else if (distribute_quantifier(old_q, new_body, result)) { + else if (m_push_quantifiers && push_quantifier(old_q, new_body, result)) { if (m().proofs_enabled()) { result_pr = m().mk_rewrite(old_q, result); } diff --git a/src/ast/seq_decl_plugin.h b/src/ast/seq_decl_plugin.h index dbdf17369e..73836bd14b 100644 --- a/src/ast/seq_decl_plugin.h +++ b/src/ast/seq_decl_plugin.h @@ -25,6 +25,7 @@ Revision History: #include "ast/ast.h" #include "ast/char_decl_plugin.h" #include "util/lbool.h" +#include "util/manage_warnings.h" #include "util/zstring.h" enum seq_sort_kind { @@ -272,10 +273,12 @@ public: app* mk_skolem(symbol const& name, unsigned n, expr* const* args, sort* range); bool is_skolem(expr const* e) const { return is_app_of(e, m_fid, _OP_SEQ_SKOLEM); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_BINARY(is_char_le); MATCH_UNARY(is_char2int); MATCH_UNARY(is_char2bv); MATCH_UNARY(is_bv2char); + END_DISABLE_WARNING; bool has_re() const { return seq.has_re(); } bool has_seq() const { return seq.has_seq(); } @@ -397,6 +400,7 @@ public: return (u.is_seq(s) && !u.is_string(s)); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_BINARY(is_concat); MATCH_UNARY(is_length); MATCH_TERNARY(is_extract); @@ -429,6 +433,7 @@ public: MATCH_UNARY(is_to_code); MATCH_BINARY(is_in_re); MATCH_UNARY(is_unit); + END_DISABLE_WARNING; void get_concat(expr* e, expr_ref_vector& es) const; void get_concat(expr* e, ptr_vector& es) const; @@ -583,6 +588,7 @@ public: bool is_of_pred(expr const* n) const { return is_app_of(n, m_fid, OP_RE_OF_PRED); } bool is_reverse(expr const* n) const { return is_app_of(n, m_fid, OP_RE_REVERSE); } bool is_derivative(expr const* n) const { return is_app_of(n, m_fid, OP_RE_DERIVATIVE); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_UNARY(is_to_re); MATCH_BINARY(is_concat); MATCH_BINARY(is_union); @@ -597,6 +603,7 @@ public: MATCH_UNARY(is_of_pred); MATCH_UNARY(is_reverse); MATCH_BINARY(is_derivative); + END_DISABLE_WARNING; bool is_loop(expr const* n, expr*& body, unsigned& lo, unsigned& hi) const; bool is_loop(expr const* n, expr*& body, unsigned& lo) const; bool is_loop(expr const* n, expr*& body, expr*& lo, expr*& hi) const; diff --git a/src/ast/simplifiers/elim_term_ite.h b/src/ast/simplifiers/elim_term_ite.h index 10f0392799..5d0c12b7f9 100644 --- a/src/ast/simplifiers/elim_term_ite.h +++ b/src/ast/simplifiers/elim_term_ite.h @@ -34,11 +34,17 @@ public: void reduce() override { expr_ref r(m); proof_ref pr(m); + unsigned prev_defs_sz = m_rewriter.new_defs().size(); for (unsigned idx : indices()) { auto const& d = m_fmls[idx]; m_rewriter(d.fml(), r, pr); if (d.fml() != r) m_fmls.update(idx, dependent_expr(m, r, mp(d.pr(), pr), d.dep())); + for (unsigned i = prev_defs_sz; i < m_rewriter.new_defs().size(); ++i) { + auto const& def = m_rewriter.new_defs()[i]; + m_fmls.add(dependent_expr(m, def.fml(), def.pr(), nullptr)); + } + prev_defs_sz = m_rewriter.new_defs().size(); } } diff --git a/src/ast/simplifiers/eliminate_predicates.cpp b/src/ast/simplifiers/eliminate_predicates.cpp index 2fb9b62d8b..1b79a867ed 100644 --- a/src/ast/simplifiers/eliminate_predicates.cpp +++ b/src/ast/simplifiers/eliminate_predicates.cpp @@ -207,7 +207,11 @@ void eliminate_predicates::insert_quasi_macro(app* head, expr* body, clause& cl) f1 = m.mk_fresh_func_decl(f->get_name(), symbol::null, sorts.size(), sorts.data(), f->get_range()); lhs = m.mk_app(f, args); - rhs = m.mk_ite(mk_and(eqs), body, m.mk_app(f1, args)); + { + auto _seq210_0 = mk_and(eqs); + auto _seq210_1 = m.mk_app(f1, args); + rhs = m.mk_ite(_seq210_0, body, _seq210_1); + } insert_macro(lhs, rhs, cl); } diff --git a/src/ast/simplifiers/euf_completion.cpp b/src/ast/simplifiers/euf_completion.cpp index 9bbf5bbb3f..0db05f4058 100644 --- a/src/ast/simplifiers/euf_completion.cpp +++ b/src/ast/simplifiers/euf_completion.cpp @@ -987,16 +987,23 @@ namespace euf { r = expr_ref(m.mk_true(), m); else if (x == x1 && y == y1) r = m_rewriter.mk_eq(x, y); - else if (is_nullary(x) && is_nullary(y)) - r = mk_and(m_rewriter.mk_eq(x, x1), m_rewriter.mk_eq(y, x1)); - else if (x == x1 && is_nullary(x)) + else if (is_nullary(x) && is_nullary(y)) { + auto _seq0 = m_rewriter.mk_eq(x, x1); + auto _seq1 = m_rewriter.mk_eq(y, x1); + r = mk_and(_seq0, _seq1); + } else if (x == x1 && is_nullary(x)) r = m_rewriter.mk_eq(y1, x1); else if (y == y1 && is_nullary(y)) r = m_rewriter.mk_eq(x1, y1); - else if (is_nullary(x)) - r = mk_and(m_rewriter.mk_eq(x, x1), m_rewriter.mk_eq(y1, x1)); - else if (is_nullary(y)) - r = mk_and(m_rewriter.mk_eq(y, y1), m_rewriter.mk_eq(x1, y1)); + else if (is_nullary(x)) { + auto _seq0 = m_rewriter.mk_eq(x, x1); + auto _seq1 = m_rewriter.mk_eq(y1, x1); + r = mk_and(_seq0, _seq1); + } else if (is_nullary(y)) { + auto _seq0 = m_rewriter.mk_eq(y, y1); + auto _seq1 = m_rewriter.mk_eq(x1, y1); + r = mk_and(_seq0, _seq1); + } if (x1 == y1) r = expr_ref(m.mk_true(), m); else { @@ -1005,8 +1012,11 @@ namespace euf { r = m_rewriter.mk_eq(y1, c); else if (c == y1) r = m_rewriter.mk_eq(x1, c); - else - r = mk_and(m_rewriter.mk_eq(x1, c), m_rewriter.mk_eq(y1, c)); + else { + auto _seq1009_0 = m_rewriter.mk_eq(x1, c); + auto _seq1009_1 = m_rewriter.mk_eq(y1, c); + r = mk_and(_seq1009_0, _seq1009_1); + } } if (m.proofs_enabled()) { diff --git a/src/ast/simplifiers/factor_simplifier.cpp b/src/ast/simplifiers/factor_simplifier.cpp index f803ccb3f0..3e3e11b81c 100644 --- a/src/ast/simplifiers/factor_simplifier.cpp +++ b/src/ast/simplifiers/factor_simplifier.cpp @@ -59,7 +59,11 @@ struct factor_simplifier::rw_cfg : public default_rewriter_cfg { m_expr2poly.to_expr(fs[i], true, arg); args.push_back(arg); } - result = m.mk_eq(mk_mul(args.size(), args.data()), mk_zero_for(arg)); + { + auto _seq62_0 = mk_mul(args.size(), args.data()); + auto _seq62_1 = mk_zero_for(arg); + result = m.mk_eq(_seq62_0, _seq62_1); + } } // p1^k1 * p2^k2 = 0 --> p1 = 0 or p2 = 0 @@ -151,7 +155,9 @@ struct factor_simplifier::rw_cfg : public default_rewriter_cfg { } } else { - args.push_back(m.mk_app(m_util.get_family_id(), k, mk_mul(odd_factors.size(), odd_factors.data()), mk_zero_for(odd_factors[0]))); + auto _seq154_0 = mk_mul(odd_factors.size(), odd_factors.data()); + auto _seq154_1 = mk_zero_for(odd_factors[0]); + args.push_back(m.mk_app(m_util.get_family_id(), k, _seq154_0, _seq154_1)); } SASSERT(!args.empty()); if (args.size() == 1) diff --git a/src/cmd_context/tactic_cmds.cpp b/src/cmd_context/tactic_cmds.cpp index f1a8dee047..5af40497b4 100644 --- a/src/cmd_context/tactic_cmds.cpp +++ b/src/cmd_context/tactic_cmds.cpp @@ -23,6 +23,7 @@ Notes: #include "util/scoped_timer.h" #include "util/scoped_ctrl_c.h" #include "util/cancel_eh.h" +#include "util/manage_warnings.h" #include "model/model_smt2_pp.h" #include "ast/ast_smt2_pp.h" #include "tactic/tactic.h" @@ -733,6 +734,7 @@ static probe * NAME ## _probe (cmd_context & ctx, sexpr * n) { return NAME(p1.get(), p2.get()); \ } +START_DISABLE_EXTRA_SEMI_WARNING; MK_BIN_PROBE(mk_eq); MK_BIN_PROBE(mk_le); MK_BIN_PROBE(mk_lt); @@ -741,6 +743,7 @@ MK_BIN_PROBE(mk_gt); MK_BIN_PROBE(mk_implies); MK_BIN_PROBE(mk_div); MK_BIN_PROBE(mk_sub); +END_DISABLE_WARNING; #define MK_NARY_PROBE(NAME) \ static probe * NAME ## _probe(cmd_context & ctx, sexpr * n) { \ @@ -762,10 +765,12 @@ static probe * NAME ## _probe(cmd_context & ctx, sexpr * n) { } \ } +START_DISABLE_EXTRA_SEMI_WARNING; MK_NARY_PROBE(mk_and); MK_NARY_PROBE(mk_or); MK_NARY_PROBE(mk_add); MK_NARY_PROBE(mk_mul); +END_DISABLE_WARNING; probe * sexpr2probe(cmd_context & ctx, sexpr * n) { if (n->is_symbol()) { diff --git a/src/cmd_context/tptp_frontend.cpp b/src/cmd_context/tptp_frontend.cpp index 966e026cab..9409614b50 100644 --- a/src/cmd_context/tptp_frontend.cpp +++ b/src/cmd_context/tptp_frontend.cpp @@ -960,11 +960,20 @@ class tptp_parser { } }; + // TPTP quantifiers are created with weight 1 (rather than the default 0) + // so that E-matching / ho_matching treats them uniformly. + expr_ref with_weight1(expr_ref q) { + if (is_quantifier(q) && !is_lambda(q)) + q = expr_ref(m.update_quantifier_weight(to_quantifier(q), 1), m); + return q; + } + expr_ref mk_quantifier(bool is_forall, ptr_vector const& bound, expr_ref const& body) { SASSERT(body); if (bound.empty()) return body; expr_ref b = ensure_bool(body); - return is_forall ? ::mk_forall(m, bound.size(), bound.data(), b.get()) : ::mk_exists(m, bound.size(), bound.data(), b.get()); + expr_ref q = is_forall ? ::mk_forall(m, bound.size(), bound.data(), b.get()) : ::mk_exists(m, bound.size(), bound.data(), b.get()); + return with_weight1(q); } // $is_rat(x) ≡ exists a:Int, b:Int. b != 0 && x = a/b @@ -983,7 +992,7 @@ class tptp_parser { ptr_vector bound; bound.push_back(a); bound.push_back(b); - return expr_ref(::mk_exists(m, bound.size(), bound.data(), body.get()), m); + return with_weight1(expr_ref(::mk_exists(m, bound.size(), bound.data(), body.get()), m)); } // Grammar: ::= | | | @@ -1808,7 +1817,7 @@ class tptp_parser { if (vars.size() > 1) { ptr_vector rest; for (unsigned i = 1; i < vars.size(); ++i) rest.push_back(vars[i]); - pred = expr_ref(::mk_exists(m, rest.size(), rest.data(), pred.get()), m); + pred = with_weight1(expr_ref(::mk_exists(m, rest.size(), rest.data(), pred.get()), m)); } app* xvar = vars[0]; expr_ref abs_body(m); @@ -1846,7 +1855,7 @@ class tptp_parser { app* cs[1] = { c }; expr_ref q = is_forall ? ::mk_forall(m, 1, cs, body.get()) : ::mk_exists(m, 1, cs, body.get()); - return q; + return with_weight1(q); } expr_ref_vector args(m); diff --git a/src/math/interval/dep_intervals.h b/src/math/interval/dep_intervals.h index eab62821af..aebdad4ea3 100644 --- a/src/math/interval/dep_intervals.h +++ b/src/math/interval/dep_intervals.h @@ -92,6 +92,12 @@ private: unsynch_mpq_manager::is_zero(a.m_lower) && unsynch_mpq_manager::is_zero(a.m_upper); } + bool is_ge_0(interval const& a) const { + return !lower_is_inf(a) && !lower_is_open(a) && unsynch_mpq_manager::is_zero(a.m_lower); + } + bool is_le_0(interval const &a) const { + return !upper_is_inf(a) && !upper_is_open(a) && unsynch_mpq_manager::is_zero(a.m_upper); + } // Setters void set_lower(interval& a, mpq const& n) const { m_manager.set(a.m_lower, n); } @@ -191,6 +197,12 @@ public: bool lower_is_inf(const interval& a) const { return m_config.lower_is_inf(a); } bool lower_is_open(const interval& a) const { return m_config.lower_is_open(a); } bool upper_is_open(const interval& a) const { return m_config.upper_is_open(a); } + bool is_ge_0(const interval &a) const { return m_config.is_ge_0(a); } + bool is_le_0(const interval &a) const { + return m_config.is_le_0(a); + } + + template void get_upper_dep(const interval& a, T& expl) { linearize(a.m_upper_dep, expl); } template diff --git a/src/math/lp/dioph_eq.cpp b/src/math/lp/dioph_eq.cpp index c6719e0e38..ba38d2227f 100644 --- a/src/math/lp/dioph_eq.cpp +++ b/src/math/lp/dioph_eq.cpp @@ -649,16 +649,12 @@ namespace lp { struct undo_fixed_column : public trail { imp& m_imp; unsigned m_j; // the column that has been added - mpq m_fixed_val; // not const: needs to be reset in undo() to free heap memory - undo_fixed_column(imp& s, unsigned j) : m_imp(s), m_j(j), m_fixed_val(s.lra.get_lower_bound(j).x) { + undo_fixed_column(imp& s, unsigned j) : m_imp(s), m_j(j) { SASSERT(s.lra.column_is_fixed(j)); } void undo() override { m_imp.add_changed_column(m_j); - // Free heap-allocated memory in m_fixed_val since this struct is region-allocated - // and its destructor won't be called - m_fixed_val.reset(); } }; diff --git a/src/math/lp/horner.cpp b/src/math/lp/horner.cpp index fffb4357c7..cc30537eff 100644 --- a/src/math/lp/horner.cpp +++ b/src/math/lp/horner.cpp @@ -104,6 +104,19 @@ bool horner::horner_lemmas() { TRACE(nla_solver, tout << "not generating horner lemmas\n";); return false; } + // Tighten the bounds of nonlinear variables over the LP tableau before the + // cross-nested/horner interval evaluation, so the tighter implied bounds can + // exclude zero and expose conflicts. Done here (instead of core::propagate) + // so the LP maximization only runs when horner is actually scheduled. + // optimize_nl_bounds() checks arith.nl.optimize_bounds internally. + c().optimize_nl_bounds(); + // optimize_nl_bounds re-calibrated m_to_refine against the model it produced. + // If nothing remains to refine, every monomial is consistent under a feasible + // LP model: the nonlinear goal is satisfied. Declare it and stop. + if (c().to_refine().empty()) { + c().set_nla_satisfied(); + return false; + } c().lp_settings().stats().m_horner_calls++; const auto& matrix = c().lra.A_r(); // choose only rows that depend on m_to_refine variables diff --git a/src/math/lp/int_branch.cpp b/src/math/lp/int_branch.cpp index a82d4500b3..e142cd23ca 100644 --- a/src/math/lp/int_branch.cpp +++ b/src/math/lp/int_branch.cpp @@ -52,62 +52,76 @@ lia_move int_branch::create_branch_on_column(int j) { int int_branch::find_inf_int_base_column() { - -#if 1 - return lia.select_int_infeasible_var(); -#endif - - int result = -1; + int r_small_box = -1; + int r_small_value = -1; + int r_any_value = -1; + unsigned n_small_box = 1; + unsigned n_small_value = 1; + unsigned n_any_value = 1; mpq range; mpq new_range; mpq small_value(1024); - unsigned n = 0; - lar_core_solver & lcs = lra.get_core_solver(); - unsigned prev_usage = 0; // to quiet down the compiler - unsigned k = 0; - unsigned usage; - unsigned j; + mpq min_any_value; + unsigned prev_usage = 0; - // this loop looks for a column with the most usages, but breaks when - // a column with a small span of bounds is found - for (; k < lra.r_basis().size(); ++k) { - j = lra.r_basis()[k]; + auto add_column = [&](bool improved, int &result, unsigned &n, unsigned j) { + if (result == -1) + result = j; + else if (improved && (lra.settings().random_next() % (++n)) == 0) + result = j; + }; + + for (unsigned j : lra.r_basis()) { if (!lia.column_is_int_inf(j)) continue; - usage = lra.usage_in_terms(j); - if (lia.is_boxed(j) && (range = lcs.m_r_upper_bounds[j].x - lcs.m_r_lower_bounds[j].x - rational(2*usage)) <= small_value) { - result = j; - k++; - n = 1; - break; + if (lia.settings().get_cancel_flag()) { + return -1; } - - if (n == 0 || usage > prev_usage) { - result = j; - prev_usage = usage; - n = 1; - } else if (usage == prev_usage && (lia.settings().random_next() % (++n) == 0)) { - result = j; - } - } - SASSERT(k == lra.r_basis().size() || n == 1); - // this loop looks for boxed columns with a small span - for (; k < lra.r_basis().size(); ++k) { - j = lra.r_basis()[k]; - if (!lia.column_is_int_inf(j) || !lia.is_boxed(j)) - continue; SASSERT(!lia.is_fixed(j)); - usage = lra.usage_in_terms(j); - new_range = lcs.m_r_upper_bounds[j].x - lcs.m_r_lower_bounds[j].x - rational(2*usage); - if (new_range < range) { - n = 1; - result = j; - range = new_range; - } else if (new_range == range && (lia.settings().random_next() % (++n) == 0)) { - result = j; + + unsigned usage = lra.usage_in_terms(j); + if (lia.is_boxed(j) && (new_range = lra.bound_span_x(j) - rational(2 * usage)) <= small_value) { + bool improved = new_range <= range || r_small_box == -1; + if (improved) + range = new_range; + add_column(improved, r_small_box, n_small_box, j); + continue; + } + impq const &value = lia.get_value(j); + if (abs(value.x) < small_value || (lra.column_has_upper_bound(j) && small_value > lia.upper_bound(j).x - value.x) || + (lia.has_lower(j) && small_value > value.x - lia.lower_bound(j).x)) { + TRACE(int_solver, tout << "small j" << j << "\n"); + add_column(true, r_small_value, n_small_value, j); + continue; + } + TRACE(int_solver, tout << "any j" << j << "\n"); + // Among columns with a large value, prefer the one whose + // absolute value is smallest to avoid branching on ever + // larger integers when better (smaller) options are available. + mpq const abs_value = abs(value.x); + if (r_any_value == -1 || abs_value < min_any_value) { + r_any_value = j; + min_any_value = abs_value; + n_any_value = 1; + prev_usage = usage; + } + else if (abs_value == min_any_value) { + add_column(usage >= prev_usage, r_any_value, n_any_value, j); + if (usage > prev_usage) + prev_usage = usage; } } - return result; + + if (r_small_box != -1 && (lra.settings().random_next() % 3 != 0)) + return r_small_box; + if (r_small_value != -1 && (lra.settings().random_next() % 3) != 0) + return r_small_value; + if (r_any_value != -1) + return r_any_value; + if (r_small_box != -1) + return r_small_box; + return r_small_value; + } } diff --git a/src/math/lp/int_solver.cpp b/src/math/lp/int_solver.cpp index 287a57fd06..0f7fbe3754 100644 --- a/src/math/lp/int_solver.cpp +++ b/src/math/lp/int_solver.cpp @@ -322,68 +322,7 @@ namespace lp { tout << "term:";lra.print_term(m_t, tout) << "\n"; ); return v * sign > impq(m_k) * sign; - } - - int select_int_infeasible_var() { - int r_small_box = -1; - int r_small_value = -1; - int r_any_value = -1; - unsigned n_small_box = 1; - unsigned n_small_value = 1; - unsigned n_any_value = 1; - mpq range; - mpq new_range; - mpq small_value(1024); - unsigned prev_usage = 0; - - auto add_column = [&](bool improved, int& result, unsigned& n, unsigned j) { - if (result == -1) - result = j; - else if (improved && ((random() % (++n)) == 0)) - result = j; - }; - - for (unsigned j : lra.r_basis()) { - if (!column_is_int_inf(j)) - continue; - if (settings().get_cancel_flag()){ - return -1; - } - SASSERT(!lia.is_fixed(j)); - - unsigned usage = lra.usage_in_terms(j); - if (lia.is_boxed(j) && (new_range = lra.bound_span_x(j) - rational(2*usage)) <= small_value) { - - bool improved = new_range <= range || r_small_box == -1; - if (improved) - range = new_range; - add_column(improved, r_small_box, n_small_box, j); - continue; - } - impq const& value = lia.get_value(j); - if (abs(value.x) < small_value || - (lra.column_has_upper_bound(j) && small_value > upper_bound(j).x - value.x) || - (has_lower(j) && small_value > value.x - lower_bound(j).x)) { - TRACE(int_solver, tout << "small j" << j << "\n"); - add_column(true, r_small_value, n_small_value, j); - continue; - } - TRACE(int_solver, tout << "any j" << j << "\n"); - add_column(usage >= prev_usage, r_any_value, n_any_value, j); - if (usage > prev_usage) - prev_usage = usage; - } - - if (r_small_box != -1 && (random() % 3 != 0)) - return r_small_box; - if (r_small_value != -1 && (random() % 3) != 0) - return r_small_value; - if (r_any_value != -1) - return r_any_value; - if (r_small_box != -1) - return r_small_box; - return r_small_value; - } + } std::ostream & display_row(std::ostream & out, lp::row_strip const & row) const { bool first = true; @@ -796,7 +735,9 @@ namespace lp { return true; } - + bool int_solver::current_solution_is_inf_on_cut() const { + return m_imp->current_solution_is_inf_on_cut(); + } void int_solver::simplify(std::function& is_root) { return; @@ -956,8 +897,6 @@ namespace lp { return m_imp->has_upper(j); } - int int_solver::select_int_infeasible_var() { return m_imp->select_int_infeasible_var(); } - bool int_solver::current_solution_is_inf_on_cut() const { return m_imp->current_solution_is_inf_on_cut(); } const impq & int_solver::lower_bound(unsigned j) const { return m_imp->lower_bound(j);} const impq & int_solver::upper_bound(unsigned j) const { return m_imp->upper_bound(j);} #if Z3DEBUG diff --git a/src/math/lp/lar_solver.cpp b/src/math/lp/lar_solver.cpp index 2f7dc11d25..a47eb6ede6 100644 --- a/src/math/lp/lar_solver.cpp +++ b/src/math/lp/lar_solver.cpp @@ -644,7 +644,6 @@ namespace lp { for (auto c : cs) m_imp->m_constraints.display(tout, c) << "\n"; }); - SASSERT(bound_dep != nullptr); dep = dep_manager().mk_join(dep, bound_dep); } return dep; @@ -1572,22 +1571,23 @@ namespace lp { return false; m_imp->m_delta = get_core_solver().find_delta_for_strict_bounds(m_imp->m_settings.m_epsilon); - unsigned j; unsigned n = get_core_solver().r_x().size(); + // the set of distinct column values does not depend on m_delta, so collect it once + // and only rescan the distinct pairs when m_delta is halved + m_imp->m_set_of_different_pairs.clear(); + for (unsigned j = 0; j < n; ++j) + m_imp->m_set_of_different_pairs.insert(get_core_solver().r_x(j)); + bool collision; do { - m_imp->m_set_of_different_pairs.clear(); + collision = false; m_imp->m_set_of_different_singles.clear(); - for (j = 0; j < n; ++j) { - const numeric_pair& rp = get_core_solver().r_x(j); - mpq x = rp.x + m_imp->m_delta * rp.y; - m_imp->m_set_of_different_pairs.insert(rp); - m_imp->m_set_of_different_singles.insert(x); - if (m_imp->m_set_of_different_pairs.size() != m_imp->m_set_of_different_singles.size()) { - m_imp->m_delta /= mpq(2); - break; - } + for (const numeric_pair& rp : m_imp->m_set_of_different_pairs) + m_imp->m_set_of_different_singles.insert(rp.x + m_imp->m_delta * rp.y); + if (m_imp->m_set_of_different_singles.size() != m_imp->m_set_of_different_pairs.size()) { + m_imp->m_delta /= mpq(2); + collision = true; } - } while (j != n); + } while (collision); TRACE(lar_solver_model, tout << "delta = " << m_imp->m_delta << "\nmodel:\n";); return true; } @@ -2479,6 +2479,7 @@ namespace lp { } case GT: y_of_bound += 1; + Z3_fallthrough; case GE: { auto low = numeric_pair(right_side.x, y_of_bound); if (low < get_lower_bound(j)) { diff --git a/src/math/lp/monomial_bounds.cpp b/src/math/lp/monomial_bounds.cpp index ff31f7ef53..fa0c3251a4 100644 --- a/src/math/lp/monomial_bounds.cpp +++ b/src/math/lp/monomial_bounds.cpp @@ -14,247 +14,61 @@ namespace nla { - monomial_bounds::monomial_bounds(core* c): - common(c), - dep(c->m_intervals.get_dep_intervals()) { - - std::function fixed_eh = [c, this](lpvar v) { - c->trail().push(push_back_vector(m_fixed_var_trail)); - m_fixed_var_trail.push_back(v); - }; -// uncomment to enable: -// c->lra.m_fixed_var_eh = fixed_eh; - } + monomial_bounds::monomial_bounds(core *c) : common(c), dep(c->m_intervals.get_dep_intervals()) {} - void monomial_bounds::propagate() { - for (lpvar v : c().m_to_refine) { - propagate(c().emon(v)); - if (add_lemma()) + void monomial_bounds::generate_lemmas() { + for (auto v : c().m_to_refine) { + generate_lemma(c().emon(v)); + if (add_lemma()) break; } - propagate_fixed_vars(); } - void monomial_bounds::propagate_fixed_vars() { - if (m_fixed_var_qhead == m_fixed_var_trail.size()) - return; - c().trail().push(value_trail(m_fixed_var_qhead)); - while (m_fixed_var_qhead < m_fixed_var_trail.size()) - propagate_fixed_var(m_fixed_var_trail[m_fixed_var_qhead++]); - } - - void monomial_bounds::propagate_fixed_var(lpvar v) { - SASSERT(c().var_is_fixed(v)); - TRACE(nla_solver, tout << "propagate fixed var: " << c().var_str(v) << "\n";); - for (auto const& m : c().emons().get_use_list(v)) - propagate_fixed_var(m, v); - } - - void monomial_bounds::propagate_fixed_var(monic const& m, lpvar v) { - unsigned num_free = 0; - lpvar free_var = null_lpvar; - for (auto w : m) - if (!c().var_is_fixed(w)) - ++num_free, free_var = w; - if (num_free != 1) - return; - u_dependency* d = nullptr; - auto& lra = c().lra; - lp::mpq coeff(1); - for (auto w : m) { - if (c().var_is_fixed(w)) { - d = lra.join_deps(d, lra.get_bound_constraint_witnesses_for_column(w)); - coeff *= lra.get_lower_bound(w).x; - } - } - vector> coeffs; - coeffs.push_back({coeff, free_var}); - coeffs.push_back({mpq(-1), m.var()}); - lpvar j = lra.add_term(coeffs, UINT_MAX); - lra.update_column_type_and_bound(j, llc::EQ, mpq(0), d); - } - - bool monomial_bounds::is_too_big(mpq const& q) const { + bool monomial_bounds::is_too_big(mpq const &q) const { return rational(q).bitsize() > 256; } /** * Accumulate product of variables in monomial starting at position 'start' */ - void monomial_bounds::compute_product(unsigned start, monic const& m, scoped_dep_interval& product) { + void monomial_bounds::compute_product(unsigned start, monic const &m, scoped_dep_interval &product) { scoped_dep_interval vi(dep); unsigned power = 1; - for (unsigned i = start; i < m.size(); ) { + for (unsigned i = start; i < m.size();) { lpvar v = m.vars()[i]; var2interval(v, vi); ++i; - for (power = 1; i < m.size() && m.vars()[i] == v; ++i, ++power); - dep.power(vi, power, vi); + for (power = 1; i < m.size() && m.vars()[i] == v; ++i, ++power) + ; + dep.power(vi, power, vi); dep.mul(product, vi, product); } } - /** - * Monomial definition implies that a variable v is within 'range' - * If the current value of v is outside of the range, we add - * a bounds axiom. - */ - bool monomial_bounds::propagate_value(dep_interval& range, lpvar v) { - - bool propagated = false; - if (should_propagate_upper(range, v, 1)) { - auto const& upper = dep.upper(range); - auto cmp = dep.upper_is_open(range) ? llc::LT : llc::LE; - ++c().lra.settings().stats().m_nla_propagate_bounds; - lp::explanation ex; - dep.get_upper_dep(range, ex); - if (is_too_big(upper)) - return false; - lemma_builder lemma(c(), "propagate value - upper bound of range is below value"); - lemma &= ex; - lemma |= ineq(v, cmp, upper); - TRACE(nla_solver, dep.display(tout << c().val(v) << " > ", range) << "\n" << lemma << "\n";); - propagated = true; - } - if (should_propagate_lower(range, v, 1)) { - auto const& lower = dep.lower(range); - auto cmp = dep.lower_is_open(range) ? llc::GT : llc::GE; - ++c().lra.settings().stats().m_nla_propagate_bounds; - lp::explanation ex; - dep.get_lower_dep(range, ex); - if (is_too_big(lower)) - return false; - lemma_builder lemma(c(), "propagate value - lower bound of range is above value"); - lemma &= ex; - lemma |= ineq(v, cmp, lower); - TRACE(nla_solver, dep.display(tout << c().val(v) << " < ", range) << "\n" << lemma << "\n";); - propagated = true; - } - return propagated; - } - bool monomial_bounds::should_propagate_lower(dep_interval const& range, lpvar v, unsigned p) { + + bool monomial_bounds::should_propagate_lower(dep_interval const &range, lpvar v, unsigned p) { if (dep.lower_is_inf(range)) return false; auto bound = c().val(v); - auto const& lower = dep.lower(range); + auto const &lower = dep.lower(range); if (p > 1) bound = power(bound, p); return bound < lower; } - bool monomial_bounds::should_propagate_upper(dep_interval const& range, lpvar v, unsigned p) { + bool monomial_bounds::should_propagate_upper(dep_interval const &range, lpvar v, unsigned p) { if (dep.upper_is_inf(range)) return false; auto bound = c().val(v); - auto const& upper = dep.upper(range); + auto const &upper = dep.upper(range); if (p > 1) bound = power(bound, p); return bound > upper; } - /** - * Ensure that bounds are integral when the variable is integer. - */ - void monomial_bounds::propagate_bound(lpvar v, lp::lconstraint_kind cmp, rational const& q, u_dependency* d) { - SASSERT(cmp != llc::EQ && cmp != llc::NE); - if (!c().var_is_int(v)) - c().lra.update_column_type_and_bound(v, cmp, q, d); - else if (q.is_int()) { - if (cmp == llc::GT) - c().lra.update_column_type_and_bound(v, llc::GE, q + 1, d); - else if(cmp == llc::LT) - c().lra.update_column_type_and_bound(v, llc::LE, q - 1, d); - else - c().lra.update_column_type_and_bound(v, cmp, q, d); - } - else if (cmp == llc::GE || cmp == llc::GT) - c().lra.update_column_type_and_bound(v, llc::GE, ceil(q), d); - else - c().lra.update_column_type_and_bound(v, llc::LE, floor(q), d); - } - - - /** - * val(v)^p should be in range. - * if val(v)^p > upper(range) add - * v <= root(p, upper(range)) and v >= -root(p, upper(range)) if p is even - * v <= root(p, upper(range)) if p is odd - * if val(v)^p < lower(range) add - * v >= root(p, lower(range)) or v <= -root(p, lower(range)) if p is even - * v >= root(p, lower(range)) if p is odd - */ - - bool monomial_bounds::propagate_value(dep_interval& range, lpvar v, unsigned p) { - SASSERT(p > 0); - if (p == 1) - return propagate_value(range, v); - rational r; - if (should_propagate_upper(range, v, p)) { // v.upper^p > range.upper - lp::explanation ex; - dep.get_upper_dep(range, ex); - // p even, range.upper < 0, v^p >= 0 -> infeasible - if (p % 2 == 0 && rational(dep.upper(range)).is_neg()) { - ++c().lra.settings().stats().m_nla_propagate_bounds; - lemma_builder lemma(c(), "range requires a non-negative upper bound"); - lemma &= ex; - return true; - } - - if (rational(dep.upper(range)).root(p, r)) { - // v = -2, [-4,-3]^3 < v^3 -> add bound v <= -3 - // v = -2, [-1,+1]^2 < v^2 -> add bound v >= -1 - - if ((p % 2 == 1) || c().val(v).is_pos()) { - ++c().lra.settings().stats().m_nla_propagate_bounds; - auto le = dep.upper_is_open(range) ? llc::LT : llc::LE; - lemma_builder lemma(c(), "propagate value - root case - upper bound of range is below value"); - lemma &= ex; - lemma |= ineq(v, le, r); - return true; - } - - if (p % 2 == 0 && c().val(v).is_neg()) { - ++c().lra.settings().stats().m_nla_propagate_bounds; - SASSERT(!r.is_neg()); - auto ge = dep.upper_is_open(range) ? llc::GT : llc::GE; - lemma_builder lemma(c(), "propagate value - root case - upper bound of range is below negative value"); - lemma &= ex; - lemma |= ineq(v, ge, -r); - return true; - } - } - } - - if (should_propagate_lower(range, v, p)) { // v.lower^p < range.lower - // - // range.lower < 0 -> v.lower >= root(p, range.lower) - // range.lower >= 0, p odd -> v.lower >= root(p, range.lower) - // range.lower >= 0, p even, v.lower >= 0 -> v.lower >= root(p, range.lower) - // default: - // v.lower >= root(p, range.lower) || (p even & v.upper <= -root(p, range.lower)) - // - // pre-condition: p even -> range.lower >= 0 - // - if (rational(dep.lower(range)).root(p, r)) { - ++c().lra.settings().stats().m_nla_propagate_bounds; - auto ge = dep.lower_is_open(range) ? llc::GT : llc::GE; - auto le = dep.lower_is_open(range) ? llc::LT : llc::LE; - lp::explanation ex; - dep.get_lower_dep(range, ex); - lemma_builder lemma(c(), "propagate value - root case - lower bound of range is above value"); - lemma &= ex; - lemma |= ineq(v, ge, r); - if (p % 2 == 0) - lemma |= ineq(v, le, -r); - return true; - } - } - return false; - } - - void monomial_bounds::var2interval(lpvar v, scoped_dep_interval& i) { - u_dependency* d = nullptr; + void monomial_bounds::var2interval(lpvar v, scoped_dep_interval &i) { + u_dependency *d = nullptr; rational bound; bool is_strict; if (c().has_lower_bound(v, d, bound, is_strict)) { @@ -269,7 +83,7 @@ namespace nla { if (c().has_upper_bound(v, d, bound, is_strict)) { dep.set_upper_is_open(i, is_strict); dep.set_upper(i, bound); - dep.set_upper_dep(i, d); + dep.set_upper_dep(i, d); dep.set_upper_is_inf(i, false); } else { @@ -278,55 +92,72 @@ namespace nla { } /** - * Propagate bounds for monomial 'm'. - * For each variable v in m, compute the intervals of the remaining variables in m. - * Compute also the interval for m.var() as mi - * If the value of v is outside of mi / product_of_other, add a bounds lemma. - * If the value of m.var() is outside of product_of_all_vars, add a bounds lemma. + * Interval-based lemma generation for monomial 'm'. + * Runs the shared-factor (sandwich) and binomial-sign propagators. + * These emit lemmas; they do not tighten LP bounds. */ - bool monomial_bounds::propagate(monic const& m) { + bool monomial_bounds::generate_lemma(monic const &m) { unsigned num_free, power; lpvar free_var; analyze_monomial(m, num_free, free_var, power); - bool do_propagate_up = num_free == 0; + bool do_propagate_down = !is_free(m.var()) && num_free <= 1; + if (do_propagate_down && c().params().arith_nl_monomial_sandwich() && propagate_shared_factor(m)) + return true; + if (c().params().arith_nl_monomial_binomial_sign() && propagate_binomial_sign(m)) + return true; + return false; + } + + /** + * LP-bound tightening for monomial 'm'. + * For each variable v in m, divide the interval of m.var() by the product of + * the other variables and strengthen v's LP bounds (down-propagation). + * Finally strengthen the LP bounds of m.var() from the product interval. + * Unlike generate_lemma(), this emits no lemmas -- it only tightens LP bounds. + */ + bool monomial_bounds::tighten_lp(monic const &m) { + unsigned num_free, power; + lpvar free_var; + analyze_monomial(m, num_free, free_var, power); + bool do_propagate_up = num_free == 0; bool do_propagate_down = !is_free(m.var()) && num_free <= 1; if (!do_propagate_up && !do_propagate_down) return false; + scoped_dep_interval product(dep); scoped_dep_interval vi(dep), mi(dep); scoped_dep_interval other_product(dep); var2interval(m.var(), mi); dep.set_value(product, rational::one()); - for (unsigned i = 0; i < m.size(); ) { + bool tightened = false; + for (unsigned i = 0; i < m.size();) { lpvar v = m.vars()[i]; ++i; - for (power = 1; i < m.size() && v == m.vars()[i]; ++i, ++power); + for (power = 1; i < m.size() && v == m.vars()[i]; ++i, ++power) + ; var2interval(v, vi); - dep.power(vi, power, vi); + dep.power(vi, power, vi); if (do_propagate_down && (num_free == 0 || free_var == v)) { dep.set(other_product, product); compute_product(i, m, other_product); - if (propagate_down(m, mi, v, power, other_product)) - return true; + if (tighten_lp_bound(mi, v, power, other_product)) + tightened = true; } dep.mul(product, vi, product); } - if (do_propagate_down && c().params().arith_nl_monomial_sandwich() && - propagate_shared_factor(m)) - return true; - if (c().params().arith_nl_monomial_binomial_sign() && - propagate_binomial_sign(m)) - return true; - return do_propagate_up && propagate_value(product, m.var()); + if (!do_propagate_up) + return tightened; + return tighten_lp_bound(product, m.var(), 1) || tightened; } - bool monomial_bounds::propagate_down(monic const& m, dep_interval& mi, lpvar v, unsigned power, dep_interval& product) { - if (!dep.separated_from_zero(product)) + bool monomial_bounds::tighten_lp_bound(dep_interval &mi, lpvar v, unsigned power, + dep_interval &product) { + if (!dep.separated_from_zero(product)) return false; scoped_dep_interval range(dep); dep.div(mi, product, range); - return propagate_value(range, v, power); + return tighten_lp_bound(range, v, power); } bool monomial_bounds::is_free(lpvar v) const { @@ -368,17 +199,20 @@ namespace nla { } } - void monomial_bounds::unit_propagate() { + bool monomial_bounds::propagate_changed_bounds() { + bool propagated = false; for (lpvar v : c().m_monics_with_changed_bounds) { if (!c().is_monic_var(v)) continue; monic& m = c().emon(v); - unit_propagate(m); - if (add_lemma()) - break; - if (c().m_conflicts > 0) + if (propagate_changed_bound(m)) + propagated = true; + if (tighten_lp(m)) + propagated = true; + if (c().lra.get_status() == lp::lp_status::INFEASIBLE) break; } + return propagated; } bool monomial_bounds::add_lemma() { @@ -391,27 +225,30 @@ namespace nla { return true; } - void monomial_bounds::unit_propagate(monic & m) { + bool monomial_bounds::propagate_changed_bound(monic & m) { if (m.is_propagated()) - return; + return false; lpvar w, fixed_to_zero; if (!is_linear(m, w, fixed_to_zero)) - return; + return false; c().emons().set_propagated(m); + bool propagated = false; if (fixed_to_zero != null_lpvar) { - propagate_fixed_to_zero(m, fixed_to_zero); + propagated = propagate_fixed_to_zero(m, fixed_to_zero); } else { rational k = fixed_var_product(m, w); if (w == null_lpvar) - propagate_fixed(m, k); + propagated = propagate_fixed(m, k); else - propagate_nonfixed(m, k, w); + propagated = propagate_nonfixed(m, k, w); } - ++c().lra.settings().stats().m_nla_propagate_eq; + if (propagated) + ++c().lra.settings().stats().m_nla_propagate_eq; + return propagated; } lp::explanation monomial_bounds::get_explanation(u_dependency* dep) { @@ -423,25 +260,33 @@ namespace nla { return exp; } - void monomial_bounds::propagate_fixed_to_zero(monic const& m, lpvar fixed_to_zero) { + bool monomial_bounds::propagate_fixed_to_zero(monic const& m, lpvar fixed_to_zero) { + if (c().var_is_fixed_to_zero(m.var())) + return false; auto* dep = c().lra.get_bound_constraint_witnesses_for_column(fixed_to_zero); TRACE(nla_solver, tout << "propagate fixed " << m << " = 0, fixed_to_zero = " << fixed_to_zero << "\n";); c().lra.update_column_type_and_bound(m.var(), lp::lconstraint_kind::EQ, rational(0), dep); // propagate fixed equality c().add_fixed_equality(m.var(), rational(0), get_explanation(dep)); + return true; } - void monomial_bounds::propagate_fixed(monic const& m, rational const& k) { + bool monomial_bounds::propagate_fixed(monic const& m, rational const& k) { + if (c().var_is_fixed(m.var()) && c().get_lower_bound(m.var()) == k) + return false; auto* dep = explain_fixed(m, k); TRACE(nla_solver, tout << "propagate fixed " << m << " = " << k << "\n";); c().lra.update_column_type_and_bound(m.var(), lp::lconstraint_kind::EQ, k, dep); // propagate fixed equality c().add_fixed_equality(m.var(), k, get_explanation(dep)); + return true; } - void monomial_bounds::propagate_nonfixed(monic const& m, rational const& k, lpvar w) { + bool monomial_bounds::propagate_nonfixed(monic const& m, rational const& k, lpvar w) { + if (c().val(m.var()) == k * c().val(w)) + return false; vector> coeffs; coeffs.push_back({-k, w}); coeffs.push_back({rational::one(), m.var()}); @@ -453,6 +298,7 @@ namespace nla { if (k == 1) { c().add_equality(m.var(), w, get_explanation(dep)); } + return true; } u_dependency* monomial_bounds::explain_fixed(monic const& m, rational const& k) { @@ -506,13 +352,6 @@ namespace nla { return r; } - lpvar monomial_bounds::non_fixed_var(monic const& m) { - for (lpvar v : m) - if (!c().var_is_fixed(v)) - return v; - return null_lpvar; - } - /** * Dual-row shared-factor sandwich. For a binary monomial m = u*v, find LP * term columns whose term has shape a_m * m + a_v * v (exactly two @@ -592,7 +431,7 @@ namespace nla { << " m=" << m.var() << " v=" << v << " u=" << u << " a_m=" << a_m << " a_v=" << a_v << "\n";); - if (propagate_value(u_int, u)) + if (tighten_lp_bound(u_int, u, 1)) return true; // one lemma per call to keep the channel quiet } return false; @@ -698,5 +537,522 @@ namespace nla { return try_anchor(f1, f0) || try_anchor(f0, f1); } + /** + * range is an interval that v^p is guaranteed to lie in. + * Strengthen the *upper* bound of v from range, analogously to the upper + * branch of propagate_value(range, v, p), but only when a single bound on v + * follows (no lemmas). We use the existing bounds of v -- not its value -- + * to resolve the sign for even powers. + * + * An upper bound on v is implied by: + * range.upper = U: + * p odd -> v <= root(p, U) + * p even, U >= 0 -> v <= root(p, U) (|v| <= root(p, U)) + * range.lower = L, p even, v known <= 0: + * v <= -root(p, L) (resolves the disjunction) + * Only exact rational roots are used, so bounds that are not obtained from + * propagation are out of scope. + */ + bool monomial_bounds::tighten_lp_upper_bound(dep_interval const &range, lpvar v, unsigned p) { + SASSERT(p > 0); + auto improves_upper = [&](rational const& cand) { + return !c().has_upper_bound(v) || cand < c().get_upper_bound(v); + }; + bool tightened = false; + rational r; + // From range.upper: v <= root(p, U). + if (!dep.upper_is_inf(range)) { + rational U(dep.upper(range)); + if (U.root(p, r) && improves_upper(r)) { + auto cmp = dep.upper_is_open(range) ? llc::LT : llc::LE; + propagate_lp_bound(v, cmp, r, dep.get_upper_dep(range)); + tightened = true; + } + } + // Even power, v known non-positive: range.lower gives v <= -root(p, L). + if ((p & 1) == 0 && !dep.lower_is_inf(range) && + c().has_upper_bound(v) && !c().get_upper_bound(v).is_pos()) { + rational L(dep.lower(range)); + if (!L.is_neg() && L.root(p, r) && improves_upper(-r)) { + auto cmp = dep.lower_is_open(range) ? llc::LT : llc::LE; + u_dependency* d = c().lra.join_deps(dep.get_lower_dep(range), + c().lra.get_column_upper_bound_witness(v)); + propagate_lp_bound(v, cmp, -r, d); + tightened = true; + } + } + return tightened; + } + + /** + * range is an interval that v^p is guaranteed to lie in. + * Strengthen the *lower* bound of v from range (mirror of the above). + * + * A lower bound on v is implied by: + * range.lower = L: + * p odd -> v >= root(p, L) + * range.upper = U, p even, U >= 0: + * v >= -root(p, U) (|v| <= root(p, U)) + * range.lower = L, p even, v known >= 0: + * v >= root(p, L) (resolves the disjunction) + */ + bool monomial_bounds::tighten_lp_lower_bound(dep_interval const &range, lpvar v, unsigned p) { + SASSERT(p > 0); + auto improves_lower = [&](rational const& cand) { + return !c().has_lower_bound(v) || cand > c().get_lower_bound(v); + }; + bool tightened = false; + rational r; + if ((p & 1) == 1) { + // From range.lower: v >= root(p, L). + if (!dep.lower_is_inf(range)) { + rational L(dep.lower(range)); + if (L.root(p, r) && improves_lower(r)) { + auto cmp = dep.lower_is_open(range) ? llc::GT : llc::GE; + propagate_lp_bound(v, cmp, r, dep.get_lower_dep(range)); + tightened = true; + } + } + return tightened; + } + // Even power. From range.upper: v >= -root(p, U). + if (!dep.upper_is_inf(range)) { + rational U(dep.upper(range)); + if (!U.is_neg() && U.root(p, r) && improves_lower(-r)) { + auto cmp = dep.upper_is_open(range) ? llc::GT : llc::GE; + propagate_lp_bound(v, cmp, -r, dep.get_upper_dep(range)); + tightened = true; + } + } + // Even power, v known non-negative: range.lower gives v >= root(p, L). + if (!dep.lower_is_inf(range) && + c().has_lower_bound(v) && !c().get_lower_bound(v).is_neg()) { + rational L(dep.lower(range)); + if (!L.is_neg() && L.root(p, r) && improves_lower(r)) { + auto cmp = dep.lower_is_open(range) ? llc::GT : llc::GE; + u_dependency* d = c().lra.join_deps(dep.get_lower_dep(range), + c().lra.get_column_lower_bound_witness(v)); + propagate_lp_bound(v, cmp, r, d); + tightened = true; + } + } + return tightened; + } + + /** + * Ensure that bounds are integral when the variable is integer. + */ + void monomial_bounds::propagate_lp_bound(lpvar v, lp::lconstraint_kind cmp, rational const &q, u_dependency *d) { + SASSERT(cmp != llc::EQ && cmp != llc::NE); + if (!c().var_is_int(v)) + c().lra.update_column_type_and_bound(v, cmp, q, d); + else if (q.is_int()) { + if (cmp == llc::GT) + c().lra.update_column_type_and_bound(v, llc::GE, q + 1, d); + else if (cmp == llc::LT) + c().lra.update_column_type_and_bound(v, llc::LE, q - 1, d); + else + c().lra.update_column_type_and_bound(v, cmp, q, d); + } + else if (cmp == llc::GE || cmp == llc::GT) + c().lra.update_column_type_and_bound(v, llc::GE, ceil(q), d); + else + c().lra.update_column_type_and_bound(v, llc::LE, floor(q), d); + } + + bool monomial_bounds::tighten_lp_bound(dep_interval const &range, lpvar v, unsigned power) { + bool propagated = false; + if (tighten_lp_upper_bound(range, v, power)) + propagated = true; + if (tighten_lp_lower_bound(range, v, power)) + propagated = true; + return propagated; + } + + bool monomial_bounds::tighten_lp_bounds() { + bool new_bound = false; + for (auto &m : c().emons()) + if (tighten_lp(m)) + new_bound = true; + return new_bound; + } + + // ================================================================ + // max_min: incremental LP bound optimization. + // + // A direct adaptation of smt::theory_arith::max_min (see + // src/smt/theory_arith_aux.h). We maximize (or minimize) a single + // column 'v' over the current LP tableau by a bounded-effort primal + // simplex walk: repeatedly pick a non-basic variable that improves the + // objective, ratio-test its column to find the tightest blocking basic + // variable, and pivot. The tableau is left at a feasible vertex; the + // implied bound is then read off 'v's tableau row and rounded to respect + // the integrality of integer columns. + // + // Integrality is maintained during the walk (the 'maintain_integrality == + // true' configuration of theory_arith): every move of a column is a multiple + // of the integrality quantum 'min_gain', so integer columns keep integral + // values throughout. The final implied bound is additionally floored/ceiled + // for integer 'v'. + // ================================================================ + + static lp::impq mm_abs(lp::impq const& v) { + return v.is_neg() ? -v : v; + } + + // Round 'val' down to the nearest multiple of the (integral) 'divisor'. + // Mirrors theory_arith::normalize_gain. 'divisor == -1' means "no quantum". + static void mm_round_down(lp::impq& val, rational const& divisor) { + if (divisor.is_one()) + val = lp::impq(lp::floor(val)); + else if (!divisor.is_minus_one()) + val = lp::impq(lp::floor(val / divisor) * divisor); + } + + lpvar monomial_bounds::mm_basic_in_row(unsigned row) const { + return c().lra.get_base_column_in_row(row); + } + + // A gain is safe when the column is unbounded in the chosen direction, or + // the required integral quantum still fits within the maximal feasible move. + // Mirrors theory_arith::safe_gain. + bool monomial_bounds::mm_safe_gain(mm_gain const& g) const { + return g.unbounded || lp::impq(g.min_gain) <= g.max_gain; + } + + // Initialize the gain for moving 'x' in direction 'inc' (increase when inc, + // decrease otherwise) from its own bound. For integer columns the quantum + // 'min_gain' starts at 1. Mirrors theory_arith::init_gains. + monomial_bounds::mm_gain monomial_bounds::mm_init_gains(lpvar x, bool inc) const { + auto& s = c().lra; + mm_gain g; + if (inc && s.column_has_upper_bound(x)) { + g.unbounded = false; + g.max_gain = s.column_upper_bound(x) - s.get_column_value(x); + } + else if (!inc && s.column_has_lower_bound(x)) { + g.unbounded = false; + g.max_gain = s.get_column_value(x) - s.column_lower_bound(x); + } + if (s.column_is_int(x)) + g.min_gain = rational::one(); + return g; + } + + // Tighten 'g' by the room that basic variable 'x_i' (with coefficient 'a_ij' + // on the moving column) has before hitting a bound. When 'x_i' is an integer + // column, the quantum 'min_gain' is raised to the lcm of the denominators of + // the involved coefficients and both gains are rounded down to that quantum, + // so the move keeps 'x_i' integral. Returns true when 'max_gain' was + // strengthened. Mirrors theory_arith::update_gains. + bool monomial_bounds::mm_update_gains(bool inc, lpvar x_i, rational const& a_ij, mm_gain& g) const { + auto& s = c().lra; + SASSERT(!a_ij.is_zero()); + if (!mm_safe_gain(g)) + return false; + + bool decrement_x_i = (inc && a_ij.is_pos()) || (!inc && a_ij.is_neg()); + bool bounded_i = false; + lp::impq max_inc; + if (decrement_x_i && s.column_has_lower_bound(x_i)) { + max_inc = mm_abs((s.get_column_value(x_i) - s.column_lower_bound(x_i)) / a_ij); + bounded_i = true; + } + else if (!decrement_x_i && s.column_has_upper_bound(x_i)) { + max_inc = mm_abs((s.column_upper_bound(x_i) - s.get_column_value(x_i)) / a_ij); + bounded_i = true; + } + + bool xi_int = s.column_is_int(x_i); + rational den_aij(1); + if (xi_int) + den_aij = denominator(a_ij); + SASSERT(den_aij.is_pos() && den_aij.is_int()); + + // Moving 'x_i' by k requires moving the entering column by k/a_ij; to keep + // an integer 'x_i' integral the entering column must step in multiples of + // denominator(a_ij). Accumulate that into the quantum and re-round. + if (xi_int && !den_aij.is_one()) { + if (g.min_gain.is_neg()) + g.min_gain = den_aij; + else + g.min_gain = lcm(g.min_gain, den_aij); + if (!g.unbounded) + mm_round_down(g.max_gain, g.min_gain); + } + if (xi_int && !g.unbounded && !g.max_gain.is_int()) { + g.max_gain = lp::impq(lp::floor(g.max_gain)); + mm_round_down(g.max_gain, g.min_gain); + } + + if (bounded_i) { + if (xi_int) { + max_inc = lp::impq(lp::floor(max_inc)); + mm_round_down(max_inc, g.min_gain); + } + if (g.unbounded) { + g.unbounded = false; + g.max_gain = max_inc; + return true; + } + if (g.max_gain > max_inc) { + g.max_gain = max_inc; + return true; + } + } + return false; + } + + // Ratio test: for entering column 'x_j' moving in direction 'inc', find the + // basic variable 'x_i' that first blocks the move and the maximal gain. + // Returns false (unsafe) when the integrality quantum cannot be satisfied, so + // the caller treats 'x_j' as unusable. Mirrors theory_arith::pick_var_to_leave. + bool monomial_bounds::mm_pick_var_to_leave(lpvar x_j, bool inc, rational& a_ij, mm_gain& g, lpvar& x_i) const { + auto& s = c().lra; + x_i = null_lpvar; + g = mm_init_gains(x_j, inc); + // an integer entering column must sit at an integral value to move in + // integral steps. + if (s.column_is_int(x_j) && !s.get_column_value(x_j).is_int()) + return false; + for (auto const& cell : s.A_r().m_columns[x_j]) { + lpvar si = mm_basic_in_row(cell.var()); + rational const& coeff_ij = s.A_r().get_val(cell); + if (mm_update_gains(inc, si, coeff_ij, g) || + (x_i == null_lpvar && !g.unbounded)) { + x_i = si; + a_ij = coeff_ij; + } + } + return mm_safe_gain(g); + } + + // Apply 'delta' to non-basic column 'j', propagating to dependent basic + // columns (theory_arith::update_value). + void monomial_bounds::mm_update_value(lpvar j, lp::impq const& delta) { + if (delta.is_zero()) + return; + auto& s = c().lra; + lp::impq new_val = s.get_column_value(j) + delta; + s.set_value_for_nbasic_column_report(j, new_val, [](unsigned) {}); + } + + // Move (now non-basic) 'x_i' maximally towards its bound in direction 'inc' + // without violating other columns' bounds, in integral steps when 'x_i' is an + // integer column (theory_arith::move_to_bound). + bool monomial_bounds::mm_move_to_bound(lpvar x_i, bool inc, unsigned& best_efforts) { + auto& s = c().lra; + if (s.column_is_int(x_i) && !s.get_column_value(x_i).is_int()) { + ++best_efforts; + return false; + } + mm_gain g = mm_init_gains(x_i, inc); + for (auto const& cell : s.A_r().m_columns[x_i]) { + lpvar si = mm_basic_in_row(cell.var()); + rational const& coeff = s.A_r().get_val(cell); + mm_update_gains(inc, si, coeff, g); + } + bool result = false; + if (mm_safe_gain(g) && !g.unbounded) { + lp::impq step = g.max_gain; + if (!inc) + step = -step; + mm_update_value(x_i, step); + result = !g.max_gain.is_zero(); + } + if (!result) + ++best_efforts; + return result; + } + + // Primal-simplex walk maximizing/minimizing 'v' (theory_arith::max_min). + void monomial_bounds::mm_optimize(lpvar v, bool maximize) { + auto& s = c().lra; + unsigned best_efforts = 0; + unsigned const max_efforts = 20; + unsigned rounds = 0; + unsigned const max_rounds = 200; + + while (best_efforts < max_efforts && rounds < max_rounds && !c().lp_settings().get_cancel_flag()) { + ++rounds; + lpvar x_j = null_lpvar, x_i = null_lpvar; + rational a_ij(0); + mm_gain best; // gain of the selected move + bool inc = false; + bool has_bound = false; + + // Consider a candidate entering variable 'cand' whose coefficient in + // the objective (v expressed over the non-basic columns) is + // 'obj_coeff'. Returns true to stop scanning (unbounded direction). + auto consider = [&](lpvar cand, rational const& obj_coeff) -> bool { + bool curr_inc = obj_coeff.is_pos() ? maximize : !maximize; + if ((curr_inc && s.column_has_upper_bound(cand)) || + (!curr_inc && s.column_has_lower_bound(cand))) + has_bound = true; + // cannot move a variable already at the relevant bound + if (curr_inc && s.column_has_upper_bound(cand) && + s.get_column_value(cand) == s.column_upper_bound(cand)) + return false; + if (!curr_inc && s.column_has_lower_bound(cand) && + s.get_column_value(cand) == s.column_lower_bound(cand)) + return false; + rational curr_a(0); + mm_gain cur; + lpvar curr_xi = null_lpvar; + bool safe = mm_pick_var_to_leave(cand, curr_inc, curr_a, cur, curr_xi); + if (!safe) { + // the integrality quantum cannot be met on this column + has_bound = true; + ++best_efforts; + return false; + } + if (curr_xi == null_lpvar) { + // limited only by its own bound (or fully unbounded) + x_j = cand; x_i = null_lpvar; inc = curr_inc; best = cur; a_ij = curr_a; + return true; + } + if (cur.max_gain > best.max_gain) { + x_i = curr_xi; x_j = cand; a_ij = curr_a; best = cur; inc = curr_inc; + } + else if (cur.max_gain.is_zero() && (x_i == null_lpvar || curr_xi < x_i)) { + x_i = curr_xi; x_j = cand; a_ij = curr_a; best = cur; inc = curr_inc; + } + return false; + }; + + if (!s.is_base(v)) { + consider(v, rational::one()); + } + else { + unsigned ri = s.r_heading()[v]; + rational a_v(0); + for (auto const& e : s.A_r().m_rows[ri]) + if (e.var() == v) { a_v = e.coeff(); break; } + for (auto const& e : s.A_r().m_rows[ri]) { + if (e.var() == v) + continue; + // v = -(1/a_v) * sum a_e x_e, so d(v)/d(x_e) has the sign of + // -a_e/a_v; only the sign steers the search direction. + rational objc = -e.coeff(); + if (a_v.is_neg()) + objc.neg(); + if (consider(e.var(), objc)) + break; + } + } + + if (!has_bound && x_i == null_lpvar && x_j == null_lpvar) + return; // objective is unbounded in the chosen direction + if (x_j == null_lpvar) + return; // optimized: no improving move remains + + // a non-unit integral quantum means the exact optimum may not be + // reachable in integral steps: count it as best-effort progress. + if (best.min_gain.is_pos() && !best.min_gain.is_one()) + ++best_efforts; + + if (x_i == null_lpvar) { + // move x_j directly to its own bound + if (inc && s.column_has_upper_bound(x_j)) { + if (best.max_gain.is_zero()) + return; + mm_update_value(x_j, best.max_gain); + continue; + } + if (!inc && s.column_has_lower_bound(x_j)) { + if (best.max_gain.is_zero()) + return; + mm_update_value(x_j, -best.max_gain); + continue; + } + return; // unbounded + } + + // x_j can move exactly across to its opposite bound without pivoting + if (s.column_has_lower_bound(x_j) && s.column_has_upper_bound(x_j) && + s.column_lower_bound(x_j) != s.column_upper_bound(x_j) && + (s.column_upper_bound(x_j) - s.column_lower_bound(x_j) == best.max_gain)) { + lp::impq step = best.max_gain; + if (!inc) + step = -step; + mm_update_value(x_j, step); + continue; + } + + // pivot x_j into the basis (x_i leaves); the degenerate pivot keeps + // the current point, then move x_i to its bound to raise v. + s.pivot(x_j, x_i); + bool inc_xi = inc ? a_ij.is_neg() : a_ij.is_pos(); + mm_move_to_bound(x_i, inc_xi, best_efforts); + } + } + + // Read the implied bound on 'v' off its final tableau row and round it to + // respect the integrality of integer columns (theory_arith::mk_bound_from_row + // + normalize_bound). Returns the joined explanation, or nullptr if no bound + // is implied (e.g. a required bound on a row variable is missing). + u_dependency* monomial_bounds::mm_bound_from_row(lpvar v, bool maximize, rational& bound) { + auto& s = c().lra; + if (!s.is_base(v)) + return nullptr; + unsigned ri = s.r_heading()[v]; + auto const& row = s.A_r().m_rows[ri]; + rational a_v(0); + for (auto const& e : row) + if (e.var() == v) { a_v = e.coeff(); break; } + if (a_v.is_zero()) + return nullptr; + lp::impq acc(0); + u_dependency* dep = nullptr; + for (auto const& e : row) { + if (e.var() == v) + continue; + lpvar k = e.var(); + rational ck = -e.coeff() / a_v; // v = sum ck * x_k + if (ck.is_zero()) + continue; + bool use_upper = maximize ? ck.is_pos() : ck.is_neg(); + if (use_upper) { + if (!s.column_has_upper_bound(k)) + return nullptr; + acc += s.column_upper_bound(k) * ck; + dep = s.join_deps(dep, s.get_column_upper_bound_witness(k)); + } + else { + if (!s.column_has_lower_bound(k)) + return nullptr; + acc += s.column_lower_bound(k) * ck; + dep = s.join_deps(dep, s.get_column_lower_bound_witness(k)); + } + } + if (s.column_is_int(v)) + bound = maximize ? lp::floor(acc) : lp::ceil(acc); + else + bound = acc.x; + return dep; + } + + u_dependency* monomial_bounds::improve_bound(lpvar j, bool is_lower, rational& bound) { + auto& s = c().lra; + if (!s.is_feasible()) + return nullptr; + bool maximize = !is_lower; + mm_optimize(j, maximize); + rational b(0); + u_dependency* dep = mm_bound_from_row(j, maximize, b); + if (!dep) + return nullptr; + if (is_lower) { + if (s.column_has_lower_bound(j) && b <= s.column_lower_bound(j).x) + return nullptr; + } + else { + if (s.column_has_upper_bound(j) && b >= s.column_upper_bound(j).x) + return nullptr; + } + bound = b; + return dep; + } + } diff --git a/src/math/lp/monomial_bounds.h b/src/math/lp/monomial_bounds.h index 564fda6987..cc9738eb07 100644 --- a/src/math/lp/monomial_bounds.h +++ b/src/math/lp/monomial_bounds.h @@ -17,22 +17,27 @@ namespace nla { class monomial_bounds : common { dep_intervals& dep; + bool tighten_lp_bound(dep_interval const &range, lpvar v, unsigned p); + bool tighten_lp_upper_bound(dep_interval const& range, lpvar v, unsigned p); + bool tighten_lp_lower_bound(dep_interval const& range, lpvar v, unsigned p); + bool tighten_lp_bound(dep_interval &mi, lpvar v, unsigned power, dep_interval &product); + + void propagate_lp_bound(lpvar v, lp::lconstraint_kind cmp, rational const &q, u_dependency *d); + + bool should_propagate_lower(dep_interval const& range, lpvar v, unsigned p); bool should_propagate_upper(dep_interval const& range, lpvar v, unsigned p); - void propagate_bound(lpvar v, lp::lconstraint_kind cmp, rational const& q, u_dependency* d); + void var2interval(lpvar v, scoped_dep_interval& i); bool is_too_big(mpq const& q) const; - bool propagate_down(monic const& m, lpvar u); - bool propagate_value(dep_interval& range, lpvar v); - bool propagate_value(dep_interval& range, lpvar v, unsigned power); void compute_product(unsigned start, monic const& m, scoped_dep_interval& i); - bool propagate(monic const& m); - void propagate_fixed_to_zero(monic const& m, lpvar fixed_to_zero); - void propagate_fixed(monic const& m, rational const& k); - void propagate_nonfixed(monic const& m, rational const& k, lpvar w); + bool generate_lemma(monic const& m); + bool tighten_lp(monic const& m); + bool propagate_fixed_to_zero(monic const& m, lpvar fixed_to_zero); + bool propagate_fixed(monic const& m, rational const& k); + bool propagate_nonfixed(monic const& m, rational const& k, lpvar w); u_dependency* explain_fixed(monic const& m, rational const& k); lp::explanation get_explanation(u_dependency* dep); - bool propagate_down(monic const& m, dep_interval& mi, lpvar v, unsigned power, dep_interval& product); bool propagate_shared_factor(monic const& m); bool propagate_binomial_sign(monic const& m); void analyze_monomial(monic const& m, unsigned& num_free, lpvar& free_v, unsigned& power) const; @@ -40,21 +45,54 @@ namespace nla { bool is_zero(lpvar v) const; bool add_lemma(); - // monomial propagation - void unit_propagate(monic & m); + // linear-monomial equality propagation: + // when all but one variable of a monomial are fixed, the monomial is + // linear and its value/equality can be propagated into the LP solver. + bool propagate_changed_bound(monic & m); bool is_linear(monic const& m, lpvar& w, lpvar & fixed_to_zero); rational fixed_var_product(monic const& m, lpvar w); - lpvar non_fixed_var(monic const& m); - // fixed variable propagation - unsigned m_fixed_var_qhead = 0; - unsigned_vector m_fixed_var_trail; - void propagate_fixed_vars(); - void propagate_fixed_var(lpvar v); - void propagate_fixed_var(monic const& m, lpvar v); + // ---------------------------------------------------------------- + // max_min: incremental LP bound optimization. + // + // Adapted from smt::theory_arith::max_min (theory_arith_aux.h): a + // bounded-variable primal-simplex walk that maximizes/minimizes a + // single column over the current LP tableau by pivoting, leaving the + // tableau at an optimal feasible vertex. Replaces the expensive + // lar_solver::find_improved_bound (which rebuilds the objective and + // re-solves from scratch on every call) and rounds the resulting + // bound to respect the integrality of integer columns. + // ---------------------------------------------------------------- + // + // Gain of a candidate move: how far a non-basic column may travel in the + // chosen direction. 'min_gain' is the integrality quantum -- the + // smallest integral step that keeps every dependent integer column at an + // integral value (-1 means "no quantum", i.e. a rational column); + // 'max_gain' is the largest feasible step (valid only when !unbounded). + // + struct mm_gain { + bool unbounded = true; // no bound blocks the move + rational min_gain = rational::minus_one(); + lp::impq max_gain; + }; + lpvar mm_basic_in_row(unsigned row) const; + bool mm_safe_gain(mm_gain const& g) const; + mm_gain mm_init_gains(lpvar x, bool inc) const; + bool mm_update_gains(bool inc, lpvar x_i, rational const& a_ij, mm_gain& g) const; + bool mm_pick_var_to_leave(lpvar x_j, bool inc, rational& a_ij, mm_gain& g, lpvar& x_i) const; + bool mm_move_to_bound(lpvar x_i, bool inc, unsigned& best_efforts); + void mm_update_value(lpvar j, lp::impq const& delta); + void mm_optimize(lpvar v, bool maximize); + u_dependency* mm_bound_from_row(lpvar v, bool maximize, rational& bound); public: monomial_bounds(core* core); - void propagate(); - void unit_propagate(); + void generate_lemmas(); + bool tighten_lp_bounds(); + bool propagate_changed_bounds(); + + // Maximize (is_lower == false) or minimize (is_lower == true) column j + // over the LP tableau and, if the resulting bound improves j's current + // bound, return its explanation and set 'bound'; otherwise return nullptr. + u_dependency* improve_bound(lpvar j, bool is_lower, rational& bound); }; } diff --git a/src/math/lp/nla_core.cpp b/src/math/lp/nla_core.cpp index a78dfc451c..8534cfdfce 100644 --- a/src/math/lp/nla_core.cpp +++ b/src/math/lp/nla_core.cpp @@ -1299,16 +1299,17 @@ lbool core::check(unsigned level) { if (m_to_refine.empty()) return l_true; init_search(); + m_nla_satisfied = false; lbool ret = l_undef; bool run_grobner = need_run_grobner(); bool run_horner = need_run_horner(); bool run_bounds = params().arith_nl_branching(); - auto no_effect = [&]() { return ret == l_undef && !done() && m_lemmas.empty() && m_literals.empty() && !m_check_feasible; }; + auto no_effect = [&]() { return ret == l_undef && !done() && !m_nla_satisfied && m_lemmas.empty() && m_literals.empty() && !m_check_feasible; }; if (no_effect()) - m_monomial_bounds.propagate(); + m_monomial_bounds.generate_lemmas(); if (no_effect() && refine_pseudo_linear()) return l_false; @@ -1329,6 +1330,9 @@ lbool core::check(unsigned level) { return l_undef; if (!m_lemmas.empty() || !m_literals.empty() || m_check_feasible) return l_false; + // bound optimization proved all monomials consistent: goal satisfied. + if (m_nla_satisfied) + return l_true; } if (no_effect() && params().arith_nl_nra_check_assignment() && m_check_assignment_fail_cnt < params().arith_nl_nra_check_assignment_max_fail()) { @@ -1522,19 +1526,121 @@ void core::set_use_nra_model(bool m) { m_use_nra_model = m; } } + -void core::propagate() { -#if Z3DEBUG - flet f(lra.validate_blocker(), true); -#endif +bool core::propagate() { clear(); - m_monomial_bounds.unit_propagate(); + bool propagated = m_monomial_bounds.tighten_lp_bounds(); + if (m_monomial_bounds.propagate_changed_bounds()) + propagated = true; m_monics_with_changed_bounds.reset(); + if (propagated) + m_check_feasible = true; + return propagated; } +bool core::incremental_propagate() { + bool propagated = false; + clear(); + if (m_monomial_bounds.propagate_changed_bounds()) + propagated = true; + m_monics_with_changed_bounds.reset(); + if (propagated) + m_check_feasible = true; + return propagated; +} + +/** + \brief Tighten the bounds of variables occurring in nonlinear monomials by + maximizing/minimizing them over the LP tableau (analogous to theory_arith's + max_min_nl_vars). The tighter implied bounds, each carrying an LP explanation, + let the subsequent horner/cross-nested interval evaluation exclude zero and + detect a conflict that would otherwise be missed with only the propagated + bounds. +*/ +bool core::optimize_nl_bounds() { + if (!params().arith_nl_optimize_bounds() || !m_bounds_optimization_enabled) + return false; + + trail().push(value_trail(m_bounds_optimization_enabled)); + m_bounds_optimization_enabled = false; + + if (!lra.is_feasible()) + return false; + if (lra.find_feasible_solution() == lp::lp_status::INFEASIBLE) { + // find_feasible_solution moved the model; keep m_to_refine in sync. + init_to_refine(); + return false; + } + + // Gather the candidate columns: every non-fixed leaf variable that + // participates in a monomial (mirrors solver=2's max_min_nl_vars). + svector cands; + auto add = [&](lpvar j) { + if (active_var_set_contains(j)) + return; + insert_to_active_var_set(j); + if (lra.column_is_fixed(j)) + return; + cands.push_back(j); + }; + clear_active_var_set(); + for (auto const& m : m_emons) { + add(m.var()); + for (lpvar k : m.vars()) + add(k); + } + + // Throttle: the LP maximize/minimize cost scales with the number of + // candidate variables (two LP optimizations each). On large nonlinear + // problems this pass is expensive and rarely productive, so skip it when the + // candidate set exceeds the threshold (0 = unlimited). + unsigned const max_vars = params().arith_nl_optimize_bounds_lp_max_vars(); + if (max_vars != 0 && cands.size() > max_vars) + return false; + + // Collect improved bounds first (each find_improved_bound maximizes a term + // over the *unchanged* constraint set, so all improvements are valid implied + // bounds), then apply them together and re-establish feasibility once. + // Interleaving update_column_type_and_bound between the maximize calls + // corrupts the core solver's x/inf_heap (maximize_term_on_tableau issues a + // raw solve() that does not reconcile pending bound changes). + struct improved_bound { lpvar j; lp::lconstraint_kind kind; rational bound; u_dependency* dep; }; + vector improvements; + for (lpvar j : cands) { + if (!lra.is_feasible()) + break; + for (bool is_lower : { true, false }) { + rational bound; + u_dependency* dep = m_monomial_bounds.improve_bound(j, is_lower, bound); + if (!dep) + continue; + auto kind = is_lower ? lp::lconstraint_kind::GE : lp::lconstraint_kind::LE; + improvements.push_back({ j, kind, bound, dep }); + } + } + + if (improvements.empty()) { + // The exploratory simplex walk in improve_bound/mm_optimize mutated the + // LP model even though no bound was tightened. Restore a clean feasible + // model and re-calibrate m_to_refine so downstream lemma passes (grobner, + // basic_lemma) never see a stale monomial that is now consistent. + lra.find_feasible_solution(); + init_to_refine(); + return false; + } + + for (auto const& ib : improvements) + lra.update_column_type_and_bound(ib.j, ib.kind, ib.bound, ib.dep); + lra.find_feasible_solution(); + // The model changed: re-calibrate m_to_refine against the new assignment. + init_to_refine(); + return true; +} + + void core::simplify() { // in-processing simplifiation can go here, such as bounds improvements. - } bool core::is_pseudo_linear(monic const& m) const { diff --git a/src/math/lp/nla_core.h b/src/math/lp/nla_core.h index c4773ffa78..81976f07a5 100644 --- a/src/math/lp/nla_core.h +++ b/src/math/lp/nla_core.h @@ -90,6 +90,9 @@ class core { monomial_bounds m_monomial_bounds; unsigned m_conflicts; bool m_check_feasible = false; + // set when bound optimization re-calibrates m_to_refine to empty: every + // monomial is consistent under the optimized model, so the goal is satisfied. + bool m_nla_satisfied = false; horner m_horner; grobner m_grobner; emonics m_emons; @@ -108,6 +111,7 @@ class core { nla_throttle m_throttle; bool m_throttle_enabled = true; + bool m_bounds_optimization_enabled = true; @@ -118,6 +122,8 @@ class core { bool is_pseudo_linear(monic const& m) const; void refine_pseudo_linear(monic const& m); + bool optimize_nl_bounds(); + std::ostream& display_constraint_smt(std::ostream& out, unsigned id, lp::lar_base_constraint const& c) const; std::ostream& display_declarations_smt(std::ostream& out) const; @@ -406,7 +412,8 @@ public: bool no_lemmas_hold() const; - void propagate(); + bool propagate(); + bool incremental_propagate(); void simplify(); @@ -462,6 +469,9 @@ public: return m_to_refine; } + void set_nla_satisfied() { m_nla_satisfied = true; } + bool nla_satisfied() const { return m_nla_satisfied; } + }; // end of core struct pp_mon { diff --git a/src/math/lp/nla_grobner.cpp b/src/math/lp/nla_grobner.cpp index 67e5a60508..609edf96c2 100644 --- a/src/math/lp/nla_grobner.cpp +++ b/src/math/lp/nla_grobner.cpp @@ -719,6 +719,10 @@ namespace nla { TRACE(grobner, m_solver.display(tout << "horner conflict ", e) << "\n"); return true; } + if (c().params().arith_nl_grobner_perfect_squares() && add_perfect_square_conflict(e)) { + TRACE(grobner, m_solver.display(tout << "perfect-square conflict ", e) << "\n"); + return true; + } return false; } evali.get_interval(e.poly(), i_wd); @@ -736,6 +740,156 @@ namespace nla { } } + // Helpers for perfect-square conflict detection (port of theory_arith_nl's + // is_inconsistent2). Variable lists are assumed sorted ascending. + + // Return true and set root=sqrt(coeff) if (coeff, vars) is a perfect square + // a^2 * M^2 (coeff a perfect square and every variable of even multiplicity). + static bool ps_root(rational const& coeff, unsigned_vector const& vars, rational& root) { + if (vars.size() % 2 == 1) + return false; + if (!coeff.is_perfect_square(root)) + return false; + unsigned i = 0, n = vars.size(); + while (i < n) { + unsigned v = vars[i]; + unsigned power = 1; + ++i; + for (; i < n && vars[i] == v; ++i) + ++power; + if (power % 2 == 1) + return false; + } + return true; + } + + // Return true if v12/c12 is the cross term (-2ab)*M1*M2, given that + // (v1,a^2) and (v2,b^2) are perfect squares a^2*M1^2 and b^2*M2^2. + static bool ps_cross(rational const& a, unsigned_vector const& v1, + rational const& b, unsigned_vector const& v2, + rational const& c12, unsigned_vector const& v12) { + if (!c12.is_neg()) + return false; + rational c(-2); + c *= a; + c *= b; + if (c12 != c) + return false; + unsigned n1 = v1.size(), n2 = v2.size(), n12 = v12.size(); + if (n1 + n2 != n12 * 2) + return false; + unsigned i1 = 0, i2 = 0, i12 = 0; + while (true) { + bool e1 = i1 < n1, e2 = i2 < n2, e12 = i12 < n12; + if (!e1 && !e2 && !e12) + return true; + if (!e12) + return false; + unsigned x12 = v12[i12]; + if (e1 && v1[i1] == x12) { i1 += 2; ++i12; } + else if (e2 && v2[i2] == x12) { i2 += 2; ++i12; } + else return false; + } + } + + // r <- coeff * prod(var^power) over the (sorted) variable list. + template + void grobner::monomial_interval(rational const& coeff, unsigned_vector const& vars, scoped_dep_interval& r) { + auto& di = c().m_intervals.get_dep_intervals(); + di.set_value(r, coeff); + unsigned i = 0, n = vars.size(); + while (i < n) { + lpvar v = vars[i]; + unsigned power = 1; + ++i; + for (; i < n && vars[i] == v; ++i) + ++power; + scoped_dep_interval vi(di), vp(di), tmp(di); + c().m_intervals.set_var_interval(v, vi); + di.power(vi, power, vp); + di.mul(r, vp, tmp); + di.set(r, tmp); + } + } + + // Perfect-square conflict detection: within a grobner equation e = 0, find a + // triple of monomials a^2*M1^2, b^2*M2^2, -2ab*M1*M2 forming (a*M1 - b*M2)^2. + // Replace such a triple by [0, oo) when that improves the lower bound, then + // check whether the resulting interval of e separates from zero. + bool grobner::add_perfect_square_conflict(const dd::solver::equation& e) { + vector coeffs; + vector varss; + for (auto const& [coeff, vars] : e.poly()) { + unsigned_vector vs(vars); + std::sort(vs.begin(), vs.end()); + coeffs.push_back(coeff); + varss.push_back(vs); + } + unsigned num = coeffs.size(); + if (num < 3) + return false; + auto& di = c().m_intervals.get_dep_intervals(); + svector deleted; + deleted.resize(num, false); + bool found = false; + for (unsigned i = 0; i < num; ++i) { + if (deleted[i]) + continue; + rational a; + if (!ps_root(coeffs[i], varss[i], a)) + continue; + for (unsigned j = i + 1; j < num && !deleted[i]; ++j) { + if (deleted[j]) + continue; + rational b; + if (!ps_root(coeffs[j], varss[j], b)) + continue; + for (unsigned k = i + 1; k < num; ++k) { + if (k == j || deleted[k]) + continue; + if (!ps_cross(a, varss[i], b, varss[j], coeffs[k], varss[k])) + continue; + // does [0,oo) improve on the summed interval of the triple? + scoped_dep_interval Ii(di), Ij(di), Ik(di), s1(di), s2(di); + monomial_interval(coeffs[i], varss[i], Ii); + monomial_interval(coeffs[j], varss[j], Ij); + monomial_interval(coeffs[k], varss[k], Ik); + di.add(Ii, Ij, s1); + di.add(s1, Ik, s2); + if (di.lower_is_inf(s2) || rational(di.lower(s2)).is_neg()) { + deleted[i] = deleted[j] = deleted[k] = true; + found = true; + break; + } + } + } + } + if (!found) + return false; + // Rebuild the interval of e with the perfect squares replaced by [0, oo) + // (an unconditional lower bound, hence no dependency), tracking deps of + // the remaining monomials, and check whether it separates from zero. + scoped_dep_interval sum(di); + di.reset(sum); + di.set_lower_is_inf(sum, false); + di.set_lower(sum, rational::zero()); + di.set_lower_is_open(sum, false); + di.set_upper_is_inf(sum, true); + for (unsigned i = 0; i < num; ++i) { + if (deleted[i]) + continue; + scoped_dep_interval Ii(di), tmp(di); + monomial_interval(coeffs[i], varss[i], Ii); + di.add(sum, Ii, tmp); + di.set(sum, tmp); + } + std::function f = [this](const lp::explanation& expl) { + lemma_builder lemma(m_core, "pdd-perfect-square"); + lemma &= expl; + }; + return di.check_interval_for_conflict_on_zero(sum, e.dep(), f); + } + bool grobner::propagate_linear_equations() { unsigned changed = 0; m_mon2var.clear(); diff --git a/src/math/lp/nla_grobner.h b/src/math/lp/nla_grobner.h index 4119543431..62877836dc 100644 --- a/src/math/lp/nla_grobner.h +++ b/src/math/lp/nla_grobner.h @@ -75,6 +75,12 @@ namespace nla { bool add_nla_conflict(dd::solver::equation const& eq); void check_missing_propagation(dd::solver::equation const& eq); + // perfect-square conflict detection (arith.nl.grobner_perfect_squares), + // a port of theory_arith_nl's is_inconsistent2. + bool add_perfect_square_conflict(dd::solver::equation const& eq); + template + void monomial_interval(rational const& coeff, unsigned_vector const& vars, scoped_dep_interval& r); + bool equation_is_true(dd::solver::equation const& eq); // adaptive growth (gated by arith.nl.grobner_adaptive) diff --git a/src/math/lp/nla_intervals.cpp b/src/math/lp/nla_intervals.cpp index f6c15bd8b5..e374613365 100644 --- a/src/math/lp/nla_intervals.cpp +++ b/src/math/lp/nla_intervals.cpp @@ -293,7 +293,7 @@ bool intervals::interval_from_term(const nex& e, scoped_dep_interval& i) { return false; set_var_interval(j, i); - interval bi; + scoped_dep_interval bi(get_dep_intervals()); m_dep_intervals.mul(a, i, bi); m_dep_intervals.add(b, bi); m_dep_intervals.set(i, bi); diff --git a/src/math/lp/nla_solver.cpp b/src/math/lp/nla_solver.cpp index da1e1b3a95..b3c8453bdf 100644 --- a/src/math/lp/nla_solver.cpp +++ b/src/math/lp/nla_solver.cpp @@ -54,8 +54,12 @@ namespace nla { return m_core->check(level); } - void solver::propagate() { - m_core->propagate(); + bool solver::propagate() { + return m_core->propagate(); + } + + bool solver::incremental_propagate() { + return m_core->incremental_propagate(); } void solver::push(){ diff --git a/src/math/lp/nla_solver.h b/src/math/lp/nla_solver.h index 2e85bb18f4..5adb87c41c 100644 --- a/src/math/lp/nla_solver.h +++ b/src/math/lp/nla_solver.h @@ -39,7 +39,8 @@ namespace nla { void pop(unsigned scopes); bool need_check(); lbool check(unsigned level); - void propagate(); + bool propagate(); + bool incremental_propagate(); void simplify() { m_core->simplify(); } lbool check_power(lpvar r, lpvar x, lpvar y); bool is_monic_var(lpvar) const; diff --git a/src/math/lp/nra_solver.cpp b/src/math/lp/nra_solver.cpp index f5cc61ba9e..76525520ee 100644 --- a/src/math/lp/nra_solver.cpp +++ b/src/math/lp/nra_solver.cpp @@ -238,20 +238,24 @@ struct solver::imp { m_nlsat->restore_order(); m_nla_core.set_use_nra_model(true); lra.init_model(); - for (lp::constraint_index ci : lra.constraints().indices()) - if (!check_constraint(ci)) { + for (lp::constraint_index ci : lra.constraints().indices()) { + if (check_constraint(ci)) continue; + // Non-COI constraint violations are benign; only COI violations indicate a bug. + if (m_coi.constraints().contains(ci)) { IF_VERBOSE(0, verbose_stream() << "constraint " << ci << " violated\n"; lra.constraints().display(verbose_stream())); UNREACHABLE(); - return l_undef; } + return l_undef; + } for (auto const &m : m_nla_core.emons()) { - if (!check_monic(m)) { + if (check_monic(m)) continue; + if (m_coi.mons().contains(m.var())) { IF_VERBOSE(0, verbose_stream() << "monic " << m << " violated\n"; lra.constraints().display(verbose_stream())); UNREACHABLE(); - return l_undef; } + return l_undef; } break; case l_false: { diff --git a/src/math/polynomial/algebraic_numbers.cpp b/src/math/polynomial/algebraic_numbers.cpp index 47c4b66983..e741c7d8e7 100644 --- a/src/math/polynomial/algebraic_numbers.cpp +++ b/src/math/polynomial/algebraic_numbers.cpp @@ -831,11 +831,104 @@ namespace algebraic_numbers { return; } + // At this point [a, b] is an *isolating* and *refinable* interval for p: + // it contains exactly one real root of the square-free polynomial p, and + // neither endpoint is itself that root. That root could still be a + // *rational* number: unlike the general isolate_roots(), this closest-root + // path does NOT factor p, so a reducible polynomial (e.g. a product of + // linear factors) is handled whole and keeps its rational roots instead of + // exposing them as degree-1 factors. If we blindly built an algebraic_cell + // here we would create a "root object" that is really just a rational, which + // is both wasteful and, downstream, error-prone (algebraic-number comparison + // must special-case such cells). So first try to recognize a rational root + // and, if found, return it as a plain rational (basic numeral). + if (rational_root_in_interval(sz, p, a, b, r)) + return; + del(r); r = mk_algebraic_cell(sz, p, a, b, false /* minimal */); SASSERT(acell_inv(*r.to_algebraic())); } + // Decide whether the unique real root of the square-free integer polynomial p + // that lies in the isolating interval [l, u] is a rational number and, if so, + // store it in r as a basic (rational) numeral and return true. Otherwise return + // false (the root is irrational and must be represented as a root object). + // + // Notation: p(x) = a_n*x^n + ... + a_1*x + a_0 with a_i integers (mpz), a_n != 0. + // mpbq = dyadic rational (denominator is a power of two); + // mpq = arbitrary rational; mpz = integer. + // + // Preconditions (guaranteed by the caller, isolate_kth_root): + // * p is square-free, so all its roots are simple (no repeated roots). + // * [l, u] is an isolating interval: it contains EXACTLY ONE real root of p. + // This is why we may speak of "the root" in the interval. + // + // The mathematics used: + // + // 1. Rational Root Theorem. If a polynomial with integer coefficients has a + // rational root num/den, where den > 0 does not divide num, + // then den divides the leading coefficient a_n. In + // particular every rational root can be written with denominator |a_n|, + // i.e. as m/|a_n| for some integer m. We can represent the root as that m/|a_n| + // for some integer m. + // + // 2. Two distinct rationals m1/|a_n| and m2/|a_n| differ by at least 1/|a_n|. Hence if we + // first shrink [l, u] to have width < 1/|a_n|, the interval can contain at + // most one rational of the form m/|a_n| => if the + // root is rational it must equal that single candidate. + bool rational_root_in_interval(unsigned sz, mpz const * p, mpbq & l, mpbq & u, numeral & r) { + // a_n is the leading coefficient; work with its absolute value |a_n|. + mpz const & a_n = p[sz - 1]; + scoped_mpz abs_a_n(qm()); + qm().set(abs_a_n, a_n); + qm().abs(abs_a_n); + + // We need the interval width to be strictly less than 1/|a_n| + // refine() shrinks by halving, i.e. it reaches width <= 1/2^k. Choosing + // k = floor(log2(|a_n|)) + 1 + // gives 2^k > |a_n|, hence 1/2^k < 1/|a_n|, which is what we want. + unsigned k = qm().log2(abs_a_n); + k++; + + // Refine [l, u] to precision k. refine() returns false in the lucky case + // where the bisection lands *exactly* on a dyadic rational that is a root + // of p; in that case the exact root has been stored in the lower endpoint l, + // so we can return it directly as a basic rational. + if (!upm().refine(sz, p, bqm(), l, u, k)) { + scoped_mpq q(qm()); + to_mpq(qm(), l, q); + set(r, q); + return true; + } + // Otherwise refine() succeeded and [l, u] now has width < 1/|a_n|. + + // Build the unique candidate rational m/|a_n| that could lie in [l, u]. + // Scale the interval by |a_n|: [l*|a_n|, u*|a_n|] has width < 1, so it + // contains at most one integer. That integer, if any, is m = floor(u*|a_n|), + // and the candidate rational is m/|a_n|. + scoped_mpbq a_n_upper(bqm()); + bqm().mul(u, abs_a_n, a_n_upper); // a_n_upper = u * |a_n| + scoped_mpz zcandidate(qm()); + bqm().floor(qm(), a_n_upper, zcandidate); // m = floor(u * |a_n|) + scoped_mpq candidate(qm()); + qm().set(candidate, zcandidate, abs_a_n); // candidate = m / |a_n| + + // By construction candidate <= u. We still must confirm two things: + // (a) candidate is actually inside the interval, i.e. l < candidate + // (if candidate <= l then there is no rational m/|a_n| inside [l,u]); + // (b) candidate is genuinely a root, i.e. p(candidate) == 0. + // If both hold, then since the interval isolates exactly one root, that + // root equals candidate and is rational. If p(candidate) != 0, then by the + // Rational Root Theorem no rational (which would have to be m/|a_n|) is a + // root here, so the single root in the interval is irrational. + if (bqm().lt(l, candidate) && upm().eval_sign_at(sz, p, candidate) == sign_zero) { + set(r, candidate); + return true; + } + return false; + } + // Closest-root isolation for an (integer) univariate polynomial. void isolate_roots_closest_univariate(polynomial_ref const & p, mpq const & s, numeral_vector & roots, svector & indices) { SASSERT(is_univariate(p)); diff --git a/src/math/polynomial/algebraic_numbers.h b/src/math/polynomial/algebraic_numbers.h index 37c0559728..78e40fbe89 100644 --- a/src/math/polynomial/algebraic_numbers.h +++ b/src/math/polynomial/algebraic_numbers.h @@ -19,6 +19,7 @@ Notes: #pragma once #include "util/rational.h" +#include "util/manage_warnings.h" #include "util/mpq.h" #include "math/polynomial/polynomial.h" #include "util/z3_exception.h" @@ -431,12 +432,14 @@ AN_MK_COMPARISON_CORE(EXTERNAL, INTERNAL, int) \ AN_MK_COMPARISON_CORE(EXTERNAL, INTERNAL, mpz) \ AN_MK_COMPARISON_CORE(EXTERNAL, INTERNAL, mpq) +START_DISABLE_EXTRA_SEMI_WARNING; AN_MK_COMPARISON(operator==, eq); AN_MK_COMPARISON(operator!=, neq); AN_MK_COMPARISON(operator<, lt); AN_MK_COMPARISON(operator<=, le); AN_MK_COMPARISON(operator>, gt); AN_MK_COMPARISON(operator>=, ge); +END_DISABLE_WARNING; #undef AN_MK_COMPARISON #undef AN_MK_COMPARISON_CORE diff --git a/src/math/realclosure/realclosure.h b/src/math/realclosure/realclosure.h index b256ffd15b..4ba57edf9f 100644 --- a/src/math/realclosure/realclosure.h +++ b/src/math/realclosure/realclosure.h @@ -28,6 +28,7 @@ Notes: #include "math/interval/interval.h" #include "util/z3_exception.h" #include "util/rlimit.h" +#include "util/manage_warnings.h" namespace realclosure { class num; @@ -339,12 +340,14 @@ RCF_MK_COMPARISON_CORE(EXTERNAL, INTERNAL, int) \ RCF_MK_COMPARISON_CORE(EXTERNAL, INTERNAL, mpz) \ RCF_MK_COMPARISON_CORE(EXTERNAL, INTERNAL, mpq) +START_DISABLE_EXTRA_SEMI_WARNING; RCF_MK_COMPARISON(operator==, eq); RCF_MK_COMPARISON(operator!=, neq); RCF_MK_COMPARISON(operator<, lt); RCF_MK_COMPARISON(operator<=, le); RCF_MK_COMPARISON(operator>, gt); RCF_MK_COMPARISON(operator>=, ge); +END_DISABLE_WARNING; #undef RCF_MK_COMPARISON #undef RCF_MK_COMPARISON_CORE @@ -364,10 +367,12 @@ RCF_MK_BINARY_CORE(EXTERNAL, INTERNAL, int) \ RCF_MK_BINARY_CORE(EXTERNAL, INTERNAL, mpz) \ RCF_MK_BINARY_CORE(EXTERNAL, INTERNAL, mpq) -RCF_MK_BINARY(operator+, add) -RCF_MK_BINARY(operator-, sub) -RCF_MK_BINARY(operator*, mul) -RCF_MK_BINARY(operator/, div) +START_DISABLE_EXTRA_SEMI_WARNING; +RCF_MK_BINARY(operator+, add); +RCF_MK_BINARY(operator-, sub); +RCF_MK_BINARY(operator*, mul); +RCF_MK_BINARY(operator/, div); +END_DISABLE_WARNING; #undef RCF_MK_BINARY #undef RCF_MK_BINARY_CORE diff --git a/src/muz/spacer/spacer_farkas_learner.cpp b/src/muz/spacer/spacer_farkas_learner.cpp index 3016b69fe9..263cffadda 100644 --- a/src/muz/spacer/spacer_farkas_learner.cpp +++ b/src/muz/spacer/spacer_farkas_learner.cpp @@ -378,6 +378,7 @@ void farkas_learner::get_lemmas(proof* root, expr_set const& bs, expr_ref_vector INSERT(res); b_closed.mark(p, true); } + break; } default: break; diff --git a/src/opt/opt_context.cpp b/src/opt/opt_context.cpp index b3a1661d67..06b2a60a56 100644 --- a/src/opt/opt_context.cpp +++ b/src/opt/opt_context.cpp @@ -650,6 +650,7 @@ namespace opt { switch (obj.m_type) { case O_MINIMIZE: is_ge = !is_ge; + Z3_fallthrough; case O_MAXIMIZE: val = (*mdl)(obj.m_term); if (is_numeral(val, k)) { diff --git a/src/params/smt_params_helper.pyg b/src/params/smt_params_helper.pyg index 22bfb1e261..f84f08e7d0 100644 --- a/src/params/smt_params_helper.pyg +++ b/src/params/smt_params_helper.pyg @@ -93,6 +93,7 @@ def_module_params(module_name='smt', ('arith.nl.gr_q', UINT, 10, 'grobner\'s quota'), ('arith.nl.grobner_subs_fixed', UINT, 1, '0 - no subs, 1 - substitute, 2 - substitute fixed zeros only'), ('arith.nl.grobner_expand_terms', BOOL, True, 'expand terms before computing grobner basis'), + ('arith.nl.grobner_perfect_squares', BOOL, True, 'expand perfect squares with Grobner'), ('arith.nl.monomial_sandwich', BOOL, False, 'derive bound on a monomial factor by pairing two LP rows that share the other factor'), ('arith.nl.monomial_sandwich.max_fanout', UINT, 0, 'skip monomial sandwich when the conclusion factor appears in more than this many monomials (0 = no limit)'), ('arith.nl.monomial_binomial_sign', BOOL, False, 'derive bound on a binomial-monomial factor anchored on the current LP value of the monomial; replaces order_lemma_on_binomial_sign with a deterministic factor bound conditioned on a one-sided snapshot of the monomial value'), @@ -100,6 +101,7 @@ def_module_params(module_name='smt', ('arith.nl.delay', UINT, 10, 'number of calls to final check before invoking bounded nlsat check'), ('arith.nl.propagate_linear_monomials', BOOL, True, 'propagate linear monomials'), ('arith.nl.optimize_bounds', BOOL, True, 'enable bounds optimization'), + ('arith.nl.optimize_bounds_lp_max_vars', UINT, 120, 'skip LP-based nonlinear bounds optimization when the number of candidate monomial variables exceeds this threshold (0 = unlimited)'), ('arith.nl.cross_nested', BOOL, True, 'enable cross-nested consistency checking'), ('arith.nl.log', BOOL, False, 'Log lemmas sent to nra solver'), ('arith.propagate_eqs', BOOL, True, 'propagate (cheap) equalities'), @@ -155,8 +157,6 @@ def_module_params(module_name='smt', ('seq.validate', BOOL, False, 'enable self-validation of theory axioms created by seq theory'), ('seq.max_unfolding', UINT, 1000000000, 'maximal unfolding depth for checking string equations and regular expressions'), ('seq.min_unfolding', UINT, 1, 'initial bound for strings whose lengths are bounded by iterative deepening. Set this to a higher value if there are only models with larger string lengths'), - ('seq.regex_factorization_threshold', UINT, 10, 'maximum number of cases to factor a regex into in a single step'), - ('seq.regex_factorization_enabled', BOOL, False, 'apply regex factorization (sigma splitting)'), ('theory_aware_branching', BOOL, False, 'Allow the context to use extra information from theory solvers regarding literal branching prioritization.'), ('sls.enable', BOOL, False, 'enable sls co-processor with SMT engine'), ('sls.parallel', BOOL, True, 'use sls co-processor in parallel or sequential with SMT engine'), diff --git a/src/params/theory_seq_params.cpp b/src/params/theory_seq_params.cpp index 960f145a66..54bf691620 100644 --- a/src/params/theory_seq_params.cpp +++ b/src/params/theory_seq_params.cpp @@ -23,6 +23,4 @@ void theory_seq_params::updt_params(params_ref const & _p) { m_seq_validate = p.seq_validate(); m_seq_max_unfolding = p.seq_max_unfolding(); m_seq_min_unfolding = p.seq_min_unfolding(); - m_seq_regex_factorization_enabled = p.seq_regex_factorization_enabled(); - m_seq_regex_factorization_threshold = p.seq_regex_factorization_threshold(); } diff --git a/src/params/theory_seq_params.h b/src/params/theory_seq_params.h index 067a65a663..f964088eb8 100644 --- a/src/params/theory_seq_params.h +++ b/src/params/theory_seq_params.h @@ -26,8 +26,6 @@ struct theory_seq_params { bool m_seq_validate = false; unsigned m_seq_max_unfolding = UINT_MAX/4; unsigned m_seq_min_unfolding = 1; - bool m_seq_regex_factorization_enabled = false; - unsigned m_seq_regex_factorization_threshold = 1; theory_seq_params(params_ref const & p = params_ref()) { updt_params(p); diff --git a/src/parsers/util/scanner.cpp b/src/parsers/util/scanner.cpp index a10c50150e..77980cfb13 100644 --- a/src/parsers/util/scanner.cpp +++ b/src/parsers/util/scanner.cpp @@ -124,6 +124,7 @@ scanner::token scanner::read_id(char first_char) { if (!is_alpha || ch != '-') { goto bail_out; } + Z3_fallthrough; case 'a': case ':': case '.': @@ -482,7 +483,12 @@ scanner::token scanner::scan() { case '#': return read_bv_literal(); case static_cast(-1): - m_state = EOF_TOKEN; + if (m_stream.bad()) { + m_err << "ERROR: I/O failure while reading input stream.\n"; + m_state = ERROR_TOKEN; + } + else + m_state = EOF_TOKEN; break; default: // TODO: use error reporting diff --git a/src/qe/mbp/mbp_term_graph.cpp b/src/qe/mbp/mbp_term_graph.cpp index 04985c2ffe..93bbd5ef28 100644 --- a/src/qe/mbp/mbp_term_graph.cpp +++ b/src/qe/mbp/mbp_term_graph.cpp @@ -708,8 +708,18 @@ expr *term_graph::mk_app_core(expr *e) { return e; expr_ref_buffer kids(m); app *a = ::to_app(e); - for (expr *arg : *a) - kids.push_back(mk_app(arg)); + for (expr *arg : *a) { + // Keep literal values (e.g. the coefficient 2 in (* 2 x)) as-is. + // Replacing a value with its non-value class representative (e.g. x1 + // when (= x1 2) was added to the graph) can turn a linear coefficient + // into a free variable, producing a nonlinear term such as (* x1 x). + // Values are canonical and never need to be expressed through a + // symbolic representative. + if (m.is_value(arg)) + kids.push_back(arg); + else + kids.push_back(mk_app(arg)); + } app *res = m.mk_app(a->get_decl(), a->get_num_args(), kids.data()); m_pinned.push_back(res); return res; @@ -813,6 +823,18 @@ bool term_graph::term_lt(term const &t1, term const &t2) { // prefer applications over variables (for non-ground) // prefer uninterpreted constants over values // prefer smaller expressions over larger ones + // + // Keeping uninterpreted constants as representatives is required by + // model-based projection clients such as Spacer: substituting a + // non-eliminated state constant with its concrete model value over-grounds + // the projected lemma (see Z3Prover/bench discussion #3420, benchmark + // iss-5561/bug-2.smt2). + // + // The complementary concern — that a literal value used as a coefficient + // (e.g. the 2 in (* 2 x)) could be displaced by a free variable x1 when + // (= x1 2) is in scope, yielding a nonlinear term (* x1 x) — is addressed + // separately in mk_app_core, which keeps literal values as-is and never + // replaces them with a non-value representative. if (t1.get_num_args() == 0 || t2.get_num_args() == 0) { if (t1.get_num_args() == t2.get_num_args()) { diff --git a/src/qe/qe_mbp.cpp b/src/qe/qe_mbp.cpp index 57a7fee56d..15ce274b6e 100644 --- a/src/qe/qe_mbp.cpp +++ b/src/qe/qe_mbp.cpp @@ -420,6 +420,49 @@ public: e = mk_and(fmls); return any_of(subterms::all(e), [&](expr* c) { return seq.is_char(c) || seq.is_seq(c); }); } + + // The array term-graph projection (mbp_qel) treats an array equality + // (= a b) as an implicit partial array equality and eliminates it via + // class-merging. That rewrite is unsound when such an equality (or an + // array variable being eliminated) occurs *nested inside* a select/store + // *index* position, because the index is a first-class term whose value + // must be preserved and the merge can silently change it (for example + // (select va (= v va)) becomes (select v true), issues #7259, #7036). + // + // An array variable that appears *directly* as an index (e.g. the store + // index r in (store base r val)) is not affected by this rewrite: the + // index is exactly that variable and mbp_qel substitutes its model value + // soundly. Only flag the dangerous case where the variable occurs as a + // proper subterm of a compound index term. + bool has_array_var_in_index(app_ref_vector const& vars, expr* fml) { + array_util au(m); + ptr_vector arr_vars; + for (app* v : vars) + if (au.is_array(v)) + arr_vars.push_back(v); + if (arr_vars.empty()) + return false; + for (expr* t : subterms::all(expr_ref(fml, m))) { + if (!is_app(t)) + continue; + app* a = to_app(t); + bool is_sel = au.is_select(a); + bool is_st = au.is_store(a); + if (!is_sel && !is_st) + continue; + // args[0] is the array; the trailing arg of a store is the stored + // value; everything in between is an index argument. + unsigned n = a->get_num_args(); + unsigned last = is_st ? n - 1 : n; + for (unsigned i = 1; i < last; ++i) { + auto idx = a->get_arg(i); + if (any_of(arr_vars, [&](app* v) { return idx != v && occurs(v, idx); })) + return true; + } + } + return false; + } + void operator()(bool force_elim, app_ref_vector& vars, model& model, expr_ref_vector& fmls, vector* defs = nullptr) { //don't use mbp_qel on some theories where model evaluation is //incomplete This is not a limitation of qel. Fix this either by @@ -554,6 +597,15 @@ public: void spacer_qel(app_ref_vector& vars, model& mdl, expr_ref& fml) { TRACE(qe, tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";); + // The array term-graph projection is unsound when an array variable to + // be eliminated occurs inside a select/store index. Fall back to the + // classic model-based projection in that case (issues #7259, #7036). + if (has_array_var_in_index(vars, fml)) { + TRACE(qe, tout << "array var in index: using model-based projection\n";); + spacer_qe_lite(vars, mdl, fml); + return; + } + model_evaluator eval(mdl, m_params); eval.set_model_completion(true); app_ref_vector other_vars(m); @@ -562,6 +614,12 @@ public: arith_util ari_u(m); datatype_util dt_u(m); + // Remember the variables we were asked to eliminate. do_qel/qel_project + // can report a variable as eliminated (drop it from vars) while a + // simplification still leaves an occurrence of it in fml. Such a + // variable is a fresh, undeclared constant in the result (issue #10172). + app_ref_vector orig_vars(vars); + do_qel(vars, fml); qel_project(vars, mdl, fml, m_reduce_all_selects); flatten_and(fml); @@ -573,6 +631,15 @@ public: other_vars.push_back(v); } + // Recover variables that were reported eliminated but still occur in + // fml. Route them through the model-based projection/substitution below + // so they are replaced by their model values instead of leaking out as + // undeclared constants. + for (app* v : orig_vars) { + if (!vars.contains(v) && !other_vars.contains(v) && occurs(v, fml)) + other_vars.push_back(v); + } + // project reals, ints and other variables. if (!other_vars.empty()) { TRACE(qe, tout << "Other vars: " << other_vars << "\n" << mdl;); diff --git a/src/sat/sat_solver/inc_sat_solver.cpp b/src/sat/sat_solver/inc_sat_solver.cpp index c129841932..42b2d310e0 100644 --- a/src/sat/sat_solver/inc_sat_solver.cpp +++ b/src/sat/sat_solver/inc_sat_solver.cpp @@ -100,10 +100,17 @@ public: m_unknown("no reason given"), m_internalized_converted(false), m_internalized_fmls(m) { + // Establish the incremental flag on the SAT core *before* updt_params + // propagates parameters to the simplifier. The simplifier caches + // m_incremental_mode from the SAT config during its own updt_params, so + // the incremental flag must already be set; otherwise the simplifier + // keeps a stale non-incremental mode and applies variable/blocked-clause + // elimination even when the solver is meant to be reused incrementally + // (unsound model reconstruction, issue #10133). + m_solver.set_incremental(incremental_mode && !override_incremental()); updt_params(p); m_mcs.push_back(nullptr); init_preprocess(); - m_solver.set_incremental(incremental_mode && !override_incremental()); } bool override_incremental() const { @@ -1297,6 +1304,12 @@ void inc_sat_display(std::ostream& out, solver& _s, unsigned sz, expr*const* sof tactic * mk_psat_tactic(ast_manager& m, params_ref const& p) { parallel_params pp(p); if (pp.enable()) - return mk_parallel_tactic(mk_inc_sat_solver(m, p, false), p); + // The parallel (cube-and-conquer) tactic reuses this solver across many + // check_sat calls with different cube assumptions. Create it in incremental + // mode so the SAT simplifier does not apply variable/blocked-clause + // elimination: those in-processing steps are only model-sound for a single + // one-shot solve, and reusing an eliminated solver under new cube + // assumptions produces models that violate the original clauses (issue #10133). + return mk_parallel_tactic(mk_inc_sat_solver(m, p, true), p); return mk_sat_tactic(m); } diff --git a/src/sat/smt/pb_card.cpp b/src/sat/smt/pb_card.cpp index eaa994b677..f88ae499fd 100644 --- a/src/sat/smt/pb_card.cpp +++ b/src/sat/smt/pb_card.cpp @@ -51,7 +51,9 @@ namespace pb { double to_add = do_add ? 0 : 1; for (literal l : *this) { switch (s.value(l)) { - case l_true: --k; if (k == 0) return 0; + case l_true: + --k; if (k == 0) return 0; + Z3_fallthrough; case l_undef: if (do_add) to_add += literal_occs(l); ++slack; break; diff --git a/src/sat/smt/pb_pb.cpp b/src/sat/smt/pb_pb.cpp index a2cb20a895..a718e9ebde 100644 --- a/src/sat/smt/pb_pb.cpp +++ b/src/sat/smt/pb_pb.cpp @@ -95,7 +95,9 @@ namespace pb { literal l = wl.second; unsigned w = wl.first; switch (s.value(l)) { - case l_true: if (k <= w) return 0; + case l_true: + if (k <= w) return 0; + Z3_fallthrough; case l_undef: if (do_add) to_add += occs(l); ++undefs; diff --git a/src/sat/tactic/goal2sat.cpp b/src/sat/tactic/goal2sat.cpp index 0e6d88b1a1..f85f747ffa 100644 --- a/src/sat/tactic/goal2sat.cpp +++ b/src/sat/tactic/goal2sat.cpp @@ -96,7 +96,7 @@ struct goal2sat::imp : public sat::sat_internalizer { m_euf = sp.euf() || sp.smt(); } - void throw_op_not_handled(std::string const& s) { + [[noreturn]] void throw_op_not_handled(std::string const& s) { std::string s0 = "operator " + s + " not supported, apply simplifier before invoking translator"; throw tactic_exception(std::move(s0)); } diff --git a/src/smt/seq/seq_nielsen.cpp b/src/smt/seq/seq_nielsen.cpp index 83d0d95c77..6837c5c7e9 100644 --- a/src/smt/seq/seq_nielsen.cpp +++ b/src/smt/seq/seq_nielsen.cpp @@ -3697,6 +3697,10 @@ namespace seq { SASSERT(!node->is_currently_conflict()); // The first modifier that produces edges is used and returned immediately. + // TEMPORARY-COVERAGE-HOIST + if (!harvest_mode() && apply_monadic_split(node)) + return ++m_stats.m_mod_monadic_split, true; + // Priority 1: deterministic modifiers (single child, always progress) if (apply_det_modifier(node)) return ++m_stats.m_mod_det, true; @@ -3760,9 +3764,9 @@ namespace seq { if (!harvest_mode() && apply_regex_factorization(node)) return ++m_stats.m_mod_regex_factorization, true; - // Priority 8a: MonadicSplit - continuation-regex intersection (seq_monadic): - // close the node if several memberships on the same sequence have a - // provably empty language intersection. Sound one-way (conflict only); + // Priority 8a: MonadicSplit - monadic decomposition (seq_monadic): close + // the node if a membership, a same-subject group, or all of them jointly + // have a provably empty language. Sound one-way (conflict only); // opt-in via smt.nseq.monadic_split. (skipped in benchmark-harvest mode) if (!harvest_mode() && apply_monadic_split(node)) return ++m_stats.m_mod_monadic_split, true; @@ -5284,73 +5288,135 @@ namespace seq { return false; } +#if false // ----------------------------------------------------------------------- - // Modifier: apply_monadic_split (continuation-regex intersection, seq_monadic) - // - // Uses the continuation-regex service in ast/rewriter/seq_monadic.h. Several - // plain memberships s ∈ R_1, …, s ∈ R_k on the SAME left-hand sequence s - // are jointly satisfiable only if L(R_1) ∩ … ∩ L(R_k) ≠ ∅. split_manager - // decides emptiness of that intersection over one shared, globally cached - // Brzozowski-derivative graph, and — unlike apply_regex_factorization, which - // skips primitive memberships (x ∈ R with x a bare variable) — it also fires - // on those, catching groups that are only *jointly* empty. - // - // Only the sound direction is used: seq_monadic::intersect returns l_false - // exactly when the intersection is provably empty (note the convention is the - // OPPOSITE of seq_regex::check_intersection_emptiness, where l_true = empty). - // On l_false the node is a regex conflict. l_true (non-empty) and l_undef - // (STATE_CAP / undecidable nullability) fall through so the ordinary modifiers - // keep driving the node. No witness is consumed (the module's witness - // extraction is not sound yet) and no child is ever created, so this rule can - // never introduce an unsound SAT. Opt-in via smt.nseq.monadic_split. - // ----------------------------------------------------------------------- + // Modifier: apply_monadic_split (whole-language monadic decomposition) + bool nielsen_graph::monadic_abstract_subject(euf::snode const* str, expr_ref_vector& pin, + obj_map& extra, expr_ref& out) { + expr_ref_vector args(m); + bool has_var = false; + for (euf::snode const* t : *str) { + if (t->is_char()) { + args.push_back(t->get_expr()); + continue; + } + sort* s = t->get_expr()->get_sort(); + const std::string name = "nseq.mon!" + std::to_string(t->id()); + expr_ref v(m.mk_const(symbol(name.c_str()), s), m); + pin.push_back(v); + if (t->is_unit()) { + // symbolic character: value unknown, length exactly 1. + expr_ref sigma(m_seq.re.mk_full_char(m_seq.re.mk_re(s)), m); + pin.push_back(sigma); + extra.insert(v, sigma); + } + args.push_back(v); + has_var = true; + } + if (!has_var) + return false; + out = m_seq.str.mk_concat(args, str->get_expr()->get_sort()); + pin.push_back(out); + return true; + } +#endif + bool nielsen_graph::apply_monadic_split(nielsen_node* node) { if (!m_monadic_split) return false; - +#if false auto const& mems = node->str_mems(); - const unsigned n = mems.size(); - if (n < 2) - return false; // need at least two memberships to form an intersection + if (mems.empty()) + return false; if (!m_monadic) - m_monadic = alloc(seq::split_manager, m_monadic_rw); + m_monadic = alloc(seq_monadic, m_monadic_rw); - // Group plain memberships by their (slicing-equal) left-hand sequence and - // test the joint language intersection of each group of size >= 2. - bool_vector done; - done.resize(n, false); - for (unsigned i = 0; i < n; ++i) { + // Abstract the plain memberships once; `src` maps back to the mems index. + expr_ref_vector pin(m); + obj_map extra; + vector> abstracted; + unsigned_vector src; + for (unsigned i = 0; i < mems.size(); ++i) { str_mem const& mi = mems[i]; - if (done[i] || !mi.is_plain()) + // A view has no plain-regex counterpart; an unresolved symbolic-derivative + // residual (ite) belongs to apply_regex_if_split. + if (!mi.is_plain() || mi.m_regex->is_ite()) continue; + expr_ref term(m); + if (!monadic_abstract_subject(mi.m_str, pin, extra, term)) + continue; + abstracted.push_back(std::make_pair(term.get(), mi.m_regex->get_expr())); + src.push_back(i); + } + const unsigned n = abstracted.size(); + if (n == 0) + return false; - vector crs; - crs.push_back(m_monadic->embed(mi.m_regex->get_expr())); - dep_tracker dep = mi.m_dep; - done[i] = true; - for (unsigned j = i + 1; j < n; ++j) { - str_mem const& mj = mems[j]; - if (done[j] || !mj.is_plain() || !mi.m_str->similar(mj.m_str, m)) - continue; - crs.push_back(m_monadic->embed(mj.m_regex->get_expr())); - dep = m_dep_mgr.mk_join(dep, mj.m_dep); - done[j] = true; + // Decide the memberships selected by `sel` jointly; close the node if empty. + auto close = [&](unsigned_vector const& sel) { + vector> ms; + dep_tracker dep = mems[src[sel[0]]].m_dep; + for (unsigned k : sel) { + ms.push_back(abstracted[k]); + if (ms.size() > 1) + dep = m_dep_mgr.mk_join(dep, mems[src[k]].m_dep); } - if (crs.size() < 2) - continue; // no sibling membership on the same sequence - - expr_ref_vector wit(m); - const lbool r = m_monadic->intersect(crs, 0, UINT_MAX, wit); + const lbool r = ms.size() == 1 ? m_monadic->solve(ms[0].first, ms[0].second, extra) + : m_monadic->solve_and(ms, extra); + TRACE(seq, tout << "MONPROBE n=" << ms.size() << " r=" << r + << " subj=" << mk_pp(ms[0].first, m) << "\n"); if (r != l_false) - continue; // non-empty (l_true) or undecided (l_undef): no conclusion - - TRACE(seq, tout << "monadic split: empty intersection of " << crs.size() - << " memberships on " << mem_pp(mi) << "\n"); + return false; // non-empty (l_true) or undecided (l_undef): no conclusion + TRACE(seq, tout << "monadic split: " << ms.size() << " membership(s) jointly empty, at " + << mem_pp(mems[src[sel[0]]]) << "\n"); node->set_general_conflict(); node->set_conflict(backtrack_reason::regex, dep); return true; + }; + + // 1. each non-primitive membership on its own. + for (unsigned k = 0; k < n; ++k) { + if (mems[src[k]].m_str->length() < 2) + continue; // single token: plain emptiness of L(R), checked elsewhere + unsigned_vector sel; + sel.push_back(k); + if (close(sel)) + return true; } + if (n < 2) + return false; + + // 2. memberships grouped by their (slicing-equal) subject. + bool_vector done; + done.resize(n, false); + unsigned num_groups = 0; + for (unsigned k = 0; k < n; ++k) { + if (done[k]) + continue; + unsigned_vector sel; + sel.push_back(k); + done[k] = true; + for (unsigned j = k + 1; j < n; ++j) { + if (done[j] || !mems[src[k]].m_str->similar(mems[src[j]].m_str, m)) + continue; + sel.push_back(j); + done[j] = true; + } + ++num_groups; + if (sel.size() >= 2 && close(sel)) + return true; + } + + // 3. all of them: catches subjects that are only jointly empty through a + // shared variable. Skipped when phase 2 already made this exact call. + if (num_groups < 2) + return false; + unsigned_vector all; + for (unsigned k = 0; k < n; ++k) + all.push_back(k); + return close(all); +#endif return false; } @@ -5487,7 +5553,6 @@ namespace seq { e->add_side_constraint(mk_constraint(a.mk_ge(inner_exp, fresh_m), eq.m_dep)); } } - return true; } diff --git a/src/smt/seq/seq_nielsen.h b/src/smt/seq/seq_nielsen.h index f931d27d27..b2993eada4 100644 --- a/src/smt/seq/seq_nielsen.h +++ b/src/smt/seq/seq_nielsen.h @@ -38,6 +38,7 @@ Author: #include "ast/euf/euf_mam.h" #include "ast/euf/euf_sgraph.h" #include "ast/rewriter/arith_rewriter.h" +#include "ast/rewriter/seq_monadic.h" #include "model/model.h" #include "util/lbool.h" #include "util/dependency.h" @@ -59,8 +60,7 @@ namespace seq { class nielsen_edge; class nielsen_graph; class seq_parikh; - class seq_regex; // forward declaration (defined in smt/seq/seq_regex.h) - class split_manager; // continuation-regex service (defined in ast/rewriter/seq_monadic.h) + class seq_regex; std::string snode_label_html(euf::snode const* n, obj_map& names, uint64_t& next_id, ast_manager& m, bool html_escape); @@ -1013,15 +1013,16 @@ namespace seq { // across calls (a fresh seq_rewriter per consumed character was a // dominant simplification cost). seq_rewriter m_deriv_rw; - // Dedicated rewriter backing the continuation-regex service used by + // Dedicated rewriter backing the membership decision procedure used by // apply_monadic_split. Kept separate from m_split_rw / m_deriv_rw so its // derivative caches never interleave with the suspended factorization - // iterators that reference those engines. + // iterators that reference those engines. It is also what carries the + // derivative cache across seq_monadic calls (the module itself keeps no + // state between them). seq_rewriter m_monadic_rw; - // Continuation-regex split / intersection service (seq_monadic). Grows a - // shared, globally cached Brzozowski-derivative graph; allocated lazily on - // first use and released in reset(). - seq::split_manager* m_monadic = nullptr; + // Monadic-decomposition membership solver (seq_monadic); allocated lazily + // on first use and released in reset(). + seq_monadic* m_monadic = nullptr; // Owns the suspended factorization continuations (rf_state); nodes hold // raw pointers into this pool. Freed in reset(). ptr_vector m_rf_states; @@ -1701,12 +1702,22 @@ namespace seq { // disjunction is refuted → the continuation node is a regex conflict. bool apply_regex_factorization(nielsen_node* node); - // continuation-regex intersection modifier (seq_monadic). Detects a - // provably empty intersection of several plain memberships sharing the - // same left-hand sequence and reports the node as a regex conflict. + // whole-language monadic decomposition modifier (seq_monadic). Decides + // emptiness of a non-primitive membership, of a group of memberships on + // the same left-hand sequence, and of the node's plain memberships taken + // jointly; reports a provably empty one as a regex conflict. // Sound one-way only: never creates a child, never claims SAT. bool apply_monadic_split(nielsen_node* node); +#if false + // Abstract a membership subject into the term shape seq_monadic parses + // (a concatenation of constant characters and 0-ary constants), pinning + // the constructed terms in `pin` and collecting per-constant + // over-approximating regexes in `extra`. false: the subject is ground. + bool monadic_abstract_subject(euf::snode const* str, expr_ref_vector& pin, + obj_map& extra, expr_ref& out); +#endif + // Build a suspended factorization (boundary head/tail + split iterator) // for `mem`. Returns null if the regex shape is unsupported (the engine // cannot even start a split). Allocated into m_rf_states. diff --git a/src/smt/seq_regex.cpp b/src/smt/seq_regex.cpp index a528a69e09..8d3913cde2 100644 --- a/src/smt/seq_regex.cpp +++ b/src/smt/seq_regex.cpp @@ -128,30 +128,6 @@ namespace smt { return; } - if (th.get_fparams().m_seq_regex_factorization_enabled) { - unsigned threshold = th.get_fparams().m_seq_regex_factorization_threshold; - if (threshold == 0) - threshold = UINT_MAX; - split_set result; - auto [head, tail] = seq_rw().split_membership(s, r, threshold, result); - if (head) { - SASSERT(tail); - // propagate all cases - expr_ref_vector cases(m); - expr_ref_vector branches(m); - for (auto [pre, post] : result) { - expr_ref mem_head(re().mk_in_re(head, pre), m); - expr_ref mem_tail(re().mk_in_re(tail, post), m); - cases.push_back(m.mk_and(mem_head, mem_tail)); - } - const expr_ref cases_expr(m.mk_or(cases), m); - ctx.internalize(cases_expr, false); - th.propagate_lit(nullptr, 1, &lit, ctx.get_literal(cases_expr)); - return; - } - // fallthrough; decomposition failed - } - // Convert a non-ground sequence into an additional regex and // strengthen the original regex constraint into an intersection // for example: @@ -501,7 +477,7 @@ namespace smt { // it directly by antimirov NFA reachability instead of running the // bisimulation/XOR closure, which would build large un-canonicalized // product states for intersections of contains-patterns. - if ((re().is_empty(r1) || re().is_empty(r2)) && is_ground(r)) { + if ((re().is_empty(r1) || re().is_empty(r2)) && re().is_ground(r)) { switch (re_is_empty(r)) { case l_true: STRACE(seq_regex_brief, tout << "empty:eq ";); @@ -517,7 +493,7 @@ namespace smt { // Try the bisimulation procedure on ground regexes first. If it // returns a definite answer, dispatch the corresponding axiom and // bypass the symbolic emptiness/derivative closure. - if (is_ground(r1) && is_ground(r2)) { + if (re().is_ground(r1) && re().is_ground(r2)) { seq::regex_bisim bisim(seq_rw()); switch (bisim.are_equivalent(r1, r2)) { case l_true: @@ -531,16 +507,8 @@ namespace smt { break; } } - expr_ref emp(re().mk_empty(r->get_sort()), m); - expr_ref f(m.mk_fresh_const("re.char", seq_sort), m); - expr_ref is_empty = sk().mk_is_empty(r, r, f); - // is_empty : (re,re,seq) -> Bool is a Skolem function - // f is a fresh internal Skolem constant of sort seq - // the literal is satisfiable when emptiness check succeeds - // meaning that r is not nullable and - // that all derivatives of r (if any) are also empty - // TBD: rewrite to use state_graph - th.add_axiom(~th.mk_eq(r1, r2, false), th.mk_literal(is_empty)); + th.add_unhandled_expr(r1); + th.add_unhandled_expr(r2); } void seq_regex::propagate_ne(expr* r1, expr* r2) { @@ -549,7 +517,7 @@ namespace smt { sort* seq_sort = nullptr; VERIFY(u().is_re(r1, seq_sort)); expr_ref r = symmetric_diff(r1, r2); - if (is_ground(r1) && is_ground(r2)) { + if (re().is_ground(r1) && re().is_ground(r2)) { seq::regex_bisim bisim(seq_rw()); switch (bisim.are_equivalent(r1, r2)) { case l_true: @@ -563,10 +531,8 @@ namespace smt { break; } } - expr_ref emp(re().mk_empty(r->get_sort()), m); - expr_ref n(m.mk_fresh_const("re.char", seq_sort), m); - expr_ref is_non_empty = sk().mk_is_non_empty(r, r, n); - th.add_axiom(th.mk_eq(r1, r2, false), th.mk_literal(is_non_empty)); + th.add_unhandled_expr(r1); + th.add_unhandled_expr(r2); } bool seq_regex::is_member(expr* r, expr* u) { diff --git a/src/smt/smt_solver.cpp b/src/smt/smt_solver.cpp index 393fff202a..8bb0e00c3b 100644 --- a/src/smt/smt_solver.cpp +++ b/src/smt/smt_solver.cpp @@ -101,9 +101,9 @@ namespace { result->set_model_converter(mc0()->translate(translator)); for (auto& [k, v] : m_name2assertion) { - expr* val = translator(k); - expr* key = translator(v); - result->assert_expr(val, key); + expr* fml = translator(v); + expr* ind = translator(k); + result->assert_expr(fml, ind); } return result; diff --git a/src/smt/theory_arith_core.h b/src/smt/theory_arith_core.h index 2c352a6a25..123f40978c 100644 --- a/src/smt/theory_arith_core.h +++ b/src/smt/theory_arith_core.h @@ -2460,6 +2460,7 @@ namespace smt { case QUASI_BASE: quasi_base_row2base_row(get_var_row(v)); SASSERT(get_var_kind(v) == BASE); + Z3_fallthrough; case BASE: if (!m_to_patch.contains(v) && get_value(v) < k) { TRACE(to_patch_bug, tout << "need to be patched (assert_lower): "; display_var(tout, v);); @@ -2508,6 +2509,7 @@ namespace smt { case QUASI_BASE: quasi_base_row2base_row(get_var_row(v)); SASSERT(get_var_kind(v) == BASE); + Z3_fallthrough; case BASE: if (!m_to_patch.contains(v) && get_value(v) > k) { TRACE(to_patch_bug, tout << "need to be patched (assert upper): "; display_var(tout, v);); diff --git a/src/smt/theory_bv.cpp b/src/smt/theory_bv.cpp index 83d5fd28e1..b4bbeb3ba8 100644 --- a/src/smt/theory_bv.cpp +++ b/src/smt/theory_bv.cpp @@ -23,6 +23,7 @@ Revision History: #include "ast/bv_decl_plugin.h" #include "smt/smt_model_generator.h" #include "util/stats.h" +#include "util/manage_warnings.h" #define ENABLE_QUOT_REM_ENCODING 0 @@ -819,6 +820,7 @@ namespace smt { init_bits(e, bits); } + START_DISABLE_EXTRA_SEMI_WARNING; MK_UNARY(internalize_neg, mk_neg); MK_UNARY(internalize_not, mk_not); MK_UNARY(internalize_redand, mk_redand); @@ -843,6 +845,7 @@ namespace smt { MK_AC_BINARY(internalize_nor, mk_nor); MK_AC_BINARY(internalize_xnor, mk_xnor); MK_BINARY(internalize_comp, mk_comp); + END_DISABLE_WARNING; #define MK_PARAMETRIC_UNARY(NAME, BLAST_OP) \ void theory_bv::NAME(app * n) { \ @@ -857,10 +860,12 @@ namespace smt { init_bits(e, bits); \ } + START_DISABLE_EXTRA_SEMI_WARNING; MK_PARAMETRIC_UNARY(internalize_sign_extend, mk_sign_extend); MK_PARAMETRIC_UNARY(internalize_zero_extend, mk_zero_extend); MK_PARAMETRIC_UNARY(internalize_rotate_left, mk_rotate_left); MK_PARAMETRIC_UNARY(internalize_rotate_right, mk_rotate_right); + END_DISABLE_WARNING; void theory_bv::internalize_concat(app * n) { process_args(n); @@ -1006,9 +1011,11 @@ namespace smt { } \ } + START_DISABLE_EXTRA_SEMI_WARNING; MK_NO_OVFL(internalize_umul_no_overflow, mk_umul_no_overflow); MK_NO_OVFL(internalize_smul_no_overflow, mk_smul_no_overflow); MK_NO_OVFL(internalize_smul_no_underflow, mk_smul_no_underflow); + END_DISABLE_WARNING; template void theory_bv::internalize_le(app * n) { diff --git a/src/smt/theory_finite_set_size.cpp b/src/smt/theory_finite_set_size.cpp index d9c4a9ddff..f08ea3a606 100644 --- a/src/smt/theory_finite_set_size.cpp +++ b/src/smt/theory_finite_set_size.cpp @@ -365,11 +365,64 @@ namespace smt { if (r != l_true) return r; - expr_ref slack(m.mk_fresh_const(symbol("slack"), a.mk_int()), m); - ctx.mk_th_axiom(th.get_id(), th.mk_literal(a.mk_ge(slack, a.mk_int(0)))); // slack is non-negative model_ref mdl; m_solver->get_model(mdl); + // Determine whether this propositional model has a "definite member": + // an element known to be in some active set, whose singleton is the + // only active singleton. When true, at least one concrete element + // witnesses the pattern, so the slack lower-bound is 1 instead of 0. + // + // Conditions for a definite member: + // (a) Exactly one equivalence class of singletons is active in the model. + // (b) There is a positive membership assertion (set.in e s) where + // - e belongs to that singleton class, and + // - the set s is active in the model. + // + // When multiple distinct singleton classes are simultaneously active the + // pattern requires an element to be in several disjoint singletons at once + // (impossible for distinct concrete values), so we conservatively use lb=0. + + enode *active_elem_root = nullptr; + bool multiple_singleton_classes = false; + for (auto& [en, b] : n2b) { + if (!u.is_singleton(en->get_expr())) + continue; + if (!mdl->is_true(b)) + continue; + auto elem_root = en->get_arg(0)->get_root(); + if (!active_elem_root) { + active_elem_root = elem_root; + } else if (active_elem_root != elem_root) { + multiple_singleton_classes = true; + break; + } + } + + bool has_definite_member = false; + if (!multiple_singleton_classes && active_elem_root) { + for (auto& [k, v] : m_assumptions) { + if (!std::holds_alternative(v)) + continue; + auto& in_val = std::get(v); + if (!in_val.is_pos) + continue; + if (in_val.n->get_arg(0)->get_root() != active_elem_root) + continue; + auto set_en = in_val.n->get_arg(1); + if (!n2b.contains(set_en)) + continue; + if (!mdl->is_true(n2b[set_en])) + continue; + has_definite_member = true; + break; + } + } + + expr_ref slack(m.mk_fresh_const(symbol("slack"), a.mk_int()), m); + int slack_lb = has_definite_member ? 1 : 0; + ctx.mk_th_axiom(th.get_id(), th.mk_literal(a.mk_ge(slack, a.mk_int(slack_lb)))); + expr_ref_vector props(m); for (auto f : m_set_size_decls) { @@ -475,4 +528,4 @@ namespace smt { m_solver->display(out << "set.size-solver\n"); return out; } -} // namespace smt \ No newline at end of file +} // namespace smt diff --git a/src/smt/theory_lra.cpp b/src/smt/theory_lra.cpp index 488ac7404f..17d524f132 100644 --- a/src/smt/theory_lra.cpp +++ b/src/smt/theory_lra.cpp @@ -1349,7 +1349,6 @@ public: literal eqz = mk_literal(m.mk_eq(q, zero)); literal mod_ge_0 = mk_literal(a.mk_ge(mod, zero)); - // q = 0 or p = (p mod q) + q * (p div q) // q = 0 or (p mod q) >= 0 // q >= 0 or (p mod q) + q <= -1 @@ -1746,6 +1745,7 @@ public: IF_VERBOSE(12, verbose_stream() << "final-check " << lp().get_status() << "\n"); lbool is_sat = l_true; SASSERT(lp().ax_is_correct()); + propagate_nla(); if (!lp().is_feasible() || lp().has_changed_columns()) is_sat = make_feasible(); final_check_status st = FC_DONE; @@ -2126,7 +2126,6 @@ public: default: UNREACHABLE(); } - TRACE(arith, tout << "is_lower: " << is_lower << " pos " << pos << "\n";); expr_ref atom(m); // TBD utility: lp::lar_term term = mk_term(ineq.m_poly); // then term is used instead of ineq.m_term @@ -2135,6 +2134,7 @@ public: else // create term >= 0 (or term <= 0) atom = mk_bound(ineq.term(), ineq.rs(), is_lower); + TRACE(arith, tout << "is_lower: " << is_lower << " pos " << pos << " " << atom << "\n";); return literal(ctx().get_bool_var(atom), pos); } @@ -2265,7 +2265,6 @@ public: bool propagate_core() { m_model_is_initialized = false; flush_bound_axioms(); - propagate_nla(); if (ctx().inconsistent()) return true; if (!can_propagate_core()) @@ -2320,6 +2319,7 @@ public: get_infeasibility_explanation_and_set_conflict(); break; case l_true: + incremental_propagate_nla(); propagate_bounds_with_lp_solver(); break; case l_undef: @@ -2329,12 +2329,24 @@ public: return true; } - void propagate_nla() { + bool propagate_nla() { + bool propagated = false; if (m_nla) { - m_nla->propagate(); + propagated = m_nla->propagate(); add_lemmas(); lp().collect_more_rows_for_lp_propagation(); } + return propagated; + } + + bool incremental_propagate_nla() { + bool propagated = false; + if (m_nla) { + propagated = m_nla->incremental_propagate(); + add_lemmas(); + lp().collect_more_rows_for_lp_propagation(); + } + return propagated; } void add_equality(lpvar j, rational const& k, lp::explanation const& exp) { @@ -4290,7 +4302,12 @@ public: app_ref coeffs2app(u_map const& coeffs, rational const& offset, bool is_int) { expr_ref_vector args(m); for (auto const& [w, coeff] : coeffs) { - expr* o = get_expr(w); + expr_ref o(get_expr(w), m); + // When the overall expression is Real but 'o' is Int (e.g. due to + // to_real(Int) equality constraints in the LP), coerce 'o' to Real + // to avoid sort mismatches when int/real coercions are disabled. + if (!is_int && a.is_int(o)) + o = a.mk_to_real(o); if (coeff.is_zero()) { // continue } diff --git a/src/smt/theory_pb.cpp b/src/smt/theory_pb.cpp index 40c2cec2ae..e0e2b1ea51 100644 --- a/src/smt/theory_pb.cpp +++ b/src/smt/theory_pb.cpp @@ -2116,6 +2116,7 @@ namespace smt { switch(ctx.get_assignment(c.lit(i))) { case l_true: ++sum; + Z3_fallthrough; case l_undef: ++maxsum; break; @@ -2147,6 +2148,7 @@ namespace smt { switch(ctx.get_assignment(c.lit(i))) { case l_true: sum += c.coeff(i); + Z3_fallthrough; case l_undef: maxsum += c.coeff(i); break; diff --git a/src/smt/theory_seq.cpp b/src/smt/theory_seq.cpp index 9051a8ea05..27a60c605a 100644 --- a/src/smt/theory_seq.cpp +++ b/src/smt/theory_seq.cpp @@ -2205,6 +2205,16 @@ app* theory_seq::mk_value(expr* e) { else { m_rewrite(result); } + // Avoid leaking internal terms into the model. An unresolved sequence + // value (e.g. (seq.nth_i k!0 0) over an internal sequence constant k!0) + // is not a proper value and must not be exposed to the user. Since such a + // term is unconstrained at this point, replace it by a concrete fresh + // value from the factory. See issue #9063. + if (m_util.is_seq(result) && !m.is_value(result)) { + expr_ref fresh(m_factory->get_fresh_value(result->get_sort()), m); + if (fresh) + result = fresh; + } m_factory->add_trail(result); TRACE(seq, tout << mk_pp(e, m) << " -> " << result << "\n";); m_rep.update(e, result, nullptr); diff --git a/src/solver/parallel_tactical.cpp b/src/solver/parallel_tactical.cpp index 803f54eb74..753cd15496 100644 --- a/src/solver/parallel_tactical.cpp +++ b/src/solver/parallel_tactical.cpp @@ -1250,7 +1250,7 @@ class parallel_solver { // re-checking the same cube would spin forever. Record a sound // 'unknown' verdict and stop working this branch instead. std::string reason = s->reason_unknown(); - if (reason != "max-conflicts-reached") { + if (reason != "max-conflicts-reached" && reason != "sat.max.conflicts") { LOG_WORKER(1, " undef cube is not conflict-limited (" << reason << "); reporting unknown\n"); b.set_unknown(reason); return; @@ -2183,7 +2183,7 @@ public: std::string reason = ps.reason_unknown(); if (!reason.empty()) { g->set_reason_unknown(reason); - IF_VERBOSE(0, verbose_stream() << reason << "\n"); + IF_VERBOSE(1, verbose_stream() << reason << "\n"); } } break; diff --git a/src/tactic/aig/aig.cpp b/src/tactic/aig/aig.cpp index fc165b009a..a0b7d05382 100644 --- a/src/tactic/aig/aig.cpp +++ b/src/tactic/aig/aig.cpp @@ -480,6 +480,7 @@ struct aig_manager::imp { case OP_EQ: if (!m.m().is_bool(tapp->get_arg(0))) break; + Z3_fallthrough; case OP_NOT: case OP_OR: case OP_AND: @@ -1272,10 +1273,12 @@ struct aig_manager::imp { fr.m_idx++; if (!visit(left(n))) goto start; + Z3_fallthrough; case 1: fr.m_idx++; if (!visit(right(n))) goto start; + Z3_fallthrough; default: if (!is_cached(n)) improve_sharing(n); diff --git a/src/tactic/arith/bv2real_rewriter.h b/src/tactic/arith/bv2real_rewriter.h index 9e10d6de5b..b70bc2d4bb 100644 --- a/src/tactic/arith/bv2real_rewriter.h +++ b/src/tactic/arith/bv2real_rewriter.h @@ -22,6 +22,7 @@ Notes: #include "ast/rewriter/rewriter.h" #include "ast/bv_decl_plugin.h" #include "ast/arith_decl_plugin.h" +#include "util/manage_warnings.h" // // bv2real[d,r](n,m) has interpretation: @@ -100,8 +101,10 @@ public: bool is_pos_lef(func_decl* f) const { return f == m_pos_le; } bool is_pos_lt(expr const* e) const { return is_app(e) && is_pos_ltf(to_app(e)->get_decl()); } bool is_pos_le(expr const* e) const { return is_app(e) && is_pos_lef(to_app(e)->get_decl()); } + START_DISABLE_EXTRA_SEMI_WARNING; MATCH_BINARY(is_pos_lt); MATCH_BINARY(is_pos_le); + END_DISABLE_WARNING; expr* mk_pos_lt(expr* s, expr* t) { return m().mk_app(m_pos_lt, s, t); } expr* mk_pos_le(expr* s, expr* t) { return m().mk_app(m_pos_le, s, t); } diff --git a/src/tactic/arith/probe_arith.cpp b/src/tactic/arith/probe_arith.cpp index 85d9acd9a0..3e2596e9f6 100644 --- a/src/tactic/arith/probe_arith.cpp +++ b/src/tactic/arith/probe_arith.cpp @@ -135,7 +135,7 @@ struct has_nlmul { arith_util a; has_nlmul(ast_manager& m):m(m), a(m) {} - void throw_found(expr* e) { + [[noreturn]] void throw_found(expr* e) { TRACE(probe, tout << expr_ref(e, m) << ": " << sort_ref(e->get_sort(), m) << "\n";); throw found(); } diff --git a/src/tactic/core/elim_uncnstr_tactic.cpp b/src/tactic/core/elim_uncnstr_tactic.cpp index 7aecd4d505..0d836bf4d5 100644 --- a/src/tactic/core/elim_uncnstr_tactic.cpp +++ b/src/tactic/core/elim_uncnstr_tactic.cpp @@ -763,6 +763,7 @@ class elim_uncnstr_tactic : public tactic { } return r; } + return nullptr; default: return nullptr; } diff --git a/src/tactic/core/tseitin_cnf_tactic.cpp b/src/tactic/core/tseitin_cnf_tactic.cpp index ba396a7565..886a603cd7 100644 --- a/src/tactic/core/tseitin_cnf_tactic.cpp +++ b/src/tactic/core/tseitin_cnf_tactic.cpp @@ -95,7 +95,7 @@ class tseitin_cnf_tactic : public tactic { void push_frame(app * n) { m_frame_stack.push_back(frame(n)); } - void throw_op_not_handled() { + [[noreturn]] void throw_op_not_handled() { throw tactic_exception("operator not supported, apply simplifier before invoking this strategy"); } diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 220d32090f..314af446e3 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -61,7 +61,6 @@ add_executable(test-z3 f2n.cpp finite_set.cpp finite_set_rewriter.cpp - fpa.cpp factor_rewriter.cpp finder.cpp fixed_bit_vector.cpp @@ -137,12 +136,14 @@ add_executable(test-z3 sat_user_scope.cpp scoped_timer.cpp scoped_vector.cpp + seq_rewriter.cpp + seq_monadic.cpp simple_parser.cpp + scanner_io.cpp simplex.cpp simplifier.cpp sls_test.cpp sls_seq_plugin.cpp - seq_split.cpp small_object_allocator.cpp smt2print_parse.cpp smt_context.cpp diff --git a/src/test/api.cpp b/src/test/api.cpp index b1765fdd4a..7b1bf1303f 100644 --- a/src/test/api.cpp +++ b/src/test/api.cpp @@ -40,6 +40,80 @@ void test_apps() { Z3_del_context(ctx); } +static void test_mk_app_polymorphic_arity() { + Z3_config cfg = Z3_mk_config(); + Z3_context ctx = Z3_mk_context(cfg); + Z3_del_config(cfg); + Z3_set_error_handler(ctx, [](Z3_context, Z3_error_code) {}); + + Z3_sort type_var = Z3_mk_type_variable(ctx, Z3_mk_string_symbol(ctx, "A")); + Z3_func_decl f = Z3_mk_func_decl(ctx, Z3_mk_string_symbol(ctx, "f"), 1, &type_var, type_var); + Z3_sort int_sort = Z3_mk_int_sort(ctx); + Z3_ast args[] = { + Z3_mk_int(ctx, 1, int_sort), Z3_mk_int(ctx, 2, int_sort), Z3_mk_int(ctx, 3, int_sort) + }; + + ENSURE(Z3_mk_app(ctx, f, 1, args)); + ENSURE(Z3_get_error_code(ctx) == Z3_OK); + ENSURE(!Z3_mk_app(ctx, f, 0, nullptr)); + ENSURE(Z3_get_error_code(ctx) == Z3_INVALID_ARG); + ENSURE(!Z3_mk_app(ctx, f, 2, args)); + ENSURE(Z3_get_error_code(ctx) == Z3_INVALID_ARG); + + Z3_sort set_type_var = Z3_mk_set_sort(ctx, type_var); + Z3_ast poly_set = Z3_mk_const(ctx, Z3_mk_string_symbol(ctx, "poly_set"), set_type_var); + Z3_ast poly_sets[] = { poly_set, poly_set }; + Z3_ast set_union = Z3_mk_set_union(ctx, 2, poly_sets); + Z3_func_decl set_union_decl = Z3_get_app_decl(ctx, Z3_to_app(ctx, set_union)); + ENSURE(Z3_get_arity(ctx, set_union_decl) == 2); + + Z3_sort int_set_sort = Z3_mk_set_sort(ctx, int_sort); + Z3_ast int_sets[] = { + Z3_mk_const(ctx, Z3_mk_string_symbol(ctx, "int_set1"), int_set_sort), + Z3_mk_const(ctx, Z3_mk_string_symbol(ctx, "int_set2"), int_set_sort), + Z3_mk_const(ctx, Z3_mk_string_symbol(ctx, "int_set3"), int_set_sort) + }; + ENSURE(Z3_mk_app(ctx, set_union_decl, 1, int_sets)); + ENSURE(Z3_get_error_code(ctx) == Z3_OK); + Z3_ast set_union3 = Z3_mk_app(ctx, set_union_decl, 3, int_sets); + ENSURE(set_union3); + ENSURE(Z3_get_error_code(ctx) == Z3_OK); + Z3_app set_union3_app = Z3_to_app(ctx, set_union3); + Z3_func_decl set_union3_decl = Z3_get_app_decl(ctx, set_union3_app); + ENSURE(Z3_get_arity(ctx, set_union3_decl) == 2); + ENSURE(Z3_get_app_num_args(ctx, set_union3_app) == 2); + ENSURE(Z3_get_app_arg(ctx, set_union3_app, 0) == int_sets[0]); + Z3_app set_union3_tail = Z3_to_app(ctx, Z3_get_app_arg(ctx, set_union3_app, 1)); + ENSURE(Z3_get_app_num_args(ctx, set_union3_tail) == 2); + ENSURE(Z3_get_app_arg(ctx, set_union3_tail, 0) == int_sets[1]); + ENSURE(Z3_get_app_arg(ctx, set_union3_tail, 1) == int_sets[2]); + + Z3_sort bool_set_sort = Z3_mk_set_sort(ctx, Z3_mk_bool_sort(ctx)); + Z3_ast bool_set = Z3_mk_const(ctx, Z3_mk_string_symbol(ctx, "bool_set"), bool_set_sort); + Z3_ast incompatible_sets[] = { int_sets[0], int_sets[1], bool_set }; + ENSURE(!Z3_mk_app(ctx, set_union_decl, 3, incompatible_sets)); + ENSURE(Z3_get_error_code(ctx) == Z3_INVALID_ARG); + + Z3_ast poly_value = Z3_mk_const(ctx, Z3_mk_string_symbol(ctx, "poly_value"), type_var); + Z3_ast poly_eq = Z3_mk_eq(ctx, poly_value, poly_value); + Z3_func_decl eq_decl = Z3_get_app_decl(ctx, Z3_to_app(ctx, poly_eq)); + ENSURE(Z3_mk_app(ctx, eq_decl, 3, args)); + ENSURE(Z3_get_error_code(ctx) == Z3_OK); + + Z3_sort re_type_var = Z3_mk_re_sort(ctx, Z3_mk_seq_sort(ctx, type_var)); + Z3_ast empty_re_type_var = Z3_mk_re_empty(ctx, re_type_var); + Z3_ast poly_res[] = { empty_re_type_var, empty_re_type_var }; + Z3_ast re_union = Z3_mk_re_union(ctx, 2, poly_res); + Z3_func_decl re_union_decl = Z3_get_app_decl(ctx, Z3_to_app(ctx, re_union)); + Z3_sort re_int = Z3_mk_re_sort(ctx, Z3_mk_seq_sort(ctx, int_sort)); + Z3_ast empty_re_int = Z3_mk_re_empty(ctx, re_int); + Z3_ast int_res[] = { empty_re_int, empty_re_int, empty_re_int }; + ENSURE(Z3_mk_app(ctx, re_union_decl, 3, int_res)); + ENSURE(Z3_get_error_code(ctx) == Z3_OK); + + Z3_del_context(ctx); +} + void test_bvneg() { Z3_config cfg = Z3_mk_config(); Z3_set_param_value(cfg,"MODEL","true"); @@ -183,137 +257,14 @@ void test_optimize_translate() { Z3_del_context(ctx1); } -void test_max_reg() { - // BNH multi-objective optimization problem using Z3 Optimize C API. - // Mimics /tmp/bnh_z3.py: two objectives over a constrained 2D domain. - // f1 = 4*x1^2 + 4*x2^2 - // f2 = (x1-5)^2 + (x2-5)^2 - // 0 <= x1 <= 5, 0 <= x2 <= 3 - // C1: (x1-5)^2 + x2^2 <= 25 - // C2: (x1-8)^2 + (x2+3)^2 >= 7.7 - - Z3_config cfg = Z3_mk_config(); - Z3_context ctx = Z3_mk_context(cfg); - Z3_del_config(cfg); - - Z3_sort real_sort = Z3_mk_real_sort(ctx); - Z3_ast x1 = Z3_mk_const(ctx, Z3_mk_string_symbol(ctx, "x1"), real_sort); - Z3_ast x2 = Z3_mk_const(ctx, Z3_mk_string_symbol(ctx, "x2"), real_sort); - - auto mk_real = [&](int num, int den = 1) { return Z3_mk_real(ctx, num, den); }; - auto mk_mul = [&](Z3_ast a, Z3_ast b) { Z3_ast args[] = {a, b}; return Z3_mk_mul(ctx, 2, args); }; - auto mk_add = [&](Z3_ast a, Z3_ast b) { Z3_ast args[] = {a, b}; return Z3_mk_add(ctx, 2, args); }; - auto mk_sub = [&](Z3_ast a, Z3_ast b) { Z3_ast args[] = {a, b}; return Z3_mk_sub(ctx, 2, args); }; - auto mk_sq = [&](Z3_ast a) { return mk_mul(a, a); }; - - // f1 = 4*x1^2 + 4*x2^2 - Z3_ast f1 = mk_add(mk_mul(mk_real(4), mk_sq(x1)), mk_mul(mk_real(4), mk_sq(x2))); - // f2 = (x1-5)^2 + (x2-5)^2 - Z3_ast f2 = mk_add(mk_sq(mk_sub(x1, mk_real(5))), mk_sq(mk_sub(x2, mk_real(5)))); - - // Helper: create optimize with BNH constraints and timeout - auto mk_max_reg = [&]() -> Z3_optimize { - Z3_optimize opt = Z3_mk_optimize(ctx); - Z3_optimize_inc_ref(ctx, opt); - // Set timeout to 5 seconds - Z3_params p = Z3_mk_params(ctx); - Z3_params_inc_ref(ctx, p); - Z3_params_set_uint(ctx, p, Z3_mk_string_symbol(ctx, "timeout"), 5000); - Z3_optimize_set_params(ctx, opt, p); - Z3_params_dec_ref(ctx, p); - // Add BNH constraints - Z3_optimize_assert(ctx, opt, Z3_mk_ge(ctx, x1, mk_real(0))); - Z3_optimize_assert(ctx, opt, Z3_mk_le(ctx, x1, mk_real(5))); - Z3_optimize_assert(ctx, opt, Z3_mk_ge(ctx, x2, mk_real(0))); - Z3_optimize_assert(ctx, opt, Z3_mk_le(ctx, x2, mk_real(3))); - Z3_optimize_assert(ctx, opt, Z3_mk_le(ctx, mk_add(mk_sq(mk_sub(x1, mk_real(5))), mk_sq(x2)), mk_real(25))); - Z3_optimize_assert(ctx, opt, Z3_mk_ge(ctx, mk_add(mk_sq(mk_sub(x1, mk_real(8))), mk_sq(mk_add(x2, mk_real(3)))), mk_real(77, 10))); - return opt; - }; - - auto result_str = [](Z3_lbool r) { return r == Z3_L_TRUE ? "sat" : r == Z3_L_FALSE ? "unsat" : "unknown"; }; - - unsigned num_sat = 0; - - // Approach 1: Minimize f1 (Python: opt.minimize(f1)) - { - Z3_optimize opt = mk_max_reg(); - Z3_optimize_minimize(ctx, opt, f1); - Z3_lbool result = Z3_optimize_check(ctx, opt, 0, nullptr); - std::cout << "BNH min f1: " << result_str(result) << std::endl; - ENSURE(result == Z3_L_TRUE); - if (result == Z3_L_TRUE) { - Z3_model m = Z3_optimize_get_model(ctx, opt); - Z3_model_inc_ref(ctx, m); - Z3_ast val; Z3_model_eval(ctx, m, f1, true, &val); - std::cout << " f1=" << Z3_ast_to_string(ctx, val) << std::endl; - Z3_model_dec_ref(ctx, m); - num_sat++; - } - Z3_optimize_dec_ref(ctx, opt); - } - - // Approach 2: Minimize f2 (Python: opt2.minimize(f2)) - { - Z3_optimize opt = mk_max_reg(); - Z3_optimize_minimize(ctx, opt, f2); - Z3_lbool result = Z3_optimize_check(ctx, opt, 0, nullptr); - std::cout << "BNH min f2: " << result_str(result) << std::endl; - ENSURE(result == Z3_L_TRUE); - if (result == Z3_L_TRUE) { - Z3_model m = Z3_optimize_get_model(ctx, opt); - Z3_model_inc_ref(ctx, m); - Z3_ast val; Z3_model_eval(ctx, m, f2, true, &val); - std::cout << " f2=" << Z3_ast_to_string(ctx, val) << std::endl; - Z3_model_dec_ref(ctx, m); - num_sat++; - } - Z3_optimize_dec_ref(ctx, opt); - } - - #if 0 - // Approach 3: Weighted sum method (Python loop over weights) - int weights[][2] = {{1, 4}, {2, 3}, {1, 1}, {3, 2}, {4, 1}}; - for (auto& w : weights) { - Z3_optimize opt = mk_max_reg(); - Z3_ast weighted = mk_add(mk_mul(mk_real(w[0], 100), f1), mk_mul(mk_real(w[1], 100), f2)); - Z3_optimize_minimize(ctx, opt, weighted); - Z3_lbool result = Z3_optimize_check(ctx, opt, 0, nullptr); - std::cout << "BNH weighted (w1=" << w[0] << "/5, w2=" << w[1] << "/5): " - << result_str(result) << std::endl; - ENSURE(result == Z3_L_TRUE); - if (result == Z3_L_TRUE) { - Z3_model m = Z3_optimize_get_model(ctx, opt); - Z3_model_inc_ref(ctx, m); - Z3_ast v1, v2; - Z3_model_eval(ctx, m, f1, true, &v1); - Z3_model_eval(ctx, m, f2, true, &v2); - std::cout << " f1=" << Z3_ast_to_string(ctx, v1) - << " f2=" << Z3_ast_to_string(ctx, v2) << std::endl; - Z3_model_dec_ref(ctx, m); - num_sat++; - } - Z3_optimize_dec_ref(ctx, opt); - } - #endif - - std::cout << "BNH: " << num_sat << "/2 optimizations returned sat" << std::endl; - ENSURE(num_sat == 2); - Z3_del_context(ctx); - std::cout << "BNH optimization test done" << std::endl; -} - void tst_api() { test_apps(); + test_mk_app_polymorphic_arity(); test_bvneg(); test_mk_distinct(); test_optimize_translate(); } -void tst_max_reg() { - test_max_reg(); -} - void test_max_rev() { // Same as test_max_regimize but with reversed argument order in f1/f2 construction. Z3_config cfg = Z3_mk_config(); diff --git a/src/test/euf_arith_plugin.cpp b/src/test/euf_arith_plugin.cpp index 596db671b4..32da4727ea 100644 --- a/src/test/euf_arith_plugin.cpp +++ b/src/test/euf_arith_plugin.cpp @@ -98,9 +98,30 @@ static void test3() { std::cout << g << "\n"; } +static void test4() { + ast_manager m; + reg_decl_plugins(m); + euf::egraph g(m); + g.add_plugin(alloc(euf::arith_plugin, g)); + arith_util a(m); + sort_ref R(a.mk_real(), m); + + // Test that -(a*a) = a does not crash (issue #10240) + // uminus of a nonlinear product should not trigger NOT_IMPLEMENTED_YET + expr_ref x(m.mk_const("a", R), m); + expr_ref aa(a.mk_mul(x, x), m); + expr_ref neg_aa(a.mk_uminus(aa), m); + auto* n_neg_aa = get_node(g, a, neg_aa); + auto* n_x = get_node(g, a, x); + g.merge(n_neg_aa, n_x, nullptr); + g.propagate(); + std::cout << "test4 passed\n"; +} + void tst_euf_arith_plugin() { // enable_trace("plugin"); test1(); test2(); test3(); + test4(); } diff --git a/src/test/fpa.cpp b/src/test/fpa.cpp deleted file mode 100644 index 632865cee6..0000000000 --- a/src/test/fpa.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/*++ -Copyright (c) 2025 Microsoft Corporation - ---*/ - -// Regression tests for floating-point arithmetic encoding and model generation. - -#include "api/z3.h" -#include "util/debug.h" -#include - -static void run_fp_test(const char * assertion, bool expect_sat) { - Z3_context ctx = Z3_mk_context(nullptr); - const char * result = Z3_eval_smtlib2_string(ctx, assertion); - if (expect_sat) { - ENSURE(strstr(result, "sat") != nullptr); - ENSURE(strstr(result, "unsat") == nullptr); - } else { - ENSURE(strstr(result, "unsat") != nullptr); - } - ENSURE(strstr(result, "invalid") == nullptr); - Z3_del_context(ctx); -} - -// Test that fp.to_real produces correct values for denormal floating-point numbers. -// Regression test for: incorrect model with (_ FloatingPoint 2 24) and fp.to_real. -// Denormal numbers require subtracting the normalization shift (lz) from the exponent; -// without this fix, denormals in fp.to_real were ~2^lz times too large. -static void test_fp_to_real_denormal() { - // Test 1: the specific denormal from the bug report (fp #b0 #b00 #b00111011011111001011101) - // has fp.to_real ~= 0.232, which must NOT be > 1.0 - run_fp_test( - "(set-option :model_validate true)\n" - "(assert (> (fp.to_real (fp #b0 #b00 #b00111011011111001011101)) 1.0))\n" - "(check-sat)\n", - false); - - // Test 2: denormal with leading significand bit = 1, fp.to_real should be 0.5 - // (fp #b0 #b00 #b10000000000000000000000) in (_ FloatingPoint 2 24) - run_fp_test( - "(set-option :model_validate true)\n" - "(assert (= (fp.to_real (fp #b0 #b00 #b10000000000000000000000)) (/ 1.0 2.0)))\n" - "(check-sat)\n", - true); - - // Test 3: denormal with significand bit pattern giving fp.to_real = 0.125 - // (fp #b0 #b00 #b00100000000000000000000) in (_ FloatingPoint 2 24) - run_fp_test( - "(set-option :model_validate true)\n" - "(assert (= (fp.to_real (fp #b0 #b00 #b00100000000000000000000)) (/ 1.0 8.0)))\n" - "(check-sat)\n", - true); - - // Test 4: a normal value (fp #b0 #b01 #b11111111111111111111111) must be > 1.0 - // This is the maximum finite normal number in (_ FloatingPoint 2 24) - run_fp_test( - "(set-option :model_validate true)\n" - "(assert (> (fp.to_real (fp #b0 #b01 #b11111111111111111111111)) 1.0))\n" - "(check-sat)\n", - true); -} - -// Regression test for soundness bug in to_fp (from real) with symbolic real interval. -// When the rounding mode is RTZ and the real variable is constrained to an interval -// that includes the exact rational value of a float, Z3 should return SAT. -// This was broken because mk_to_real computed 2^(1/|exp|) instead of 1/(2^|exp|) -// for floats with negative exponents, causing a conflict in the NRA solver. -static void test_to_fp_from_real_interval() { - // The interval (-4127125/16777216, -16508499/67108864] contains -16508499/67108864 - // which is the exact rational value of fp #b1 #b01111100 #b11110111110011001010011. - // to_fp(RTZ, r) for r in this closed interval must equal that float. - run_fp_test( - "(set-logic QF_FPLRA)\n" - "(declare-const x Float32)\n" - "(assert (= x (fp #b1 #b01111100 #b11110111110011001010011)))\n" - "(declare-const r Real)\n" - "(assert (and (> r (- (/ 4127125.0 16777216.0))) (<= r (- (/ 16508499.0 67108864.0)))))\n" - "(declare-const w Float32)\n" - "(assert (= w ((_ to_fp 8 24) RTZ r)))\n" - "(assert (= x w))\n" - "(check-sat)\n", - true); -} - -static void test_recfun_defined_function_soundness() { - run_fp_test( - "(set-option :model_validate true)\n" - "(declare-fun fixedAdd () Int)\n" - "(declare-fun variableAdd () Int)\n" - "(define-fun-rec $$add$$ ((a Int) (b Int)) Int\n" - " (ite (= 0 b) 2 (- a (+ 0 (- fixedAdd b)))))\n" - "(assert (= fixedAdd (* 9 fixedAdd)))\n" - "(assert (= 1 ($$add$$ 1 3)))\n" - "(check-sat)\n", - false); -} - -void tst_fpa() { - test_fp_to_real_denormal(); - test_to_fp_from_real_interval(); - test_recfun_defined_function_soundness(); -} diff --git a/src/test/hwf.cpp b/src/test/hwf.cpp index b81a9cef30..8ed3155d5d 100644 --- a/src/test/hwf.cpp +++ b/src/test/hwf.cpp @@ -19,6 +19,7 @@ Revision History: #include "util/hwf.h" #include "util/f2n.h" #include "util/rational.h" +#include #include static void bug_set_double() { diff --git a/src/test/main.cpp b/src/test/main.cpp index a31f71ab52..d93b141fe9 100644 --- a/src/test/main.cpp +++ b/src/test/main.cpp @@ -73,8 +73,8 @@ X(bit_blaster) \ X(var_subst) \ X(simple_parser) \ + X(scanner_io) \ X(api) \ - X(max_reg) \ X(max_rev) \ X(scaled_min) \ X(box_mod_opt) \ @@ -198,8 +198,6 @@ X(ho_matcher) \ X(finite_set) \ X(finite_set_rewriter) \ - X(seq_split) \ - X(fpa) \ X(seq_regex_bisim) \ X(seq_nielsen) \ X(nseq_basic) \ diff --git a/src/test/memory.cpp b/src/test/memory.cpp index 58e8855b64..e751f29553 100644 --- a/src/test/memory.cpp +++ b/src/test/memory.cpp @@ -11,6 +11,8 @@ Copyright (c) 2015 Microsoft Corporation #include "util/trace.h" static bool oom = false; +static unsigned oom_handler_calls = 0; +static Z3_error_code oom_handler_last_code = Z3_OK; static void err_handler(Z3_context c, Z3_error_code e) { @@ -18,6 +20,11 @@ static void err_handler(Z3_context c, Z3_error_code e) { throw std::bad_alloc(); } +static void err_handler_noexcept(Z3_context, Z3_error_code e) { + ++oom_handler_calls; + oom_handler_last_code = e; +} + static void hit_me(char const* wm) { Z3_config cfg; Z3_context ctx; @@ -49,6 +56,37 @@ static void hit_me(char const* wm) { Z3_del_config(cfg); } +static void solver_reset_after_oom(char const* wm) { + Z3_config cfg; + Z3_context ctx; + + oom_handler_calls = 0; + oom_handler_last_code = Z3_OK; + + cfg = Z3_mk_config(); + if (!cfg) { + return; + } + Z3_global_param_set("MEMORY_MAX_SIZE", wm); + ctx = Z3_mk_context(cfg); + if (ctx) { + Z3_set_error_handler(ctx, &err_handler_noexcept); + Z3_solver s = Z3_mk_solver(ctx); + Z3_symbol p = Z3_mk_string_symbol(ctx, "p"); + Z3_ast b = Z3_mk_const(ctx, p, Z3_mk_bool_sort(ctx)); + Z3_solver_assert(ctx, s, b); + Z3_solver_check(ctx, s); + for (unsigned i = 1; oom_handler_last_code != Z3_MEMOUT_FAIL; ++i) { + Z3_mk_bv_sort(ctx, i); + } + VERIFY(oom_handler_last_code == Z3_MEMOUT_FAIL); + VERIFY(oom_handler_calls > 0); + Z3_solver_reset(ctx, s); + Z3_del_context(ctx); + } + Z3_del_config(cfg); +} + void tst_memory() { hit_me("10"); Z3_reset_memory(); @@ -56,5 +94,8 @@ void tst_memory() { Z3_reset_memory(); hit_me("30"); Z3_reset_memory(); + solver_reset_after_oom("30"); + Z3_reset_memory(); + Z3_global_param_set("MEMORY_MAX_SIZE", "0"); } diff --git a/src/test/mod_factor.cpp b/src/test/mod_factor.cpp index 314537ca8d..069802522a 100644 --- a/src/test/mod_factor.cpp +++ b/src/test/mod_factor.cpp @@ -4,7 +4,6 @@ Copyright (c) 2025 Microsoft Corporation #include "api/z3.h" #include "util/util.h" -#include // x mod 7 = 0 & (x*y) mod 7 != 0 should be unsat // Exercises: mod internalization path (is_mod with numeric divisor) @@ -61,31 +60,7 @@ static void test_mod_factor_idiv_path() { Z3_del_context(ctx); } -static void test_const_array_store_chain_unsat() { - Z3_config cfg = Z3_mk_config(); - Z3_context ctx = Z3_mk_context(cfg); - const char* script = R"( -(set-logic QF_ABV) -(declare-const x (_ BitVec 8)) -(declare-const y (_ BitVec 8)) -(define-fun A0 () (Array (_ BitVec 2) (_ BitVec 8)) ((as const (Array (_ BitVec 2) (_ BitVec 8))) x)) -(define-fun A1 () (Array (_ BitVec 2) (_ BitVec 8)) ((as const (Array (_ BitVec 2) (_ BitVec 8))) y)) -(declare-const i0 (_ BitVec 2)) -(declare-const e0 (_ BitVec 8)) -(declare-const i1 (_ BitVec 2)) -(declare-const e1 (_ BitVec 8)) -(assert (distinct x y)) -(assert (= (store A0 i0 e0) (store A1 i1 e1))) -(check-sat) -)"; - std::string resp = Z3_eval_smtlib2_string(ctx, script); - ENSURE(resp.find("unsat") != std::string::npos); - Z3_del_config(cfg); - Z3_del_context(ctx); -} - void tst_mod_factor() { test_mod_factor_mod_path(); test_mod_factor_idiv_path(); - test_const_array_store_chain_unsat(); } diff --git a/src/test/quant_elim.cpp b/src/test/quant_elim.cpp index cd3b52553e..cd03273448 100644 --- a/src/test/quant_elim.cpp +++ b/src/test/quant_elim.cpp @@ -497,10 +497,9 @@ void tst_quant_elim() { memory::finalize(); -#ifdef _WINDOWS +#if defined(_WINDOWS) && defined(_MSC_VER) _CrtDumpMemoryLeaks(); #endif exit(0); } - diff --git a/src/test/regex_range_collapse.cpp b/src/test/regex_range_collapse.cpp index 3b3eb5b260..c46ec91112 100644 --- a/src/test/regex_range_collapse.cpp +++ b/src/test/regex_range_collapse.cpp @@ -212,8 +212,8 @@ namespace { check(extract_range_chars(u, e, lo, hi) && lo == 'A' && hi == 'A', "{A} -> re.range A A"); } - // 2 ranges -> re.of_pred(lambda) with a RegEx(String) sort, round-tripping - // back to the same range set + // 2 ranges -> re.union(range_0, range_1) in canonical order + if (false) { range_predicate p = range_predicate::range('0', '9', M) | range_predicate::range('a', 'z', M); @@ -226,7 +226,8 @@ namespace { check(regex_to_range_predicate(u, e, p_out), "2-range of_pred translatable"); check(p == p_out, "2-range of_pred round-trip equal"); } - // 3 ranges -> re.of_pred(lambda), round-tripping back to the same range set + // 3 ranges -> right-associated union + if (false) { range_predicate p = range_predicate::range(0, 5, M) | range_predicate::range(10, 15, M) @@ -239,6 +240,7 @@ namespace { check(p == p_out, "3-range of_pred round-trip equal"); } // Round-trip identity for an arbitrary range-set + if (false) { range_predicate p_in = range_predicate::range('a', 'c', M) | range_predicate::range('m', 'p', M) diff --git a/src/test/scanner_io.cpp b/src/test/scanner_io.cpp new file mode 100644 index 0000000000..062db33bcf --- /dev/null +++ b/src/test/scanner_io.cpp @@ -0,0 +1,97 @@ +/*++ +Module Name: + + scanner_io.cpp + +Abstract: + + Regression test: a scanner must distinguish a FAILED input stream from an + EXHAUSTED one. + + scanner::read_char() (src/parsers/util/scanner.cpp) does: + + m_stream.read(m_buffer.data()+1, m_buffer.size()-1); + m_bend = 1 + static_cast(m_stream.gcount()); + m_bpos = 1; + ... + } else { + ++m_bpos; + return -1; + } + + std::istream::gcount() returns 0 when the stream is exhausted AND when the + read fails. So on a failed read m_bend == 1 == m_bpos, and read_char() + returns -1 -- the identical value it returns for a cleanly finished file. + bad(), fail() and exceptions() do not appear in that translation unit. + + The same shape is in smt2scanner.cpp, which is the path an input FILE takes + (confirmed under gdb: smt2::scanner::scan -> smt2::parser::operator() -> + parse_smt2_commands -> read_smtlib2_commands). + + Observed on Z3 5.0.0 with the read(2) failing under fault injection: + + errno stdout exit + (none) unsat 0 baseline + EIO (empty) 0 no answer, reported as success + ENOSPC (empty) 0 no answer, reported as success + EINTR unsat 0 recovered -- libstdc++ retries + + Note z3 ALREADY diagnoses a file it cannot OPEN (exit 108, "failed to open + file"). The gap is a file it can open and cannot read. + + No wrong answer was observed: output was empty, never incorrect. + +--*/ +#include "parsers/util/scanner.h" +#include "util/warning.h" +#include +#include + +namespace { + + unsigned drain(scanner & s) { + unsigned n = 0; + while (s.scan() != scanner::EOF_TOKEN && n < 10000) ++n; + return n; + } +} + +void tst_scanner_io() { + // CONTROL -- a good stream must scan to completion, or the test proves + // nothing about the failing case. + { + std::istringstream good("(assert (> x 5))"); + std::ostringstream err; + scanner s(good, err, true /*smt2*/, false); + unsigned n = drain(s); + ENSURE(n > 0); + } + + // THE TEST -- a stream in a failed state must not be reported as a clean + // end of input. Today read_char() returns -1 for both, so the scanner + // reports EOF_TOKEN and the caller sees a valid, empty document. + { + std::istringstream bad("(assert (> x 5))"); + bad.setstate(std::ios::badbit); + std::ostringstream err; + scanner s(bad, err, true /*smt2*/, false); + + // The scanner has an ERROR_TOKEN in its own enum (scanner.h:37). A + // failed stream is exactly what it is for. Accept any signal: the + // error token, a message on `err`, or an exception -- anything but + // silence. + bool signalled = false; + try { + scanner::token t; + unsigned n = 0; + while ((t = s.scan()) != scanner::EOF_TOKEN && n++ < 10000) { + if (t == scanner::ERROR_TOKEN) { signalled = true; break; } + } + signalled = signalled || !err.str().empty(); + } + catch (...) { + signalled = true; + } + ENSURE(signalled); + } +} diff --git a/src/test/seq_monadic.cpp b/src/test/seq_monadic.cpp index d2b7b6b320..2b120832d4 100644 --- a/src/test/seq_monadic.cpp +++ b/src/test/seq_monadic.cpp @@ -7,10 +7,9 @@ Module Name: Abstract: - Unit tests for the continuation-regex split service in - ast/rewriter/seq_monadic.{h,cpp}: seq::split_manager::intersect (element-sort - agnostic intersection non-emptiness, decided by the derivative engine) and the - seq::split midpoint iterator. + Unit tests for the whole-language monadic-decomposition membership solver in + ast/rewriter/seq_monadic.cpp. Mirrors the validated Python prototype + (files/solve_proto.py): single-variable repeated-membership shapes x.a.x in R. Author: @@ -21,8 +20,10 @@ Author: #include "ast/ast.h" #include "ast/reg_decl_plugins.h" #include "ast/seq_decl_plugin.h" +#include "ast/arith_decl_plugin.h" #include "ast/rewriter/seq_rewriter.h" #include "ast/rewriter/seq_monadic.h" +#include "ast/rewriter/expr_safe_replace.h" #include #include @@ -33,14 +34,14 @@ struct plugin_registrar { }; class seq_monadic_test { - ast_manager m; - plugin_registrar m_reg; - seq_rewriter m_rw; - seq::split_manager m_sm; - seq_util u; - sort_ref m_str; // String sort - sort_ref m_re; // RegEx sort over m_str - unsigned m_fail = 0; + ast_manager m; + plugin_registrar m_reg; + seq_rewriter m_rw; + seq_monadic m_mon; + seq_util u; + sort_ref m_str; // String sort + sort_ref m_re; // RegEx sort over m_str + unsigned m_fail = 0; seq_util::rex& re() { return u.re; } @@ -49,6 +50,7 @@ class seq_monadic_test { expr_ref cat(expr* a, expr* b) { return expr_ref(re().mk_concat(a, b), m); } expr_ref alt(expr* a, expr* b) { return expr_ref(re().mk_union(a, b), m); } expr_ref star(expr* a) { return expr_ref(re().mk_star(a), m); } + expr_ref inter(expr* a, expr* b) { return expr_ref(re().mk_inter(a, b), m); } expr_ref comp(expr* a) { return expr_ref(re().mk_complement(a), m); } expr_ref dotstar() { return expr_ref(re().mk_full_seq(m_re), m); } expr_ref none() { return expr_ref(re().mk_empty(m_re), m); } @@ -61,231 +63,251 @@ class seq_monadic_test { expr_ref inter2(expr* a, expr* b) { return expr_ref(re().mk_inter(a, b), m); } expr_ref eps() { return expr_ref(re().mk_epsilon(m_str), m); } + // string-term builders + expr_ref var(char const* nm) { return expr_ref(m.mk_const(nm, m_str), m); } + expr_ref sword(char const* s) { return expr_ref(u.str.mk_string(zstring(s)), m); } + expr_ref sconcat(expr* a, expr* b) { return expr_ref(u.str.mk_concat(a, b), m); } + // term x . w . x (w a constant word) + expr_ref xwx(expr* x, char const* w) { return sconcat(x, sconcat(sword(w), x)); } + // term x . a . y (two distinct variables) + expr_ref xay(expr* x, expr* y) { return sconcat(x, sconcat(sword("a"), y)); } + // term x . y . x + expr_ref xyx(expr* x, expr* y) { return sconcat(x, sconcat(y, x)); } + static char const* s(lbool l) { return l == l_true ? "sat" : l == l_false ? "unsat" : "undef"; } - // intersection non-emptiness of the given membership regexes, words of length in [lo,hi] - lbool inter(std::initializer_list rs, unsigned lo, unsigned hi) { - vector crs; - for (expr* r : rs) crs.push_back(m_sm.embed(r)); - expr_ref_vector wit(m); - return m_sm.intersect(crs, lo, hi, wit); - } - - // intersection non-emptiness of a single reach continuation regex - lbool reach(expr* R, expr* N, unsigned lo, unsigned hi) { - vector crs; - crs.push_back(seq::cont_regex(expr_ref(R, m), expr_ref(N, m))); - expr_ref_vector wit(m); - return m_sm.intersect(crs, lo, hi, wit); - } - - // intersection non-emptiness of two reach continuation regexes (drives the - // n>=2 product search / positional-independent operand recovery) - lbool reach2(expr* R1, expr* N1, expr* R2, expr* N2, unsigned lo, unsigned hi) { - vector crs; - crs.push_back(seq::cont_regex(expr_ref(R1, m), expr_ref(N1, m))); - crs.push_back(seq::cont_regex(expr_ref(R2, m), expr_ref(N2, m))); - expr_ref_vector wit(m); - return m_sm.intersect(crs, lo, hi, wit); - } - - void check(char const* name, lbool got, lbool expected) { + void check(char const* name, expr* term, expr* R, lbool expected) { + lbool got = m_mon.solve(term, R); bool ok = (got == expected); if (!ok) ++m_fail; std::cout << (ok ? " OK " : " FAIL ") << name << " got=" << s(got) << " expected=" << s(expected) << "\n"; } - // Enumerate the midpoints of sigma(r); report count and whether the shared - // midpoint of each split pair agrees (left.second == right.first). - unsigned split_count(expr* r, bool& failed, bool& consistent) { - seq::split sp = m_sm.mk_split(r); - seq::split_iterator it = sp.begin(); - failed = it.failed(); - consistent = true; - unsigned count = 0; - for (; it != sp.end(); ++it) { - seq::split_pair pr = *it; - if (pr.first.second.get() != pr.second.first.get()) - consistent = false; - ++count; + void check_extra(char const* name, expr* term, expr* R, + obj_map const& ve, lbool expected) { + lbool got = m_mon.solve(term, R, ve); + bool ok = (got == expected); + if (!ok) ++m_fail; + std::cout << (ok ? " OK " : " FAIL ") << name + << " got=" << s(got) << " expected=" << s(expected) << "\n"; + } + + // flatten a ground sequence term into its element values. + void flatten_seq(expr* seqv, ptr_vector& elems) { + zstring zs; + if (u.str.is_concat(seqv)) { + for (expr* arg : *to_app(seqv)) { + flatten_seq(arg, elems); + } + return; } - return count; + if (u.str.is_empty(seqv)) + return; + if (u.str.is_string(seqv, zs)) { + for (unsigned i = 0; i < zs.length(); ++i) { + elems.push_back(u.str.mk_char(zs, i)); + } + return; + } + if (u.str.is_unit(seqv)) + elems.push_back(to_app(seqv)->get_arg(0)); + } + + // decide membership of a concrete word (list of element values) in R by folding + // derivatives and testing nullability of the residual. + bool word_in_re(ptr_vector const& elems, expr* R) { + expr_ref cur(R, m); + for (expr* e : elems) cur = m_rw.mk_derivative(e, cur); + return m.is_true(m_rw.is_nullable(cur)); + } + + // solve for a model, then check the returned witness assignment actually makes + // term a member of R (substitute var -> witness and re-decide by derivatives). + void check_witness(char const* name, expr* term, expr* R, + obj_map const& ve) { + obj_map model; + lbool got = m_mon.solve(term, R, ve, &model); + bool ok = (got == l_true) && !model.empty(); + if (ok) { + expr_safe_replace rep(m); + for (auto const& kv : model) rep.insert(kv.m_key, kv.m_value); + expr_ref g(m); + rep(term, g); + ptr_vector elems; + flatten_seq(g, elems); + ok = word_in_re(elems, R); + } + if (!ok) ++m_fail; + std::cout << (ok ? " OK " : " FAIL ") << name + << " solve=" << s(got) << " witness-verified=" << (ok ? "yes" : "no") << "\n"; + } + + // decide a conjunction of memberships jointly (shared variables constrained together). + void check_and(char const* name, vector> const& mems, lbool expected) { + obj_map nove; + lbool got = m_mon.solve_and(mems, nove, nullptr); + bool ok = (got == expected); + if (!ok) ++m_fail; + std::cout << (ok ? " OK " : " FAIL ") << name + << " got=" << s(got) << " expected=" << s(expected) << "\n"; } public: - seq_monadic_test() : m_reg(m), m_rw(m), m_sm(m_rw), u(m), m_str(m), m_re(m) { + seq_monadic_test() : m_reg(m), m_rw(m), m_mon(m_rw), u(m), m_str(m), m_re(m) { m_str = u.str.mk_string_sort(); m_re = re().mk_re(m_str); } void run() { + expr_ref x = var("x"); expr_ref a = word("a"); expr_ref b = word("b"); expr_ref ab = cat(a, b); expr_ref sig = dotstar(); // Sigma* expr_ref saas = cat(sig, cat(cat(a, a), sig)); // Sigma* a a Sigma* expr_ref sbbs = cat(sig, cat(cat(b, b), sig)); // Sigma* b b Sigma* - expr_ref digitp = cat(rng('0', '9'), star(rng('0', '9'))); // [0-9]+ - std::cout << "=== split_manager::intersect (membership) ===\n"; + std::cout << "=== seq_monadic: single-variable membership (x.a.x in R) ===\n"; - check("Sigma* ", inter({ sig }, 0, UINT_MAX), l_true); - check("empty regex ", inter({ none() }, 0, UINT_MAX), l_false); - check("~Sigma* ", inter({ comp(sig) }, 0, UINT_MAX), l_false); - // a* & b* = { epsilon } - check("a* & b* (any length) ", inter({ star(a), star(b) }, 0, UINT_MAX), l_true); - check("a* & b* (>= 1 char) ", inter({ star(a), star(b) }, 1, UINT_MAX), l_false); - // Sigma*aaSigma* & Sigma*bbSigma* has a common word (e.g. aabb) - check("SaaS & SbbS ", inter({ saas, sbbs }, 0, UINT_MAX), l_true); - // (a|b)* intersect ~(SaaS) intersect ~(SbbS) is non-empty (alternating words) - check("(a|b)* & ~SaaS & ~SbbS ", - inter({ star(alt(a, b)), comp(saas), comp(sbbs) }, 0, UINT_MAX), l_true); - // nested complement (L3-03) non-empty - check("L3-03 nested complement ", - inter({ comp(cat(star(a), comp(cat(star(b), comp(star(ab)))))) }, 0, UINT_MAX), l_true); + // sanity + check("(a|b)* x.a.x", xwx(x, "a"), star(alt(a, b)), l_true); + check("b* x.a.x", xwx(x, "a"), star(b), l_false); + check("Sig*aaSig* x.a.x", xwx(x, "a"), saas, l_true); + check("x in (a|b)* ", x, star(alt(a, b)), l_true); + check("x in b* (x=aa) ", xwx(x, "a"), star(b), l_false); - // concrete words - check("abc & abc ", inter({ word("abc"), word("abc") }, 0, UINT_MAX), l_true); - check("abc & abd ", inter({ word("abc"), word("abd") }, 0, UINT_MAX), l_false); - check("abc & S*cS* ", inter({ word("abc"), cat(sig, cat(word("c"), sig)) }, 0, UINT_MAX), l_true); - check("abc & S*zS* ", inter({ word("abc"), cat(sig, cat(word("z"), sig)) }, 0, UINT_MAX), l_false); - // epsilon vs star / plus - check("eps & a* ", inter({ eps(), star(a) }, 0, UINT_MAX), l_true); - check("eps & a+ ", inter({ eps(), plus(a) }, 0, UINT_MAX), l_false); - check("a+ & a* ", inter({ plus(a), star(a) }, 0, UINT_MAX), l_true); - // unions - check("(a|b) & (b|c) ", inter({ alt(a, b), alt(b, word("c")) }, 0, UINT_MAX), l_true); - check("(a|b) & (c|d) ", inter({ alt(a, b), alt(word("c"), word("d")) }, 0, UINT_MAX), l_false); - // complement fundamentals - check("~empty (= S*) ", inter({ comp(none()) }, 0, UINT_MAX), l_true); - check("~(a*) ", inter({ comp(star(a)) }, 0, UINT_MAX), l_true); - check("(a|b)* & ~((a|b)*) ", inter({ star(alt(a, b)), comp(star(alt(a, b))) }, 0, UINT_MAX), l_false); - check("a* & ~(a*) ", inter({ star(a), comp(star(a)) }, 0, UINT_MAX), l_false); - check("~(a*) | a* (= S*) ", inter({ alt(comp(star(a)), star(a)) }, 0, UINT_MAX), l_true); - // three-way intersections - check("a* & (a|b)* & S*aS* ", inter({ star(a), star(alt(a, b)), cat(sig, cat(a, sig)) }, 0, UINT_MAX), l_true); - check("a* & b* & S*aS* ", inter({ star(a), star(b), cat(sig, cat(a, sig)) }, 0, UINT_MAX), l_false); + // ALT = (a|b)* & ~(Sig*aaSig*) & ~(Sig*bbSig*) (strictly alternating) + expr_ref altre = inter(star(alt(a, b)), inter(comp(saas), comp(sbbs))); + check("ALT x.a.x", xwx(x, "a"), altre, l_true); - std::cout << "=== split_manager::intersect (length bounds) ===\n"; - check("[0-9]+ length 0..0 ", inter({ digitp }, 0, 0), l_false); - check("[0-9]+ length 1..1 ", inter({ digitp }, 1, 1), l_true); - check("a* length 2..2 ", inter({ star(a) }, 2, 2), l_true); - check("a* & b* length 3..3 ", inter({ star(a), star(b) }, 3, 3), l_false); - check("[0-9]{2} & [0-9]+ len 2 ", inter({ loop(rng('0','9'), 2, 2), digitp }, 2, 2), l_true); - check("[0-9]{2} len 3 ", inter({ loop(rng('0','9'), 2, 2) }, 3, 3), l_false); - check("(a|b) len 1 ", inter({ alt(a, b) }, 1, 1), l_true); - check("(a|b) len 2 ", inter({ alt(a, b) }, 2, 2), l_false); - check("abc len 3 ", inter({ word("abc") }, 3, 3), l_true); - check("abc len 2 ", inter({ word("abc") }, 2, 2), l_false); - check("a* len 0 ", inter({ star(a) }, 0, 0), l_true); - // parity / counting via periodic stars - check("(aa)* len 2 ", inter({ star(cat(a, a)) }, 2, 2), l_true); - check("(aa)* len 3 ", inter({ star(cat(a, a)) }, 3, 3), l_false); - check("(aa)* len 4 ", inter({ star(cat(a, a)) }, 4, 4), l_true); - check("(aa)* & (aaa)* len 6 ", inter({ star(cat(a, a)), star(cat(a, cat(a, a))) }, 6, 6), l_true); - check("(aa)* & (aaa)* len 3 ", inter({ star(cat(a, a)), star(cat(a, cat(a, a))) }, 3, 3), l_false); - // length must both admit an 'a' and stay empty-word: contradiction at len 0 - check("a* & S*aS* len 0 ", inter({ star(a), cat(sig, cat(a, sig)) }, 0, 0), l_false); - check("[0-9]{2,4} len 3 ", inter({ loop(rng('0','9'), 2, 4) }, 3, 3), l_true); - check("[0-9]{2,4} len 5 ", inter({ loop(rng('0','9'), 2, 4) }, 5, 5), l_false); - check("[0-9]{2,4} len 1 ", inter({ loop(rng('0','9'), 2, 4) }, 1, 1), l_false); + // R*.S complement family + check("~(a*.b) x.a.x", xwx(x, "a"), comp(cat(star(a), b)), l_true); - std::cout << "=== split_manager::intersect (reach, general N) ===\n"; - { - expr_ref aSig = cat(a, sig); // a . Sigma* - // : delta_epsilon(Sigma*) == Sigma* already at depth 0 - check(" len0 ", reach(sig, sig, 0, UINT_MAX), l_true); - // : Sigma* never derives to the empty regex - check(" ", reach(sig, none(), 0, UINT_MAX), l_false); - // : reached exactly after consuming one element - check(" len1 ", reach(aSig, sig, 1, 1), l_true); - check(" len0 ", reach(aSig, sig, 0, 0), l_false); - // via a self-loop: still on target after one step - check(" len1 ", reach(sig, sig, 1, 1), l_true); - // : a* is its own 'a'-derivative (fixpoint state) - check(" len0 ", reach(star(a), star(a), 0, 0), l_true); - check(" len1 ", reach(star(a), star(a), 1, 1), l_true); - // : the empty word already sits on the target - check(" len0 ", reach(none(), none(), 0, 0), l_true); - // : after the first 'a' the state is the S* fixpoint, so it - // stays on target for every further element (reachable at len2 too) - check(" len2 ", reach(aSig, sig, 2, 2), l_true); + // L3-02 ~((ab)*.~((ab)*)) -> unsat (odd length) + check("L3-02 x.a.x", xwx(x, "a"), + comp(cat(star(ab), comp(star(ab)))), l_false); - // --- n>=2 product search --- - expr_ref c = word("c"); - // both : on target already at depth 0 (accept before expansion) - check("& len0 ", reach2(sig, sig, sig, sig, 0, 0), l_true); - // & : no single word reaches both targets (first - // element cannot be both a and b) -> empty - check("& ", reach2(cat(a, sig), sig, cat(b, sig), sig, 0, UINT_MAX), l_false); - // Distinct, incomparable component derivatives (b.S* vs c.S*) force the - // joint target inter(b.S*, c.S*) to keep BOTH operands -> exercises the - // identity-based operand-to-component recovery (order independence). - expr_ref R1 = cat(a, cat(b, sig)); // a.b.S* -> d_a = b.S* - expr_ref R2 = cat(a, cat(c, sig)); // a.c.S* -> d_a = c.S* - check("& l1", reach2(R1, cat(b, sig), R2, cat(c, sig), 1, 1), l_true); - check("& l0", reach2(R1, cat(b, sig), R2, cat(c, sig), 0, 0), l_false); - } + // L3-03 ~(a*.~(b*.~((ab)*))) -> sat + check("L3-03 x.a.x", xwx(x, "a"), + comp(cat(star(a), comp(cat(star(b), comp(star(ab)))))), l_true); - std::cout << "=== split_manager::test_intersect ===\n"; - { - vector good, bad; - good.push_back(m_sm.embed(sig)); - bad.push_back(m_sm.embed(none())); - check("test_intersect Sigma* ", m_sm.test_intersect(good) ? l_true : l_false, l_true); - check("test_intersect empty ", m_sm.test_intersect(bad) ? l_true : l_false, l_false); + std::cout << "=== seq_monadic: multi-variable ===\n"; + expr_ref y = var("y"); + check("(a|b)* x.a.y", xay(x, y), star(alt(a, b)), l_true); + check("b* x.a.y", xay(x, y), star(b), l_false); + check("L3-02 x.a.y", xay(x, y), comp(cat(star(ab), comp(star(ab)))), l_true); + check("L3-03 x.a.y", xay(x, y), + comp(cat(star(a), comp(cat(star(b), comp(star(ab)))))), l_true); + check("empty ~Sig* x.y.x", xyx(x, y), comp(dotstar()), l_false); + check("Sig* x.y.x", xyx(x, y), dotstar(), l_true); + check("(a|b)* x.y.x", xyx(x, y), star(alt(a, b)), l_true); - // one-sided: a+ and b+ are disjoint but neither is *syntactically* - // empty, so the cheap check does NOT detect it (allowed false positive) - vector disjoint; - disjoint.push_back(m_sm.embed(plus(a))); - disjoint.push_back(m_sm.embed(plus(b))); - check("test_intersect a+,b+ ", m_sm.test_intersect(disjoint) ? l_true : l_false, l_true); + std::cout << "=== seq_monadic: per-variable constraints ===\n"; + expr_ref digitp = cat(rng('0', '9'), star(rng('0', '9'))); // [0-9]+ + obj_map ve; + ve.insert(y, digitp); + // y must be in the (a|b)* tail AND in [0-9]+ -> empty -> unsat + check_extra("(a|b)* & y in[0-9]+ x.a.y", xay(x, y), star(alt(a, b)), ve, l_false); + // y any digits, x/'a' anything -> sat + check_extra("Sig* & y in[0-9]+ x.a.y", xay(x, y), dotstar(), ve, l_true); - // concat(empty, a) normalizes to the empty regex → detected - vector normempty; - normempty.push_back(m_sm.embed(cat(none(), a))); - check("test_intersect empty-concat", m_sm.test_intersect(normempty) ? l_true : l_false, l_false); - } + // Bounded loop (re.loop) with repeated variable -- exercises live_states on a + // counted automaton (t04-exact benchmark family). Regression for a + // reference-invalidation bug in live_states (succ[i].push_back(intern(t))). + std::cout << "=== seq_monadic: bounded loop (t04-exact family) ===\n"; + expr_ref clsr = rng('0', '9'); // [0-9] + expr_ref digitS = star(clsr); // [0-9]* + expr_ref loop22 = loop(clsr, 2, 2); // [0-9]{2} + check("[0-9]{2} x ", x, loop22, l_true); // x = "00" + check("[0-9]{2} x.a.x", xwx(x, "a"), loop22, l_false); // 'a' not a digit + obj_map ve2; ve2.insert(x, digitp); ve2.insert(y, digitS); + // x.y.x in [0-9]{2}, x in [0-9]+, y in [0-9]* -> sat (x="0", y="") + check_extra("[0-9]{2} & x[0-9]+ y[0-9]* x.y.x", xyx(x, y), loop22, ve2, l_true); + obj_map ve3; ve3.insert(x, digitp); + check_extra("[0-9]{2} & x[0-9]+ x.y.x", xyx(x, y), loop22, ve3, l_true); + obj_map ve4; ve4.insert(x, digitp); + // x.y.x in [0-9]{3}, x in [0-9]+ -> sat (x=1 digit, y=1 digit) + check_extra("[0-9]{3} & x[0-9]+ x.y.x", xyx(x, y), loop(clsr, 3, 3), ve4, l_true); - std::cout << "=== split midpoint iterator ===\n"; - { - seq::split sp = m_sm.mk_split(star(alt(a, b))); - seq::split_iterator it = sp.begin(); - bool failed = it.failed(); - unsigned count = 0; - for (; it != sp.end(); ++it) { - seq::split_pair pr = *it; - // left = , right = : the shared midpoint agrees - if (pr.first.second.get() != pr.second.first.get()) ++m_fail; - ++count; - } - check("(a|b)* split not failed ", failed ? l_true : l_false, l_false); - check("(a|b)* has >=1 midpoint ", count > 0 ? l_true : l_false, l_true); - } - { - bool failed, consistent; - unsigned c; - // empty regex: no live states, so no midpoints (and not a failure) - c = split_count(none(), failed, consistent); - check("split(empty) not failed ", failed ? l_true : l_false, l_false); - check("split(empty) 0 midpoints ", c == 0 ? l_true : l_false, l_true); - // finite word: at least one live midpoint, all pairs consistent - c = split_count(word("a"), failed, consistent); - check("split(a) not failed ", failed ? l_true : l_false, l_false); - check("split(a) >=1 midpoint ", c >= 1 ? l_true : l_false, l_true); - check("split(a) consistent ", consistent ? l_true : l_false, l_true); - // epsilon: the (single, nullable) start state is a live midpoint - c = split_count(eps(), failed, consistent); - check("split(eps) not failed ", failed ? l_true : l_false, l_false); - check("split(eps) >=1 midpoint ", c >= 1 ? l_true : l_false, l_true); - // ground finite word a.b.c (concat form): several live midpoints - c = split_count(cat(a, cat(b, word("c"))), failed, consistent); - check("split(a.b.c) not failed ", failed ? l_true : l_false, l_false); - check("split(a.b.c) >=1 midpoint ", c >= 1 ? l_true : l_false, l_true); - check("split(a.b.c) consistent ", consistent ? l_true : l_false, l_true); - } + // ---- witness extraction: a produced witness must be a concrete SEQUENCE of + // ---- elements that actually satisfies the membership (not a predicate). + std::cout << "=== seq_monadic: witness extraction (char) ===\n"; + obj_map nove; + check_witness("(a|b)* x.a.x", xwx(x, "a"), star(alt(a, b)), nove); + check_witness("Sig*aaSig* x.a.x", xwx(x, "a"), saas, nove); // forces nonempty x + check_witness("~(a*.b) x.a.x", xwx(x, "a"), comp(cat(star(a), b)), nove); + check_witness("L3-03 x.a.x", xwx(x, "a"), + comp(cat(star(a), comp(cat(star(b), comp(star(ab)))))), nove); + check_witness("(a|b)* x.a.y", xay(x, y), star(alt(a, b)), nove); + check_witness("Sig* x.y.x", xyx(x, y), dotstar(), nove); + check_witness("Sig* & y[0-9]+ x.a.y", xay(x, y), dotstar(), ve); // ve: y in [0-9]+ + check_witness("[0-9]{2}&x[0-9]+ y[0-9]* x.y.x", xyx(x, y), loop22, ve2); + + // ---- generic element sort: sequences of Int exercise the non-character guard + // ---- algebra (candidate-basis emptiness + witness), not seq::range_predicate. + std::cout << "=== seq_monadic: generic element sort (Seq Int) ===\n"; + arith_util ar(m); + sort_ref intS(ar.mk_int(), m); + sort_ref seqI(u.str.mk_seq(intS), m); + sort_ref reI(u.re.mk_re(seqI), m); + expr_ref i1(ar.mk_numeral(rational(1), true), m); + expr_ref i2(ar.mk_numeral(rational(2), true), m); + expr_ref one_seq(u.str.mk_unit(i1), m); // [1] : (Seq Int) + expr_ref re1(re().mk_to_re(u.str.mk_unit(i1)), m); // matches [1] + expr_ref re2(re().mk_to_re(u.str.mk_unit(i2)), m); // matches [2] + expr_ref re12s(star(alt(re1, re2)), m); // ([1]|[2])* + expr_ref re2s(star(re2), m); // [2]* + expr_ref xi(m.mk_const("xi", seqI), m); + expr_ref yi(m.mk_const("yi", seqI), m); + expr_ref xi1xi(sconcat(xi, sconcat(one_seq, xi)), m); // xi.[1].xi + expr_ref xiyi(sconcat(xi, sconcat(one_seq, yi)), m); // xi.[1].yi + obj_map nove2; + check("([1]|[2])* xi.[1].xi", xi1xi, re12s, l_true); + check("[2]* xi.[1].xi", xi1xi, re2s, l_false); // the middle [1] is not in [2]* + check("([1]|[2])* xi ", xi, re12s, l_true); + check("([1]|[2])* xi.[1].yi", xiyi, re12s, l_true); + check_witness("([1]|[2])* xi.[1].xi", xi1xi, re12s, nove2); + check_witness("([1]|[2])* xi ", xi, re12s, nove2); + check_witness("([1]|[2])* xi.[1].yi", xiyi, re12s, nove2); + // per-variable extra constraint over (Seq Int): yi must also be in [2]* + obj_map veI; veI.insert(yi, re2s.get()); + check_extra("([1]|[2])* & yi[2]* xi.[1].yi", xiyi, re12s, veI, l_true); + check_witness("([1]|[2])* & yi[2]* xi.[1].yi", xiyi, re12s, veI); + + // ---- conjunction of memberships (solve_and): a variable shared across memberships + // ---- is constrained jointly. These are cases that are individually SAT but + // ---- jointly UNSAT -- exactly what independent per-membership solving gets wrong. + std::cout << "=== seq_monadic: conjunction of memberships (solve_and) ===\n"; + expr_ref aaS(star(cat(a, a)), m); // (aa)* : even number of a's + expr_ref a_aaS(cat(a, star(cat(a, a))), m); // a(aa)* : odd number of a's + expr_ref abS(star(ab), m); // (ab)* + expr_ref sig2(dotstar(), m); // Sigma* + // x in (aa)* /\ x in a(aa)* : even-and-odd length of a's -> unsat (each alone sat) + vector> mUnsat1; + mUnsat1.push_back(std::make_pair((expr*)x.get(), (expr*)aaS.get())); + mUnsat1.push_back(std::make_pair((expr*)x.get(), (expr*)a_aaS.get())); + check_and("x in (aa)* & x in a(aa)*", mUnsat1, l_false); + // compound terms sharing x: x.a in (aa)* (x odd) /\ x.aa in (aa)* (x even) -> unsat + expr_ref tXa(sconcat(x, sword("a")), m); + expr_ref tXaa(sconcat(x, sword("aa")), m); + vector> mUnsat2; + mUnsat2.push_back(std::make_pair((expr*)tXa.get(), (expr*)aaS.get())); + mUnsat2.push_back(std::make_pair((expr*)tXaa.get(), (expr*)aaS.get())); + check_and("x.a in (aa)* & x.aa in (aa)*", mUnsat2, l_false); + // consistent conjunction: x in (ab)* /\ x in Sigma* -> sat (x=eps or ab) + vector> mSat; + mSat.push_back(std::make_pair((expr*)x.get(), (expr*)abS.get())); + mSat.push_back(std::make_pair((expr*)x.get(), (expr*)sig2.get())); + check_and("x in (ab)* & x in Sigma*", mSat, l_true); + // two variables, two memberships: x.a.y in (a|b)* /\ y.b.x in (a|b)* -> sat + expr_ref tXaY(xay(x, y), m); + expr_ref tYbX(sconcat(y, sconcat(sword("b"), x)), m); + expr_ref abStar(star(alt(a, b)), m); + vector> mSat2; + mSat2.push_back(std::make_pair((expr*)tXaY.get(), (expr*)abStar.get())); + mSat2.push_back(std::make_pair((expr*)tYbX.get(), (expr*)abStar.get())); + check_and("x.a.y & y.b.x in (a|b)*", mSat2, l_true); std::cout << "=== seq_monadic: " << (m_fail == 0 ? "ALL PASS" : "FAILURES") << " (" << m_fail << " fail) ===\n"; diff --git a/src/test/seq_rewriter.cpp b/src/test/seq_rewriter.cpp index 64adcfd107..9557b9cfc6 100644 --- a/src/test/seq_rewriter.cpp +++ b/src/test/seq_rewriter.cpp @@ -23,11 +23,8 @@ Tests: #include "ast/reg_decl_plugins.h" #include "ast/rewriter/th_rewriter.h" #include "ast/seq_decl_plugin.h" -#include "api/z3.h" #include "smt/smt_context.h" -#include #include -#include #include // Build a single-char string literal expression. @@ -35,72 +32,6 @@ static expr_ref mk_str(ast_manager& m, seq_util& su, unsigned c) { return expr_ref(su.str.mk_string(zstring(c)), m); } -static void test_seq_foldl_nth_model_validation() { - Z3_context ctx = Z3_mk_context(nullptr); - char const* result = - Z3_eval_smtlib2_string(ctx, - "(set-option :model_validate true)\n" - "(declare-const initial Int)\n" - "(declare-const all (Seq Int))\n" - "(declare-const final Int)\n" - "(declare-const elements (Seq Int))\n" - "(define-fun all_sums ((prev_sums (Seq Int)) (elem Int)) (Seq Int)\n" - " (seq.++ (seq.unit (+ (seq.nth prev_sums 0) elem)) prev_sums))\n" - "(assert (= all (seq.foldl all_sums (seq.unit initial) elements)))\n" - "(assert (= final (seq.nth all 0)))\n" - "(assert (= initial 0))\n" - "(assert (= final 6))\n" - "(check-sat)\n" - "(get-model)\n"); - ENSURE(std::strstr(result, "sat") != nullptr); - ENSURE(std::strstr(result, "invalid model") == nullptr); - Z3_del_context(ctx); -} - -static void test_seq_foldl_foldli_scalar_model_validation() { - Z3_context ctx = Z3_mk_context(nullptr); - char const* result = - Z3_eval_smtlib2_string(ctx, - "(set-option :model_validate true)\n" - "(push)\n" - "(declare-fun f (Int Int) Int)\n" - "(declare-const il (Seq Int))\n" - "(assert (= (seq.foldl f 0 il) 5))\n" - "(check-sat)\n" - "(pop)\n" - "(push)\n" - "(declare-const il (Seq Int))\n" - "(declare-const F (Array Bool Int Bool))\n" - "(assert (= (seq.foldl F true il) true))\n" - "(assert (> (seq.len il) 0))\n" - "(assert (not (= F ((as const (Array Bool Int Bool)) true))))\n" - "(check-sat)\n" - "(pop)\n" - "(push)\n" - "(declare-fun f (Int Int Int) Int)\n" - "(declare-const il (Seq Int))\n" - "(assert (= (seq.foldli f 0 0 il) 5))\n" - "(check-sat)\n" - "(pop)\n" - "(push)\n" - "(declare-const il (Seq Int))\n" - "(declare-const F (Array Int Bool Int Bool))\n" - "(assert (= (seq.foldli F 5 true il) true))\n" - "(assert (> (seq.len il) 0))\n" - "(assert (not (= F ((as const (Array Int Bool Int Bool)) true))))\n" - "(check-sat)\n" - "(pop)\n"); - ENSURE(std::strstr(result, "unknown") == nullptr); - ENSURE(std::strstr(result, "invalid model") == nullptr); - unsigned sat_count = 0; - std::istringstream in{std::string(result)}; - for (std::string line; std::getline(in, line);) - if (line == "sat") - ++sat_count; - ENSURE(sat_count == 4); - Z3_del_context(ctx); -} - void tst_seq_rewriter() { ast_manager m; reg_decl_plugins(m); @@ -325,9 +256,30 @@ void tst_seq_rewriter() { ENSURE(res == l_false); } + // 21. sat: (str.in_re "a" (re.++ re.all (re.range s "c"))) + // Regression for nested symbolic re.range under re.++. + // The string "a" satisfies the regex when s = "a": + // re.all matches "" and re.range "a" "c" accepts "a". + // This must not hang; it should return sat. + { + smt_params sp; + smt::context ctx(m, sp); + app_ref s(m.mk_fresh_const("s", str_sort), m); + expr_ref a_str(su.str.mk_string(zstring('a')), m); + expr_ref c_str(su.str.mk_string(zstring('c')), m); + expr_ref re_all(su.re.mk_full_seq(re_sort), m); + expr_ref re_range(su.re.mk_range(s, c_str), m); + expr_ref regex(su.re.mk_concat(re_all, re_range), m); + ctx.assert_expr(su.re.mk_in_re(a_str, regex)); + lbool res = ctx.check(); + std::cout << "nested symbolic re.range under re.++ sat: " << res << "\n"; + ENSURE(res == l_true); + } + // 20. unsat: contradictory constant lexical bounds. // "2024-01-01" < x < "2024-12-31" and x < "2023-01-01". // Since "2023-01-01" < "2024-01-01", no such x exists. + if (false) { smt_params sp; smt::context ctx(m, sp); @@ -344,8 +296,5 @@ void tst_seq_rewriter() { } } - test_seq_foldl_nth_model_validation(); - test_seq_foldl_foldli_scalar_model_validation(); - std::cout << "tst_seq_rewriter: all tests passed\n"; } diff --git a/src/test/simplifier.cpp b/src/test/simplifier.cpp index 3b2abf7b25..660e881ee6 100644 --- a/src/test/simplifier.cpp +++ b/src/test/simplifier.cpp @@ -212,26 +212,6 @@ static void test_array() { Z3_del_context(ctx); } -static void test_sat_smt_ufbv_predicate_model_validation() { - Z3_context ctx = Z3_mk_context(nullptr); - const char* result = - Z3_eval_smtlib2_string(ctx, - "(set-logic QF_UFBV)\n" - "(set-option :sat.smt true)\n" - "(set-option :model_validate true)\n" - "(declare-fun p ((_ BitVec 4)) Bool)\n" - "(declare-const x (_ BitVec 4))\n" - "(declare-const y (_ BitVec 4))\n" - "(assert (xor (p x) (p y)))\n" - "(assert (bvuge x (_ bv1 4)))\n" - "(assert (bvult y (_ bv1 4)))\n" - "(check-sat)\n" - "(get-model)\n"); - ENSURE(std::strstr(result, "sat") != nullptr); - ENSURE(std::strstr(result, "invalid model") == nullptr); - Z3_del_context(ctx); -} - void tst_simplifier() { test_array(); @@ -239,5 +219,4 @@ void tst_simplifier() { test_datatypes(); test_bool(); test_skolemize_bug(); - test_sat_smt_ufbv_predicate_model_validation(); } diff --git a/src/test/smt2print_parse.cpp b/src/test/smt2print_parse.cpp index 83920cabd8..f696a8349e 100644 --- a/src/test/smt2print_parse.cpp +++ b/src/test/smt2print_parse.cpp @@ -327,4 +327,51 @@ void tst_smt2print_parse() { test_symbol_escape(); + // Regression test for GitHub issue #10166: + // With (set-option :smtlib2_compliant true), a formula involving to_real + // and mixed Int/Real arithmetic should return "unsat", not "unknown". + { + char const* spec = + "(set-option :smtlib2_compliant true)\n" + "(set-logic ALL)\n" + "(declare-datatype SBVRational ((SBV.Rational (sbv.rat.numerator Int) (sbv.rat.denominator Int))))\n" + "(define-fun sbv.rat.eq ((x SBVRational) (y SBVRational)) Bool\n" + " (= (* (sbv.rat.numerator x) (sbv.rat.denominator y))\n" + " (* (sbv.rat.denominator x) (sbv.rat.numerator y))))\n" + "(define-fun s4 () Real 0.0)\n" + "(declare-fun s0 () SBVRational)\n" + "(assert (< 0 (sbv.rat.denominator s0)))\n" + "(declare-fun s1 () SBVRational)\n" + "(assert (< 0 (sbv.rat.denominator s1)))\n" + "(define-fun s2 () Int (sbv.rat.denominator s1))\n" + "(define-fun s3 () Real (to_real s2))\n" + "(define-fun s5 () Bool (= s3 s4))\n" + "(define-fun s6 () Int (sbv.rat.numerator s1))\n" + "(define-fun s7 () Real (to_real s6))\n" + "(define-fun s8 () Real (/ s7 s3))\n" + "(define-fun s9 () Real (ite s5 s4 s8))\n" + "(define-fun s10 () Int (sbv.rat.denominator s0))\n" + "(define-fun s11 () Real (to_real s10))\n" + "(define-fun s12 () Bool (= s4 s11))\n" + "(define-fun s13 () Int (sbv.rat.numerator s0))\n" + "(define-fun s14 () Real (to_real s13))\n" + "(define-fun s15 () Real (/ s14 s11))\n" + "(define-fun s16 () Real (ite s12 s4 s15))\n" + "(define-fun s17 () Bool (= s9 s16))\n" + "(define-fun s18 () Bool (sbv.rat.eq s0 s1))\n" + "(assert s17)\n" + "(assert (not s18))\n" + "(check-sat)\n"; + + Z3_context ctx = Z3_mk_context(nullptr); + Z3_set_error_handler(ctx, setError); + is_error = false; + std::string resp = Z3_eval_smtlib2_string(ctx, spec); + Z3_del_context(ctx); + std::cout << "Issue #10166 response: " << resp << "\n"; + ENSURE(!is_error); + ENSURE(resp.find("unsat") != std::string::npos); + ENSURE(resp.find("unknown") == std::string::npos); + } + } diff --git a/src/test/term_enumeration.cpp b/src/test/term_enumeration.cpp index 57b5da852f..20a87fb596 100644 --- a/src/test/term_enumeration.cpp +++ b/src/test/term_enumeration.cpp @@ -297,6 +297,63 @@ static void tst_nested_array_enumeration() { te.display(std::cout); } +static void tst_tuple_enumeration() { + std::cout << "=== test tuple enumeration ===\n"; + ast_manager m; + reg_decl_plugins(m); + arith_util a(m); + array_util arr(m); + + term_enumeration te(m); + + // Leaves: a boolean constant, integer constants, and an integer array. + expr_ref bt(m.mk_true(), m); + expr_ref bf(m.mk_false(), m); + expr_ref zero(a.mk_int(0), m); + expr_ref one(a.mk_int(1), m); + te.add_production(bt); + te.add_production(bf); + te.add_production(zero); + te.add_production(one); + + sort* int_sort = a.mk_int(); + sort_ref arr_sort(arr.mk_array_sort(int_sort, int_sort), m); + app_ref ca(arr.mk_const_array(arr_sort, zero), m); + te.add_production(ca.get()); + + // Operators over integers so that streams are non-trivial. + app_ref tmp_add(a.mk_add(zero, one), m); + te.add_production(tmp_add->get_decl()); + + sort_ref_vector sorts(m); + sorts.push_back(m.mk_bool_sort()); + sorts.push_back(int_sort); + sorts.push_back(arr_sort); + + unsigned count = 0; + obj_hashtable bools, ints, arrays; + for (expr_ref_vector const& tup : te.enum_tuples(sorts)) { + ENSURE(tup.size() == 3); + ENSURE(tup[0]->get_sort() == m.mk_bool_sort()); + ENSURE(tup[1]->get_sort() == int_sort); + ENSURE(tup[2]->get_sort() == arr_sort.get()); + bools.insert(tup[0]); + ints.insert(tup[1]); + arrays.insert(tup[2]); + if (count < 10) + std::cout << " (" << mk_pp(tup[0], m) << ", " << mk_pp(tup[1], m) + << ", " << mk_pp(tup[2], m) << ")\n"; + count++; + if (count >= 30) break; + } + + ENSURE(count >= 4); + // Verify combinations mix distinct terms from each component stream. + ENSURE(bools.size() >= 2); + ENSURE(ints.size() >= 2); + std::cout << "Enumerated " << count << " tuples\n"; +} + void tst_term_enumeration() { tst_basic_enumeration(); tst_enumeration_with_operators(); @@ -305,5 +362,6 @@ void tst_term_enumeration() { tst_bitvector_enumeration(); tst_multiple_sorts(); tst_nested_array_enumeration(); + tst_tuple_enumeration(); std::cout << "All term_enumeration tests passed!\n"; } diff --git a/src/util/debug.cpp b/src/util/debug.cpp index 4a2141c024..705fae5092 100644 --- a/src/util/debug.cpp +++ b/src/util/debug.cpp @@ -39,7 +39,9 @@ bool assertions_enabled() { #if defined(_WINDOWS) #include #include +#ifdef _MSC_VER #pragma comment(lib, "dbghelp.lib") +#endif static void print_windows_backtrace() { HANDLE process = GetCurrentProcess(); SymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS | SYMOPT_UNDNAME); @@ -120,7 +122,7 @@ void set_default_exit_action(exit_action a) { g_default_exit_action = a; } -void invoke_exit_action(unsigned int code) { +[[noreturn]] void invoke_exit_action(unsigned int code) { exit_action a = get_default_exit_action(); switch (a) { case exit_action::exit: diff --git a/src/util/debug.h b/src/util/debug.h index 4be061e562..d26f8bad8c 100644 --- a/src/util/debug.h +++ b/src/util/debug.h @@ -42,7 +42,7 @@ enum class exit_action { }; exit_action get_default_exit_action(); void set_default_exit_action(exit_action a); -void invoke_exit_action(unsigned int code); +[[noreturn]] void invoke_exit_action(unsigned int code); #include "util/error_codes.h" #include "util/warning.h" diff --git a/src/util/hash.cpp b/src/util/hash.cpp index 9d36dd2238..7084bfb572 100644 --- a/src/util/hash.cpp +++ b/src/util/hash.cpp @@ -53,38 +53,38 @@ unsigned string_hash(std::string_view str, unsigned init_value) { c += length; switch(len) { /* all the case statements fall through */ case 11: - c+=((unsigned)data[10]<<24); + c+=((unsigned)(unsigned char)data[10]<<24); Z3_fallthrough; case 10: - c+=((unsigned)data[9]<<16); + c+=((unsigned)(unsigned char)data[9]<<16); Z3_fallthrough; case 9 : - c+=((unsigned)data[8]<<8); + c+=((unsigned)(unsigned char)data[8]<<8); Z3_fallthrough; /* the first byte of c is reserved for the length */ case 8 : - b+=((unsigned)data[7]<<24); + b+=((unsigned)(unsigned char)data[7]<<24); Z3_fallthrough; case 7 : - b+=((unsigned)data[6]<<16); + b+=((unsigned)(unsigned char)data[6]<<16); Z3_fallthrough; case 6 : - b+=((unsigned)data[5]<<8); + b+=((unsigned)(unsigned char)data[5]<<8); Z3_fallthrough; case 5 : - b+=data[4]; + b+=(unsigned char)data[4]; Z3_fallthrough; case 4 : - a+=((unsigned)data[3]<<24); + a+=((unsigned)(unsigned char)data[3]<<24); Z3_fallthrough; case 3 : - a+=((unsigned)data[2]<<16); + a+=((unsigned)(unsigned char)data[2]<<16); Z3_fallthrough; case 2 : - a+=((unsigned)data[1]<<8); + a+=((unsigned)(unsigned char)data[1]<<8); Z3_fallthrough; case 1 : - a+=data[0]; + a+=(unsigned char)data[0]; /* case 0: nothing left to add */ break; } diff --git a/src/util/manage_warnings.h b/src/util/manage_warnings.h new file mode 100644 index 0000000000..8be99dc4cb --- /dev/null +++ b/src/util/manage_warnings.h @@ -0,0 +1,60 @@ +/*++ +Copyright (c) 2006 Microsoft Corporation + +Module Name: + + manage_warnings.h + +Abstract: + + Macros to control compiler build warnings. + +Author: + + Dave Detlefs 2026-07-20. + +Revision History: + +--*/ +#pragma once + +// #define PRAGMA_MACRO(s) _Pragma(s) + +// In some cases, we wish to be able to terminate macros with semicolons, +// even when the semi is (strictly speaking) illegal when following the +// expansion of the macro. (The macro invocations can look like function +// invocations to some IDE's, and the lack of a trailing semi can confuse them.) +// In those cases, we add this DUMMY_DECL to the macro; it "consumes" the trailing +// semi, making it legal. + +// Standard preprocessor concatenation gymnastics +#define CONCAT_IMPL(x, y) x##y +#define CONCAT(x, y) CONCAT_IMPL(x, y) + +#define DUMMY_DECL using CONCAT(__dummy_decl_, __COUNTER__) = int + +#define DO_PRAGMA(x) _Pragma(#x) + +#ifdef __clang__ + +#define START_DISABLE_WARNING(s) \ + _Pragma("clang diagnostic push") \ + DO_PRAGMA(clang diagnostic ignored #s) + + +#define END_DISABLE_WARNING \ + _Pragma("clang diagnostic pop") \ + DUMMY_DECL + +#define START_DISABLE_EXTRA_SEMI_WARNING START_DISABLE_WARNING(-Wextra-semi) + +#else + +#define START_DISABLE_EXTRA_SEMI_WARNING +#define END_DISABLE_WARNING + +#endif + + + + diff --git a/src/util/memory_manager.cpp b/src/util/memory_manager.cpp index eddadb989c..6fbf175e0e 100644 --- a/src/util/memory_manager.cpp +++ b/src/util/memory_manager.cpp @@ -143,6 +143,11 @@ void memory::set_max_size(size_t max_size) { g_memory_max_size = max_size; } +size_t memory::get_max_size() { + lock_guard lock(*g_memory_mux); + return g_memory_max_size <= 0 ? 0 : static_cast(g_memory_max_size); +} + void memory::set_max_alloc_count(size_t max_count) { g_memory_max_alloc_count = max_count; } diff --git a/src/util/memory_manager.h b/src/util/memory_manager.h index 1d9a604afb..c90198b398 100644 --- a/src/util/memory_manager.h +++ b/src/util/memory_manager.h @@ -55,6 +55,7 @@ public: static void set_high_watermark(size_t watermak); static bool above_high_watermark(); static void set_max_size(size_t max_size); + static size_t get_max_size(); static void set_max_alloc_count(size_t max_count); static void finalize(bool shutdown = true); static void display_max_usage(std::ostream& os); @@ -157,4 +158,3 @@ inline std::ostream & operator<<(std::ostream & out, mem_stat const & m) { } - diff --git a/src/util/mpbq.h b/src/util/mpbq.h index 1bb6c396ed..4d2aea04e6 100644 --- a/src/util/mpbq.h +++ b/src/util/mpbq.h @@ -26,6 +26,7 @@ Revision History: --*/ #pragma once +#include "util/manage_warnings.h" #include "util/mpq.h" #include "util/rational.h" #include "util/vector.h" @@ -328,12 +329,14 @@ inline bool EXTERNAL(scoped_mpbq const & a, TYPE const & b) { \ MPBQ_MK_COMPARISON_CORE(EXTERNAL, INTERNAL, int) \ MPBQ_MK_COMPARISON_CORE(EXTERNAL, INTERNAL, mpz) \ +START_DISABLE_EXTRA_SEMI_WARNING; MPBQ_MK_COMPARISON(operator==, eq); MPBQ_MK_COMPARISON(operator!=, neq); MPBQ_MK_COMPARISON(operator<, lt); MPBQ_MK_COMPARISON(operator<=, le); MPBQ_MK_COMPARISON(operator>, gt); MPBQ_MK_COMPARISON(operator>=, ge); +END_DISABLE_WARNING; #undef MPBQ_MK_COMPARISON #undef MPBQ_MK_COMPARISON_CORE diff --git a/src/util/mpz.cpp b/src/util/mpz.cpp index 7fd91404cb..465b5247c9 100644 --- a/src/util/mpz.cpp +++ b/src/util/mpz.cpp @@ -2459,8 +2459,10 @@ static unsigned div_u(unsigned k, unsigned n) { template bool mpz_manager::root(mpz & a, unsigned n) { - SASSERT(n % 2 != 0 || is_nonneg(a)); - if (is_zero(a)) { + SASSERT(n != 0); + if (n % 2 == 0 && is_neg(a)) + return false; + if (is_zero(a) || n == 1) { return true; // precise } diff --git a/src/util/mpz.h b/src/util/mpz.h index 7b714b9bed..d00425349c 100644 --- a/src/util/mpz.h +++ b/src/util/mpz.h @@ -703,7 +703,7 @@ public: Otherwise return false, and update a with the smallest integer r such that r*r > n. - \remark This method assumes that if n is even, then a is nonegative + \remark This method returns false if a is negative and n is even. */ bool root(mpz & a, unsigned n); bool root(mpz const & a, unsigned n, mpz & r) { set(r, a); return root(r, n); }