diff --git a/SSA/Projects/InstCombine/scripts/README.md b/SSA/Projects/InstCombine/scripts/README.md new file mode 100644 index 000000000..9224beb01 --- /dev/null +++ b/SSA/Projects/InstCombine/scripts/README.md @@ -0,0 +1,12 @@ +These scripts are used to generate .lean files for bitblasting proofs. + +mlir-tool.py generates .lean files based on LLVM's test cases. + +types.py generates _proof.lean files from mlir-tool's output. These files contain theorems that should be solvable by bitblasting. + +To use: + +- Download and build llvm (with the mlir option) from [github](https://github.com/llvm/llvm-project) +- Add llvm's built binaires to your path +- Insert the path from lean-mlir to llvm-project in config.py +- run run.sh from this directory \ No newline at end of file diff --git a/SSA/Projects/InstCombine/scripts/all.sh b/SSA/Projects/InstCombine/scripts/all.sh deleted file mode 100644 index 97f876c2f..000000000 --- a/SSA/Projects/InstCombine/scripts/all.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env sh -# Directory containing the .lean files -DIR="./tests/LLVM" - -# Output file -OUTPUT_FILE="all.lean" - -# Initialize the output file -echo "" > $OUTPUT_FILE - -# List all files in the directory, filter out *_proof.lean files, and process the remaining files -for file in "$DIR"/*.lean; do - # Check if the file does not end with *_proof.lean - if [[ ! $file =~ _proof\.lean$ ]]; then - # Extract the filename without the directory path - filename=$(basename "$file" .lean) - # Append the import statement to the output file - echo "import SSA.Projects.InstCombine.tests.LLVM.$filename" >> $OUTPUT_FILE - fi -done - -echo "all.lean file has been created with the necessary import statements." diff --git a/SSA/Projects/InstCombine/scripts/cfg.py b/SSA/Projects/InstCombine/scripts/cfg.py new file mode 100644 index 000000000..3c718e7dc --- /dev/null +++ b/SSA/Projects/InstCombine/scripts/cfg.py @@ -0,0 +1,6 @@ +llvm_path="" + +if len(llvm_path) == 0: + raise ValueError("You need to give the path to llvm in config.py") + +test_path="SSA/Projects/InstCombine/tests/LLVM" \ No newline at end of file diff --git a/SSA/Projects/InstCombine/scripts/mlir-tool.py b/SSA/Projects/InstCombine/scripts/mlir-tool.py index c2eaf9bda..2dc3aae04 100644 --- a/SSA/Projects/InstCombine/scripts/mlir-tool.py +++ b/SSA/Projects/InstCombine/scripts/mlir-tool.py @@ -23,6 +23,7 @@ from pathlib import Path from xdsl.printer import Printer from multiprocessing import Pool +from cfg import * # Initialize the MLIR context and register the LLVM dialect ctx = MLContext(allow_unregistered=True) @@ -106,25 +107,18 @@ def parse_module(module): def parse_from_file(file_name): return parse_module(read_file(file_name)) +rm_tests = "\nrm -r " + test_path + "/*\n" -# subprocess.run(""" -# cd SSA/Projects/InstCombine/scripts && -# rm -rf ./llvm-project-main && -# curl -o llvm-project-main.zip https://codeload.github.com/llvm/llvm-project/zip/refs/heads/main && -# unzip llvm-project-main.zip -# """, shell=True) +llvm_test_path = llvm_path + "/llvm/test/Transforms/InstCombine" -subprocess.run(""" -rm -f SSA/Projects/InstCombine/tests/LLVM/* -""", shell=True) +subprocess.run(rm_tests, shell=True) expensive_files = [ "pr96012.ll" ] -directory = os.fsencode( - "SSA/Projects/InstCombine/scripts/llvm-project-main/llvm/test/Transforms/InstCombine" -) +directory = os.fsencode(llvm_test_path) + # for file in os.listdir(directory): def process_file(file): filename = os.fsdecode(file) @@ -135,16 +129,16 @@ def process_file(file): stem = "g" + filename.split(".")[0].replace("-", "h") output = "" - # module1 = parse_from_file(os.path.join("../vcombined-mlir", filename)) - full_name = f"SSA/Projects/InstCombine/scripts/llvm-project-main/llvm/test/Transforms/InstCombine/{filename}" - print(f"opt -passes=instcombine -S {full_name} | mlir-translate -import-llvm | mlir-opt --mlir-print-op-generic") + full_name = f"{llvm_test_path}/{filename}" + run_process1 = f"opt -passes=instcombine -S {full_name} | mlir-translate -import-llvm | mlir-opt --mlir-print-op-generic" + print(run_process1) process1 = subprocess.run( - f"opt -passes=instcombine -S {full_name} | mlir-translate -import-llvm | mlir-opt --mlir-print-op-generic", + run_process1, shell=True, capture_output=True, encoding="utf-8" ) - # print(process1) + module1 = parse_module( process1.stdout ) @@ -158,7 +152,7 @@ def process_file(file): ) if module1 is None or module2 is None: return - # module2 = parse_from_file(os.path.join("../vbefore-mlir", filename)) + funcs = [ func for func in module1.walk() @@ -207,14 +201,7 @@ def {name}_after := [llvm| all_goals (try extract_goal ; sorry) ---END {name}\n\n\n""" print(o1) - write_file = os.path.join( - "SSA", - "Projects", - "InstCombine", - "tests", - "LLVM", - f"{stem}.lean", - ) + write_file = f"{test_path}/{stem}.lean" with open(write_file, "a+") as f3: if os.stat(write_file).st_size == 0: f3.write( @@ -235,7 +222,6 @@ def {name}_after := [llvm| """ ) f3.write(o1) - # with open(write_file, "a+") as f3: - # f3.write(f"end {stem}_statements") + with Pool(7) as p: p.map(process_file, os.listdir(directory)) diff --git a/SSA/Projects/InstCombine/scripts/process.sh b/SSA/Projects/InstCombine/scripts/process.sh deleted file mode 100644 index b3f679548..000000000 --- a/SSA/Projects/InstCombine/scripts/process.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env sh - -# Create necessary directories -# mkdir -p combined combined-mlir before-mlir -mkdir -p vcombined vcombined-mlir vbefore-mlir - -# Loop through each .ll file in the specified directory -for file in llvm-project-main/llvm/test/Transforms/InstCombine/*.ll; do - # Extract the filename without path - filename=$(basename "$file") - d="${filename%.ll}" - - # Extract the RUN command - run_cmd=$(grep '^; RUN:' "$file" | head -n 1 | sed 's/^; RUN: //' | sed 's/ |.*$//') - echo $run_cmd - - # If the command doesn't end with -S, add it - if [[ ! $run_cmd =~ -S$ ]]; then - run_cmd="$run_cmd -S" - fi - run_cmd="${run_cmd/-disable-output/}" - - # Replace %s with the actual filename - run_cmd="${run_cmd//%s/$file}" - echo $run_cmd - # Run the extracted command and save the output - eval "$run_cmd" > "vcombined/${d}.ll" - - # Convert the processed LLVM to MLIR - mlir-translate -import-llvm "vcombined/${d}.ll" | mlir-opt --mlir-print-op-generic > "vcombined-mlir/${d}.ll.mlir" - - # Convert the original LLVM to MLIR - mlir-translate -import-llvm "$file" | mlir-opt --mlir-print-op-generic > "vbefore-mlir/${d}.ll.mlir" -done diff --git a/SSA/Projects/InstCombine/scripts/run.sh b/SSA/Projects/InstCombine/scripts/run.sh new file mode 100644 index 000000000..ac785bb96 --- /dev/null +++ b/SSA/Projects/InstCombine/scripts/run.sh @@ -0,0 +1,5 @@ +cd ../../../.. + +python SSA/Projects/InstCombine/scripts/mlir-tool.py + +python SSA/Projects/InstCombine/scripts/types.py \ No newline at end of file diff --git a/SSA/Projects/InstCombine/scripts/test.py b/SSA/Projects/InstCombine/scripts/test.py deleted file mode 100644 index 43569e917..000000000 --- a/SSA/Projects/InstCombine/scripts/test.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python3 - -#!/usr/bin/env python3 -from xdsl.dialects.builtin import ModuleOp -from xdsl.dialects.llvm import LLVM, ReturnOp -from xdsl.utils.exceptions import ParseError -from xdsl.context import MLContext -from xdsl.dialects import get_all_dialects -from xdsl.dialects.llvm import FuncOp -from xdsl.parser import Parser -from xdsl.printer import Printer -from xdsl.dialects.builtin import ( - Builtin, - IndexType, - IntegerAttr, - IntegerType, - ModuleOp, - StringAttr, - i32, - i64, -) -import os -import io -import subprocess -from pathlib import Path -from xdsl.printer import Printer -from multiprocessing import Pool - -# Initialize the MLIR context and register the LLVM dialect -ctx = MLContext(allow_unregistered=True) -ctx.load_dialect(LLVM) -ctx.load_dialect(Builtin) - -s = """ -"builtin.module"() ({ - "llvm.func"() <{CConv = #llvm.cconv, function_type = !llvm.func, linkage = #llvm.linkage, sym_name = "test_or", unnamed_addr = 0 : i64, visibility_ = 0 : i64}> ({ - ^bb0(%arg11: i64): - %21 = "llvm.mlir.constant"() <{value = 256 : i64}> : () -> i64 - %22 = "llvm.or"(%arg11, %21) : (i64, i64) -> i64 - "llvm.return"(%arg11) : (i64) -> () - }) : () -> () -}) {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry : vector<4xi64>>, #dlti.dl_entry : vector<2xi64>>, #dlti.dl_entry : vector<2xi64>>, #dlti.dl_entry : vector<2xi64>>, #dlti.dl_entry : vector<2xi64>>, #dlti.dl_entry : vector<2xi64>>, #dlti.dl_entry : vector<2xi64>>, #dlti.dl_entry : vector<2xi64>>, #dlti.dl_entry : vector<2xi64>>, #dlti.dl_entry<"dlti.endianness", "little">>} : () -> () -""" - -parser = Parser(ctx, s) -module = parser.parse_module() -print(module) -for function in module.walk(): - for operation in function.walk(): - print(operation) - print(type(operation)) - if isinstance(operation,ReturnOp): - print(operation.arg) - # print(operation.) diff --git a/SSA/Projects/InstCombine/scripts/types.py b/SSA/Projects/InstCombine/scripts/types.py index 94875ea2a..843328f49 100644 --- a/SSA/Projects/InstCombine/scripts/types.py +++ b/SSA/Projects/InstCombine/scripts/types.py @@ -3,7 +3,7 @@ import os import subprocess from multiprocessing import Pool - +from cfg import * def get_lines(msg): # Define the regex pattern to match error messages with line numbers @@ -72,7 +72,7 @@ def main(): worklist = [] for root, _, files in os.walk(directory): for lean_file in files: - if lean_file.endswith(".lean"): # Assuming the files have a .lean extension + if lean_file.endswith(".lean") and not lean_file.endswith("_proof.lean"): # Assuming the files have a .lean extension file_path = os.path.join(root, lean_file) print(file_path) worklist.append(file_path) diff --git a/SSA/Projects/InstCombine/tests/LLVM/g2004h02h23hShiftShiftOverflow.lean b/SSA/Projects/InstCombine/tests/LLVM/g2004h02h23hShiftShiftOverflow.lean index fc11c9ea7..7a8acea8f 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/g2004h02h23hShiftShiftOverflow.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/g2004h02h23hShiftShiftOverflow.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.g2004h02h23hShiftShiftOverflow_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -39,7 +39,7 @@ theorem test_proof : test_before ⊑ test_after := by intros try simp ---BEGIN test - apply test_thm + all_goals (try extract_goal ; sorry) ---END test @@ -69,7 +69,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 diff --git a/SSA/Projects/InstCombine/tests/LLVM/g2004h02h23hShiftShiftOverflow_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/g2004h02h23hShiftShiftOverflow_proof.lean deleted file mode 100644 index 51be4e1ed..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/g2004h02h23hShiftShiftOverflow_proof.lean +++ /dev/null @@ -1,10 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section g2004h02h23hShiftShiftOverflow_proof -theorem test_thm (x : BitVec 32) : (x.sshiftRight 17).sshiftRight 17 = x.sshiftRight 31 := sorry - -theorem test2_thm (x : BitVec 32) : x <<< 34 = 0#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/g2008h02h16hSDivOverflow2.lean b/SSA/Projects/InstCombine/tests/LLVM/g2008h02h16hSDivOverflow2.lean index dad46c084..5320d898c 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/g2008h02h16hSDivOverflow2.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/g2008h02h16hSDivOverflow2.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.g2008h02h16hSDivOverflow2_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -39,7 +39,7 @@ theorem i_proof : i_before ⊑ i_after := by intros try simp ---BEGIN i - apply i_thm + all_goals (try extract_goal ; sorry) ---END i diff --git a/SSA/Projects/InstCombine/tests/LLVM/g2008h02h16hSDivOverflow2_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/g2008h02h16hSDivOverflow2_proof.lean deleted file mode 100644 index 63d34a0c7..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/g2008h02h16hSDivOverflow2_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section g2008h02h16hSDivOverflow2_proof -theorem i_thm (x : BitVec 8) : (x.sdiv 253#8).sdiv 253#8 = x.sdiv 9#8 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/g2008h02h23hMulSub.lean b/SSA/Projects/InstCombine/tests/LLVM/g2008h02h23hMulSub.lean index 33deb93c4..690b72385 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/g2008h02h23hMulSub.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/g2008h02h23hMulSub.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.g2008h02h23hMulSub_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -39,7 +39,7 @@ theorem test_proof : test_before ⊑ test_after := by intros try simp ---BEGIN test - apply test_thm + all_goals (try extract_goal ; sorry) ---END test diff --git a/SSA/Projects/InstCombine/tests/LLVM/g2008h02h23hMulSub_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/g2008h02h23hMulSub_proof.lean deleted file mode 100644 index f393c27aa..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/g2008h02h23hMulSub_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section g2008h02h23hMulSub_proof -theorem test_thm (x : BitVec 26) : x * 2885#26 - x * 2884#26 = x := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/g2010h11h01hlshrhmask.lean b/SSA/Projects/InstCombine/tests/LLVM/g2010h11h01hlshrhmask.lean index 9e425b5f1..c5f142621 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/g2010h11h01hlshrhmask.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/g2010h11h01hlshrhmask.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.g2010h11h01hlshrhmask_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -71,7 +71,7 @@ theorem foo_proof : foo_before ⊑ foo_after := by intros try simp ---BEGIN foo - apply foo_thm + all_goals (try extract_goal ; sorry) ---END foo diff --git a/SSA/Projects/InstCombine/tests/LLVM/g2010h11h01hlshrhmask_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/g2010h11h01hlshrhmask_proof.lean deleted file mode 100644 index 618174dd2..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/g2010h11h01hlshrhmask_proof.lean +++ /dev/null @@ -1,12 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section g2010h11h01hlshrhmask_proof -theorem foo_thm (x x_1 : BitVec 8) : - (x_1 <<< 7 ^^^ x &&& 138#8) >>> 7 <<< 5 ^^^ - (x &&& 33#8 ||| 168#8 - (x &&& 84#8) &&& 84#8 ||| x_1 <<< 7 ^^^ x &&& 138#8) = - (x_1 <<< 7 ^^^ x &&& 138#8) >>> 2 &&& 32#8 ^^^ - (x &&& 33#8 ||| 40#8 - (x &&& 84#8) &&& 84#8 ||| x_1 <<< 7 ^^^ x &&& 138#8) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gadd2.lean b/SSA/Projects/InstCombine/tests/LLVM/gadd2.lean index 38a1c66fd..4e21eb2bd 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gadd2.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gadd2.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gadd2_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -41,7 +41,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 @@ -77,7 +77,7 @@ theorem test3_proof : test3_before ⊑ test3_after := by intros try simp ---BEGIN test3 - apply test3_thm + all_goals (try extract_goal ; sorry) ---END test3 @@ -106,7 +106,7 @@ theorem test4_proof : test4_before ⊑ test4_after := by intros try simp ---BEGIN test4 - apply test4_thm + all_goals (try extract_goal ; sorry) ---END test4 @@ -139,7 +139,7 @@ theorem test9_proof : test9_before ⊑ test9_after := by intros try simp ---BEGIN test9 - apply test9_thm + all_goals (try extract_goal ; sorry) ---END test9 @@ -179,7 +179,7 @@ theorem test10_proof : test10_before ⊑ test10_after := by intros try simp ---BEGIN test10 - apply test10_thm + all_goals (try extract_goal ; sorry) ---END test10 @@ -215,7 +215,7 @@ theorem test11_proof : test11_before ⊑ test11_after := by intros try simp ---BEGIN test11 - apply test11_thm + all_goals (try extract_goal ; sorry) ---END test11 @@ -251,7 +251,7 @@ theorem test12_proof : test12_before ⊑ test12_after := by intros try simp ---BEGIN test12 - apply test12_thm + all_goals (try extract_goal ; sorry) ---END test12 @@ -287,7 +287,7 @@ theorem test13_proof : test13_before ⊑ test13_after := by intros try simp ---BEGIN test13 - apply test13_thm + all_goals (try extract_goal ; sorry) ---END test13 @@ -323,7 +323,7 @@ theorem test14_proof : test14_before ⊑ test14_after := by intros try simp ---BEGIN test14 - apply test14_thm + all_goals (try extract_goal ; sorry) ---END test14 @@ -358,7 +358,7 @@ theorem test15_proof : test15_before ⊑ test15_after := by intros try simp ---BEGIN test15 - apply test15_thm + all_goals (try extract_goal ; sorry) ---END test15 @@ -393,7 +393,7 @@ theorem test16_proof : test16_before ⊑ test16_after := by intros try simp ---BEGIN test16 - apply test16_thm + all_goals (try extract_goal ; sorry) ---END test16 @@ -427,7 +427,7 @@ theorem test17_proof : test17_before ⊑ test17_after := by intros try simp ---BEGIN test17 - apply test17_thm + all_goals (try extract_goal ; sorry) ---END test17 @@ -462,7 +462,7 @@ theorem test18_proof : test18_before ⊑ test18_after := by intros try simp ---BEGIN test18 - apply test18_thm + all_goals (try extract_goal ; sorry) ---END test18 @@ -492,7 +492,7 @@ theorem add_nsw_mul_nsw_proof : add_nsw_mul_nsw_before ⊑ add_nsw_mul_nsw_after intros try simp ---BEGIN add_nsw_mul_nsw - apply add_nsw_mul_nsw_thm + all_goals (try extract_goal ; sorry) ---END add_nsw_mul_nsw @@ -523,7 +523,7 @@ theorem mul_add_to_mul_1_proof : mul_add_to_mul_1_before ⊑ mul_add_to_mul_1_af intros try simp ---BEGIN mul_add_to_mul_1 - apply mul_add_to_mul_1_thm + all_goals (try extract_goal ; sorry) ---END mul_add_to_mul_1 @@ -554,7 +554,7 @@ theorem mul_add_to_mul_2_proof : mul_add_to_mul_2_before ⊑ mul_add_to_mul_2_af intros try simp ---BEGIN mul_add_to_mul_2 - apply mul_add_to_mul_2_thm + all_goals (try extract_goal ; sorry) ---END mul_add_to_mul_2 @@ -587,7 +587,7 @@ theorem mul_add_to_mul_3_proof : mul_add_to_mul_3_before ⊑ mul_add_to_mul_3_af intros try simp ---BEGIN mul_add_to_mul_3 - apply mul_add_to_mul_3_thm + all_goals (try extract_goal ; sorry) ---END mul_add_to_mul_3 @@ -620,7 +620,7 @@ theorem mul_add_to_mul_4_proof : mul_add_to_mul_4_before ⊑ mul_add_to_mul_4_af intros try simp ---BEGIN mul_add_to_mul_4 - apply mul_add_to_mul_4_thm + all_goals (try extract_goal ; sorry) ---END mul_add_to_mul_4 @@ -653,7 +653,7 @@ theorem mul_add_to_mul_5_proof : mul_add_to_mul_5_before ⊑ mul_add_to_mul_5_af intros try simp ---BEGIN mul_add_to_mul_5 - apply mul_add_to_mul_5_thm + all_goals (try extract_goal ; sorry) ---END mul_add_to_mul_5 @@ -686,7 +686,7 @@ theorem mul_add_to_mul_6_proof : mul_add_to_mul_6_before ⊑ mul_add_to_mul_6_af intros try simp ---BEGIN mul_add_to_mul_6 - apply mul_add_to_mul_6_thm + all_goals (try extract_goal ; sorry) ---END mul_add_to_mul_6 @@ -717,7 +717,7 @@ theorem mul_add_to_mul_7_proof : mul_add_to_mul_7_before ⊑ mul_add_to_mul_7_af intros try simp ---BEGIN mul_add_to_mul_7 - apply mul_add_to_mul_7_thm + all_goals (try extract_goal ; sorry) ---END mul_add_to_mul_7 @@ -750,7 +750,7 @@ theorem mul_add_to_mul_8_proof : mul_add_to_mul_8_before ⊑ mul_add_to_mul_8_af intros try simp ---BEGIN mul_add_to_mul_8 - apply mul_add_to_mul_8_thm + all_goals (try extract_goal ; sorry) ---END mul_add_to_mul_8 @@ -782,7 +782,7 @@ theorem mul_add_to_mul_9_proof : mul_add_to_mul_9_before ⊑ mul_add_to_mul_9_af intros try simp ---BEGIN mul_add_to_mul_9 - apply mul_add_to_mul_9_thm + all_goals (try extract_goal ; sorry) ---END mul_add_to_mul_9 @@ -1010,7 +1010,7 @@ def add_of_mul_after := [llvm| { ^0(%arg4 : i8, %arg5 : i8, %arg6 : i8): %0 = llvm.add %arg5, %arg6 : i8 - %1 = llvm.mul %0, %arg4 : i8 + %1 = llvm.mul %arg4, %0 : i8 "llvm.return"(%1) : (i8) -> () } ] diff --git a/SSA/Projects/InstCombine/tests/LLVM/gadd2_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gadd2_proof.lean deleted file mode 100644 index 5c0f29f73..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gadd2_proof.lean +++ /dev/null @@ -1,62 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gadd2_proof -theorem test2_thm (x : BitVec 32) : (x &&& 7#32) + (x &&& 32#32) = x &&& 39#32 := sorry - -theorem test3_thm (x : BitVec 32) : (x &&& 128#32) + x >>> 30 = x &&& 128#32 ||| x >>> 30 := sorry - -theorem test4_thm (x : BitVec 32) : x + x = x <<< 1 := sorry - -theorem test9_thm (x : BitVec 16) : x * 2#16 + x * 32767#16 = x * 32769#16 := sorry - -theorem test10_thm (x x_1 : BitVec 32) : - x_1 + 1#32 + ((x.sshiftRight 3 ||| 2863311530#32) ^^^ 1431655765#32) = - x_1 - (x.sshiftRight 3 &&& 1431655765#32) := sorry - -theorem test11_thm (x x_1 : BitVec 32) : - x_1 + 1#32 + ((x ||| 2863311530#32) ^^^ 1431655765#32) = x_1 - (x &&& 1431655765#32) := sorry - -theorem test12_thm (x x_1 : BitVec 32) : - x_1 + 1#32 + ((x ||| 2863311530#32) ^^^ 1431655765#32) = x_1 - (x &&& 1431655765#32) := sorry - -theorem test13_thm (x x_1 : BitVec 32) : - x_1 + 1#32 + ((x ||| 2863311529#32) ^^^ 1431655766#32) = x_1 - (x &&& 1431655766#32) := sorry - -theorem test14_thm (x x_1 : BitVec 32) : - x_1 + 1#32 + ((x ||| 2863311529#32) ^^^ 1431655766#32) = x_1 - (x &&& 1431655766#32) := sorry - -theorem test15_thm (x x_1 : BitVec 32) : - x_1 + 1#32 + (x &&& 2863311529#32 ^^^ 2863311529#32) = x_1 - (x ||| 1431655766#32) := sorry - -theorem test16_thm (x x_1 : BitVec 32) : - x_1 + 1#32 + (x &&& 2863311529#32 ^^^ 2863311529#32) = x_1 - (x ||| 1431655766#32) := sorry - -theorem test17_thm (x x_1 : BitVec 32) : - (x_1 &&& 2863311530#32 ^^^ 2863311531#32) + x = x - (x_1 ||| 1431655765#32) := sorry - -theorem test18_thm (x x_1 : BitVec 32) : - x_1 + 1#32 + (x &&& 2863311530#32 ^^^ 2863311530#32) = x_1 - (x ||| 1431655765#32) := sorry - -theorem add_nsw_mul_nsw_thm (x : BitVec 16) : x + x + x = x * 3#16 := sorry - -theorem mul_add_to_mul_1_thm (x : BitVec 16) : x + x * 8#16 = x * 9#16 := sorry - -theorem mul_add_to_mul_2_thm (x : BitVec 16) : x * 8#16 + x = x * 9#16 := sorry - -theorem mul_add_to_mul_3_thm (x : BitVec 16) : x * 2#16 + x * 3#16 = x * 5#16 := sorry - -theorem mul_add_to_mul_4_thm (x : BitVec 16) : x * 2#16 + x * 7#16 = x * 9#16 := sorry - -theorem mul_add_to_mul_5_thm (x : BitVec 16) : x * 3#16 + x * 7#16 = x * 10#16 := sorry - -theorem mul_add_to_mul_6_thm (x x_1 : BitVec 32) : x_1 * x + x_1 * x * 5#32 = x_1 * x * 6#32 := sorry - -theorem mul_add_to_mul_7_thm (x : BitVec 16) : x + x * 32767#16 = x <<< 15 := sorry - -theorem mul_add_to_mul_8_thm (x : BitVec 16) : x * 16383#16 + x * 16384#16 = x * 32767#16 := sorry - -theorem mul_add_to_mul_9_thm (x : BitVec 16) : x * 16384#16 + x * 16384#16 = x <<< 15 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gadd_or_sub.lean b/SSA/Projects/InstCombine/tests/LLVM/gadd_or_sub.lean index d76c66449..2fae63196 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gadd_or_sub.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gadd_or_sub.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gadd_or_sub_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -144,3 +144,139 @@ theorem add_or_sub_comb_i64_commuted4_proof : add_or_sub_comb_i64_commuted4_befo ---END add_or_sub_comb_i64_commuted4 + +def add_or_sub_comb_i8_negative_y_sub_before := [llvm| +{ +^0(%arg8 : i8, %arg9 : i8): + %0 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 + %1 = llvm.sub %0, %arg9 : i8 + %2 = llvm.or %1, %arg8 : i8 + %3 = llvm.add %2, %arg8 : i8 + "llvm.return"(%3) : (i8) -> () +} +] +def add_or_sub_comb_i8_negative_y_sub_after := [llvm| +{ +^0(%arg8 : i8, %arg9 : i8): + %0 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 + %1 = llvm.sub %0, %arg9 : i8 + %2 = llvm.or %arg8, %1 : i8 + %3 = llvm.add %2, %arg8 : i8 + "llvm.return"(%3) : (i8) -> () +} +] +theorem add_or_sub_comb_i8_negative_y_sub_proof : add_or_sub_comb_i8_negative_y_sub_before ⊑ add_or_sub_comb_i8_negative_y_sub_after := by + unfold add_or_sub_comb_i8_negative_y_sub_before add_or_sub_comb_i8_negative_y_sub_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN add_or_sub_comb_i8_negative_y_sub + all_goals (try extract_goal ; sorry) + ---END add_or_sub_comb_i8_negative_y_sub + + + +def add_or_sub_comb_i8_negative_y_or_before := [llvm| +{ +^0(%arg6 : i8, %arg7 : i8): + %0 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 + %1 = llvm.sub %0, %arg6 : i8 + %2 = llvm.or %1, %arg7 : i8 + %3 = llvm.add %2, %arg6 : i8 + "llvm.return"(%3) : (i8) -> () +} +] +def add_or_sub_comb_i8_negative_y_or_after := [llvm| +{ +^0(%arg6 : i8, %arg7 : i8): + %0 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 + %1 = llvm.sub %0, %arg6 : i8 + %2 = llvm.or %arg7, %1 : i8 + %3 = llvm.add %2, %arg6 : i8 + "llvm.return"(%3) : (i8) -> () +} +] +theorem add_or_sub_comb_i8_negative_y_or_proof : add_or_sub_comb_i8_negative_y_or_before ⊑ add_or_sub_comb_i8_negative_y_or_after := by + unfold add_or_sub_comb_i8_negative_y_or_before add_or_sub_comb_i8_negative_y_or_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN add_or_sub_comb_i8_negative_y_or + all_goals (try extract_goal ; sorry) + ---END add_or_sub_comb_i8_negative_y_or + + + +def add_or_sub_comb_i8_negative_y_add_before := [llvm| +{ +^0(%arg4 : i8, %arg5 : i8): + %0 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 + %1 = llvm.sub %0, %arg4 : i8 + %2 = llvm.or %1, %arg4 : i8 + %3 = llvm.add %2, %arg5 : i8 + "llvm.return"(%3) : (i8) -> () +} +] +def add_or_sub_comb_i8_negative_y_add_after := [llvm| +{ +^0(%arg4 : i8, %arg5 : i8): + %0 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 + %1 = llvm.sub %0, %arg4 : i8 + %2 = llvm.or %arg4, %1 : i8 + %3 = llvm.add %2, %arg5 : i8 + "llvm.return"(%3) : (i8) -> () +} +] +theorem add_or_sub_comb_i8_negative_y_add_proof : add_or_sub_comb_i8_negative_y_add_before ⊑ add_or_sub_comb_i8_negative_y_add_after := by + unfold add_or_sub_comb_i8_negative_y_add_before add_or_sub_comb_i8_negative_y_add_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN add_or_sub_comb_i8_negative_y_add + all_goals (try extract_goal ; sorry) + ---END add_or_sub_comb_i8_negative_y_add + + + +def add_or_sub_comb_i8_negative_xor_instead_or_before := [llvm| +{ +^0(%arg3 : i8): + %0 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 + %1 = llvm.sub %0, %arg3 : i8 + %2 = llvm.xor %1, %arg3 : i8 + %3 = llvm.add %2, %arg3 : i8 + "llvm.return"(%3) : (i8) -> () +} +] +def add_or_sub_comb_i8_negative_xor_instead_or_after := [llvm| +{ +^0(%arg3 : i8): + %0 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 + %1 = llvm.sub %0, %arg3 : i8 + %2 = llvm.xor %arg3, %1 : i8 + %3 = llvm.add %2, %arg3 : i8 + "llvm.return"(%3) : (i8) -> () +} +] +theorem add_or_sub_comb_i8_negative_xor_instead_or_proof : add_or_sub_comb_i8_negative_xor_instead_or_before ⊑ add_or_sub_comb_i8_negative_xor_instead_or_after := by + unfold add_or_sub_comb_i8_negative_xor_instead_or_before add_or_sub_comb_i8_negative_xor_instead_or_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN add_or_sub_comb_i8_negative_xor_instead_or + all_goals (try extract_goal ; sorry) + ---END add_or_sub_comb_i8_negative_xor_instead_or + + diff --git a/SSA/Projects/InstCombine/tests/LLVM/gadd_or_sub_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gadd_or_sub_proof.lean deleted file mode 100644 index 4cd7fab79..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gadd_or_sub_proof.lean +++ /dev/null @@ -1,6 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gadd_or_sub_proof diff --git a/SSA/Projects/InstCombine/tests/LLVM/gaddhmaskhneg.lean b/SSA/Projects/InstCombine/tests/LLVM/gaddhmaskhneg.lean index 7d3ce6519..3b4446a52 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gaddhmaskhneg.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gaddhmaskhneg.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gaddhmaskhneg_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics diff --git a/SSA/Projects/InstCombine/tests/LLVM/gaddhmaskhneg_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gaddhmaskhneg_proof.lean deleted file mode 100644 index 0c07ebccb..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gaddhmaskhneg_proof.lean +++ /dev/null @@ -1,6 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gaddhmaskhneg_proof diff --git a/SSA/Projects/InstCombine/tests/LLVM/gand.lean b/SSA/Projects/InstCombine/tests/LLVM/gand.lean index 803366558..ef855b95b 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gand.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gand.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gand_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -12,7 +12,7 @@ set_option linter.deprecated false set_option linter.unreachableTactic false set_option linter.unusedTactic false section gand_statements - + def test_with_even_before := [llvm| { ^0(%arg313 : i32): @@ -39,7 +39,7 @@ theorem test_with_even_proof : test_with_even_before ⊑ test_with_even_after := intros try simp ---BEGIN test_with_even - apply test_with_even_thm + all_goals (try extract_goal ; sorry) ---END test_with_even @@ -70,7 +70,7 @@ theorem test_with_neg_even_proof : test_with_neg_even_before ⊑ test_with_neg_e intros try simp ---BEGIN test_with_neg_even - apply test_with_neg_even_thm + all_goals (try extract_goal ; sorry) ---END test_with_neg_even @@ -99,7 +99,7 @@ theorem test1_proof : test1_before ⊑ test1_after := by intros try simp ---BEGIN test1 - apply test1_thm + all_goals (try extract_goal ; sorry) ---END test1 @@ -127,7 +127,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 @@ -135,7 +135,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by def test3_before := [llvm| { ^0(%arg307 : i1): - %0 = "llvm.mlir.constant"() <{value = 0 : i1}> : () -> i1 + %0 = "llvm.mlir.constant"() <{value = false}> : () -> i1 %1 = llvm.and %arg307, %0 : i1 "llvm.return"(%1) : (i1) -> () } @@ -143,7 +143,7 @@ def test3_before := [llvm| def test3_after := [llvm| { ^0(%arg307 : i1): - %0 = "llvm.mlir.constant"() <{value = 0 : i1}> : () -> i1 + %0 = "llvm.mlir.constant"() <{value = false}> : () -> i1 "llvm.return"(%0) : (i1) -> () } ] @@ -156,7 +156,7 @@ theorem test3_proof : test3_before ⊑ test3_after := by intros try simp ---BEGIN test3 - apply test3_thm + all_goals (try extract_goal ; sorry) ---END test3 @@ -164,7 +164,7 @@ theorem test3_proof : test3_before ⊑ test3_after := by def test4_before := [llvm| { ^0(%arg305 : i1): - %0 = "llvm.mlir.constant"() <{value = 1 : i1}> : () -> i1 + %0 = "llvm.mlir.constant"() <{value = true}> : () -> i1 %1 = llvm.and %arg305, %0 : i1 "llvm.return"(%1) : (i1) -> () } @@ -184,7 +184,7 @@ theorem test4_proof : test4_before ⊑ test4_after := by intros try simp ---BEGIN test4 - apply test4_thm + all_goals (try extract_goal ; sorry) ---END test4 @@ -211,7 +211,7 @@ theorem test5_proof : test5_before ⊑ test5_after := by intros try simp ---BEGIN test5 - apply test5_thm + all_goals (try extract_goal ; sorry) ---END test5 @@ -238,7 +238,7 @@ theorem test6_proof : test6_before ⊑ test6_after := by intros try simp ---BEGIN test6 - apply test6_thm + all_goals (try extract_goal ; sorry) ---END test6 @@ -268,7 +268,7 @@ theorem test7_proof : test7_before ⊑ test7_after := by intros try simp ---BEGIN test7 - apply test7_thm + all_goals (try extract_goal ; sorry) ---END test7 @@ -299,7 +299,7 @@ theorem test8_proof : test8_before ⊑ test8_after := by intros try simp ---BEGIN test8 - apply test8_thm + all_goals (try extract_goal ; sorry) ---END test8 @@ -332,7 +332,7 @@ theorem test10_proof : test10_before ⊑ test10_after := by intros try simp ---BEGIN test10 - apply test10_thm + all_goals (try extract_goal ; sorry) ---END test10 @@ -363,7 +363,7 @@ theorem test15_proof : test15_before ⊑ test15_after := by intros try simp ---BEGIN test15 - apply test15_thm + all_goals (try extract_goal ; sorry) ---END test15 @@ -394,7 +394,7 @@ theorem test16_proof : test16_before ⊑ test16_after := by intros try simp ---BEGIN test16 - apply test16_thm + all_goals (try extract_goal ; sorry) ---END test16 @@ -426,7 +426,7 @@ theorem test19_proof : test19_before ⊑ test19_after := by intros try simp ---BEGIN test19 - apply test19_thm + all_goals (try extract_goal ; sorry) ---END test19 @@ -458,7 +458,7 @@ theorem test20_proof : test20_before ⊑ test20_after := by intros try simp ---BEGIN test20 - apply test20_thm + all_goals (try extract_goal ; sorry) ---END test20 @@ -492,7 +492,7 @@ theorem test27_proof : test27_before ⊑ test27_after := by intros try simp ---BEGIN test27 - apply test27_thm + all_goals (try extract_goal ; sorry) ---END test27 @@ -524,7 +524,7 @@ theorem ashr_lowmask_proof : ashr_lowmask_before ⊑ ashr_lowmask_after := by intros try simp ---BEGIN ashr_lowmask - apply ashr_lowmask_thm + all_goals (try extract_goal ; sorry) ---END ashr_lowmask @@ -557,7 +557,7 @@ theorem test32_proof : test32_before ⊑ test32_after := by intros try simp ---BEGIN test32 - apply test32_thm + all_goals (try extract_goal ; sorry) ---END test32 @@ -591,7 +591,7 @@ theorem test33_proof : test33_before ⊑ test33_after := by intros try simp ---BEGIN test33 - apply test33_thm + all_goals (try extract_goal ; sorry) ---END test33 @@ -625,7 +625,7 @@ theorem test33b_proof : test33b_before ⊑ test33b_after := by intros try simp ---BEGIN test33b - apply test33b_thm + all_goals (try extract_goal ; sorry) ---END test33b @@ -653,7 +653,7 @@ theorem test34_proof : test34_before ⊑ test34_after := by intros try simp ---BEGIN test34 - apply test34_thm + all_goals (try extract_goal ; sorry) ---END test34 @@ -687,7 +687,7 @@ theorem test42_proof : test42_before ⊑ test42_after := by intros try simp ---BEGIN test42 - apply test42_thm + all_goals (try extract_goal ; sorry) ---END test42 @@ -721,7 +721,7 @@ theorem test43_proof : test43_before ⊑ test43_after := by intros try simp ---BEGIN test43 - apply test43_thm + all_goals (try extract_goal ; sorry) ---END test43 @@ -752,7 +752,7 @@ theorem test44_proof : test44_before ⊑ test44_after := by intros try simp ---BEGIN test44 - apply test44_thm + all_goals (try extract_goal ; sorry) ---END test44 @@ -783,7 +783,7 @@ theorem test45_proof : test45_before ⊑ test45_after := by intros try simp ---BEGIN test45 - apply test45_thm + all_goals (try extract_goal ; sorry) ---END test45 @@ -801,7 +801,7 @@ def test46_before := [llvm| def test46_after := [llvm| { ^0(%arg199 : i32, %arg200 : i32): - %0 = llvm.and %arg199, %arg200 : i32 + %0 = llvm.and %arg200, %arg199 : i32 "llvm.return"(%0) : (i32) -> () } ] @@ -814,7 +814,7 @@ theorem test46_proof : test46_before ⊑ test46_after := by intros try simp ---BEGIN test46 - apply test46_thm + all_goals (try extract_goal ; sorry) ---END test46 @@ -832,7 +832,7 @@ def test47_before := [llvm| def test47_after := [llvm| { ^0(%arg197 : i32, %arg198 : i32): - %0 = llvm.and %arg197, %arg198 : i32 + %0 = llvm.and %arg198, %arg197 : i32 "llvm.return"(%0) : (i32) -> () } ] @@ -845,7 +845,7 @@ theorem test47_proof : test47_before ⊑ test47_after := by intros try simp ---BEGIN test47 - apply test47_thm + all_goals (try extract_goal ; sorry) ---END test47 @@ -877,7 +877,7 @@ theorem lowmask_add_2_proof : lowmask_add_2_before ⊑ lowmask_add_2_after := by intros try simp ---BEGIN lowmask_add_2 - apply lowmask_add_2_thm + all_goals (try extract_goal ; sorry) ---END lowmask_add_2 @@ -909,11 +909,83 @@ theorem flip_masked_bit_proof : flip_masked_bit_before ⊑ flip_masked_bit_after intros try simp ---BEGIN flip_masked_bit - apply flip_masked_bit_thm + all_goals (try extract_goal ; sorry) ---END flip_masked_bit +def not_ashr_not_bitwidth_mask_before := [llvm| +{ +^0(%arg97 : i8, %arg98 : i8): + %0 = "llvm.mlir.constant"() <{value = 6 : i8}> : () -> i8 + %1 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 + %2 = llvm.ashr %arg97, %0 : i8 + %3 = llvm.xor %2, %1 : i8 + %4 = llvm.and %3, %arg98 : i8 + "llvm.return"(%4) : (i8) -> () +} +] +def not_ashr_not_bitwidth_mask_after := [llvm| +{ +^0(%arg97 : i8, %arg98 : i8): + %0 = "llvm.mlir.constant"() <{value = 6 : i8}> : () -> i8 + %1 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 + %2 = llvm.ashr %arg97, %0 : i8 + %3 = llvm.xor %2, %1 : i8 + %4 = llvm.and %arg98, %3 : i8 + "llvm.return"(%4) : (i8) -> () +} +] +theorem not_ashr_not_bitwidth_mask_proof : not_ashr_not_bitwidth_mask_before ⊑ not_ashr_not_bitwidth_mask_after := by + unfold not_ashr_not_bitwidth_mask_before not_ashr_not_bitwidth_mask_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN not_ashr_not_bitwidth_mask + all_goals (try extract_goal ; sorry) + ---END not_ashr_not_bitwidth_mask + + + +def not_lshr_bitwidth_mask_before := [llvm| +{ +^0(%arg95 : i8, %arg96 : i8): + %0 = "llvm.mlir.constant"() <{value = 7 : i8}> : () -> i8 + %1 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 + %2 = llvm.lshr %arg95, %0 : i8 + %3 = llvm.xor %2, %1 : i8 + %4 = llvm.and %3, %arg96 : i8 + "llvm.return"(%4) : (i8) -> () +} +] +def not_lshr_bitwidth_mask_after := [llvm| +{ +^0(%arg95 : i8, %arg96 : i8): + %0 = "llvm.mlir.constant"() <{value = 7 : i8}> : () -> i8 + %1 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 + %2 = llvm.lshr %arg95, %0 : i8 + %3 = llvm.xor %2, %1 : i8 + %4 = llvm.and %arg96, %3 : i8 + "llvm.return"(%4) : (i8) -> () +} +] +theorem not_lshr_bitwidth_mask_proof : not_lshr_bitwidth_mask_before ⊑ not_lshr_bitwidth_mask_after := by + unfold not_lshr_bitwidth_mask_before not_lshr_bitwidth_mask_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN not_lshr_bitwidth_mask + all_goals (try extract_goal ; sorry) + ---END not_lshr_bitwidth_mask + + + def shl_lshr_pow2_const_negative_overflow1_before := [llvm| { ^0(%arg70 : i16): @@ -942,7 +1014,7 @@ theorem shl_lshr_pow2_const_negative_overflow1_proof : shl_lshr_pow2_const_negat intros try simp ---BEGIN shl_lshr_pow2_const_negative_overflow1 - apply shl_lshr_pow2_const_negative_overflow1_thm + all_goals (try extract_goal ; sorry) ---END shl_lshr_pow2_const_negative_overflow1 @@ -975,7 +1047,7 @@ theorem shl_lshr_pow2_const_negative_overflow2_proof : shl_lshr_pow2_const_negat intros try simp ---BEGIN shl_lshr_pow2_const_negative_overflow2 - apply shl_lshr_pow2_const_negative_overflow2_thm + all_goals (try extract_goal ; sorry) ---END shl_lshr_pow2_const_negative_overflow2 @@ -1011,7 +1083,7 @@ theorem lshr_lshr_pow2_const_negative_nopow2_1_proof : lshr_lshr_pow2_const_nega intros try simp ---BEGIN lshr_lshr_pow2_const_negative_nopow2_1 - apply lshr_lshr_pow2_const_negative_nopow2_1_thm + all_goals (try extract_goal ; sorry) ---END lshr_lshr_pow2_const_negative_nopow2_1 @@ -1047,7 +1119,7 @@ theorem lshr_lshr_pow2_const_negative_nopow2_2_proof : lshr_lshr_pow2_const_nega intros try simp ---BEGIN lshr_lshr_pow2_const_negative_nopow2_2 - apply lshr_lshr_pow2_const_negative_nopow2_2_thm + all_goals (try extract_goal ; sorry) ---END lshr_lshr_pow2_const_negative_nopow2_2 @@ -1080,7 +1152,7 @@ theorem lshr_lshr_pow2_const_negative_overflow_proof : lshr_lshr_pow2_const_nega intros try simp ---BEGIN lshr_lshr_pow2_const_negative_overflow - apply lshr_lshr_pow2_const_negative_overflow_thm + all_goals (try extract_goal ; sorry) ---END lshr_lshr_pow2_const_negative_overflow @@ -1113,7 +1185,7 @@ theorem lshr_shl_pow2_const_overflow_proof : lshr_shl_pow2_const_overflow_before intros try simp ---BEGIN lshr_shl_pow2_const_overflow - apply lshr_shl_pow2_const_overflow_thm + all_goals (try extract_goal ; sorry) ---END lshr_shl_pow2_const_overflow @@ -1147,7 +1219,7 @@ theorem add_constant_equal_with_the_top_bit_of_demandedbits_pass_proof : add_con intros try simp ---BEGIN add_constant_equal_with_the_top_bit_of_demandedbits_pass - apply add_constant_equal_with_the_top_bit_of_demandedbits_pass_thm + all_goals (try extract_goal ; sorry) ---END add_constant_equal_with_the_top_bit_of_demandedbits_pass @@ -1183,5 +1255,7 @@ theorem add_constant_equal_with_the_top_bit_of_demandedbits_insertpt_proof : add intros try simp ---BEGIN add_constant_equal_with_the_top_bit_of_demandedbits_insertpt - apply add_constant_equal_with_the_top_bit_of_demandedbits_insertpt_thm + all_goals (try extract_goal ; sorry) ---END add_constant_equal_with_the_top_bit_of_demandedbits_insertpt + + diff --git a/SSA/Projects/InstCombine/tests/LLVM/gand_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gand_proof.lean deleted file mode 100644 index 6b5f75d71..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gand_proof.lean +++ /dev/null @@ -1,95 +0,0 @@ -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gand_proof -theorem test_with_even_thm (x : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (4#32 <<< x.toNat)) fun a => some (a &&& 1#32)) ⊑ some 0#32 := sorry - -theorem test_with_neg_even_thm (x : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (4294967292#32 <<< x.toNat)) fun a => some (a &&& 1#32)) ⊑ - some 0#32 := sorry - -theorem test1_thm (x : BitVec 32) : x &&& 0#32 = 0#32 := sorry - -theorem test2_thm (x : BitVec 32) : x &&& 4294967295#32 = x := sorry - -theorem test3_thm (x : BitVec 1) : x &&& 0#1 = 0#1 := sorry - -theorem test4_thm (x : BitVec 1) : x &&& 1#1 = x := sorry - -theorem test5_thm (x : BitVec 32) : x &&& x = x := sorry - -theorem test6_thm (x : BitVec 1) : x &&& x = x := sorry - -theorem test7_thm (x : BitVec 32) : x &&& (x ^^^ 4294967295#32) = 0#32 := sorry - -theorem test8_thm (x : BitVec 8) : x &&& 3#8 &&& 4#8 = 0#8 := sorry - -theorem test10_thm (x : BitVec 32) : (x &&& 12#32 ^^^ 15#32) &&& 1#32 = 1#32 := sorry - -theorem test15_thm (x : BitVec 8) : x >>> 7 &&& 2#8 = 0#8 := sorry - -theorem test16_thm (x : BitVec 8) : x <<< 2 &&& 3#8 = 0#8 := sorry - -theorem test19_thm (x : BitVec 32) : x <<< 3 &&& 4294967294#32 = x <<< 3 := sorry - -theorem test20_thm (x : BitVec 8) : x >>> 7 &&& 1#8 = x >>> 7 := sorry - -theorem test27_thm (x : BitVec 8) : ((x &&& 4#8) - 16#8 &&& 240#8) + 16#8 = 0#8 := sorry - -theorem ashr_lowmask_thm (x : BitVec 32) : x.sshiftRight 24 &&& 255#32 = x >>> 24 := sorry - -theorem test32_thm (x : BitVec 32) : (x &&& 16#32) >>> 2 &&& 1#32 = 0#32 := sorry - -theorem test33_thm (x : BitVec 32) : x &&& 4294967294#32 ||| x &&& 1#32 ^^^ 1#32 = x ^^^ 1#32 := sorry - -theorem test33b_thm (x : BitVec 32) : x &&& 1#32 ^^^ 1#32 ||| x &&& 4294967294#32 = x ^^^ 1#32 := sorry - -theorem test34_thm (x x_1 : BitVec 32) : (x_1 ||| x) &&& x_1 = x_1 := sorry - -theorem test42_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32 ^^^ x_1 * x) &&& (x_2 ||| x_1 * x) = x_1 * x &&& x_2 := sorry - -theorem test43_thm (x x_1 x_2 : BitVec 32) : - (x_2 ||| x_1 * x) &&& (x_2 ^^^ 4294967295#32 ^^^ x_1 * x) = x_1 * x &&& x_2 := sorry - -theorem test44_thm (x x_1 : BitVec 32) : (x_1 ^^^ 4294967295#32 ||| x) &&& x_1 = x &&& x_1 := sorry - -theorem test45_thm (x x_1 : BitVec 32) : (x_1 ||| x ^^^ 4294967295#32) &&& x = x_1 &&& x := sorry - -theorem test46_thm (x x_1 : BitVec 32) : x_1 &&& (x_1 ^^^ 4294967295#32 ||| x) = x &&& x_1 := sorry - -theorem test47_thm (x x_1 : BitVec 32) : x_1 &&& (x ||| x_1 ^^^ 4294967295#32) = x &&& x_1 := sorry - -theorem lowmask_add_2_thm (x : BitVec 8) : x + 192#8 &&& 63#8 = x &&& 63#8 := sorry - -theorem flip_masked_bit_thm (x : BitVec 8) : x + 16#8 &&& 16#8 = x &&& 16#8 ^^^ 16#8 := sorry - -theorem shl_lshr_pow2_const_negative_overflow1_thm (x : BitVec 16) : - (Option.bind (if 16 ≤ x.toNat then none else some (4096#16 <<< x.toNat)) fun a => some (a >>> 6 &&& 8#16)) ⊑ - some 0#16 := sorry - -theorem shl_lshr_pow2_const_negative_overflow2_thm (x : BitVec 16) : - (Option.bind (if 16 ≤ x.toNat then none else some (8#16 <<< x.toNat)) fun a => some (a >>> 6 &&& 32768#16)) ⊑ - some 0#16 := sorry - -theorem lshr_lshr_pow2_const_negative_nopow2_1_thm (x : BitVec 16) : - (Option.bind (if 16 ≤ x.toNat then none else some (2047#16 >>> x.toNat)) fun a => some (a >>> 6 &&& 4#16)) ⊑ - Option.bind (if 16 ≤ x.toNat then none else some (31#16 >>> x.toNat)) fun a => some (a &&& 4#16) := sorry - -theorem lshr_lshr_pow2_const_negative_nopow2_2_thm (x : BitVec 16) : - (Option.bind (if 16 ≤ x.toNat then none else some (8192#16 >>> x.toNat)) fun a => some (a >>> 6 &&& 3#16)) ⊑ - Option.bind (if 16 ≤ x.toNat then none else some (128#16 >>> x.toNat)) fun a => some (a &&& 3#16) := sorry - -theorem lshr_lshr_pow2_const_negative_overflow_thm (x : BitVec 16) : - (Option.bind (if 16 ≤ x.toNat then none else some (32768#16 >>> x.toNat)) fun a => some (a >>> 15 &&& 4#16)) ⊑ - some 0#16 := sorry - -theorem lshr_shl_pow2_const_overflow_thm (x : BitVec 16) : - (Option.bind (if 16 ≤ x.toNat then none else some (8192#16 >>> x.toNat)) fun a => some (a <<< 6 &&& 32#16)) ⊑ - some 0#16 := sorry - -theorem add_constant_equal_with_the_top_bit_of_demandedbits_pass_thm (x : BitVec 32) : x + 16#32 &&& 24#32 = x &&& 24#32 ^^^ 16#32 := sorry - -theorem add_constant_equal_with_the_top_bit_of_demandedbits_insertpt_thm (x x_1 : BitVec 32) : (x_1 + 16#32 ||| x) &&& 24#32 = (x_1 ^^^ 16#32 ||| x) &&& 24#32 := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gandhorhnot.lean b/SSA/Projects/InstCombine/tests/LLVM/gandhorhnot.lean index 544f4973c..bb21b3d8c 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gandhorhnot.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gandhorhnot.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gandhorhnot_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -40,7 +40,7 @@ theorem and_to_xor1_proof : and_to_xor1_before ⊑ and_to_xor1_after := by intros try simp ---BEGIN and_to_xor1 - apply and_to_xor1_thm + all_goals (try extract_goal ; sorry) ---END and_to_xor1 @@ -72,7 +72,7 @@ theorem and_to_xor2_proof : and_to_xor2_before ⊑ and_to_xor2_after := by intros try simp ---BEGIN and_to_xor2 - apply and_to_xor2_thm + all_goals (try extract_goal ; sorry) ---END and_to_xor2 @@ -104,7 +104,7 @@ theorem and_to_xor3_proof : and_to_xor3_before ⊑ and_to_xor3_after := by intros try simp ---BEGIN and_to_xor3 - apply and_to_xor3_thm + all_goals (try extract_goal ; sorry) ---END and_to_xor3 @@ -136,7 +136,7 @@ theorem and_to_xor4_proof : and_to_xor4_before ⊑ and_to_xor4_after := by intros try simp ---BEGIN and_to_xor4 - apply and_to_xor4_thm + all_goals (try extract_goal ; sorry) ---END and_to_xor4 @@ -170,7 +170,7 @@ theorem or_to_nxor1_proof : or_to_nxor1_before ⊑ or_to_nxor1_after := by intros try simp ---BEGIN or_to_nxor1 - apply or_to_nxor1_thm + all_goals (try extract_goal ; sorry) ---END or_to_nxor1 @@ -204,7 +204,7 @@ theorem or_to_nxor2_proof : or_to_nxor2_before ⊑ or_to_nxor2_after := by intros try simp ---BEGIN or_to_nxor2 - apply or_to_nxor2_thm + all_goals (try extract_goal ; sorry) ---END or_to_nxor2 @@ -238,7 +238,7 @@ theorem or_to_nxor3_proof : or_to_nxor3_before ⊑ or_to_nxor3_after := by intros try simp ---BEGIN or_to_nxor3 - apply or_to_nxor3_thm + all_goals (try extract_goal ; sorry) ---END or_to_nxor3 @@ -272,7 +272,7 @@ theorem or_to_nxor4_proof : or_to_nxor4_before ⊑ or_to_nxor4_after := by intros try simp ---BEGIN or_to_nxor4 - apply or_to_nxor4_thm + all_goals (try extract_goal ; sorry) ---END or_to_nxor4 @@ -302,7 +302,7 @@ theorem xor_to_xor1_proof : xor_to_xor1_before ⊑ xor_to_xor1_after := by intros try simp ---BEGIN xor_to_xor1 - apply xor_to_xor1_thm + all_goals (try extract_goal ; sorry) ---END xor_to_xor1 @@ -332,7 +332,7 @@ theorem xor_to_xor2_proof : xor_to_xor2_before ⊑ xor_to_xor2_after := by intros try simp ---BEGIN xor_to_xor2 - apply xor_to_xor2_thm + all_goals (try extract_goal ; sorry) ---END xor_to_xor2 @@ -362,7 +362,7 @@ theorem xor_to_xor3_proof : xor_to_xor3_before ⊑ xor_to_xor3_after := by intros try simp ---BEGIN xor_to_xor3 - apply xor_to_xor3_thm + all_goals (try extract_goal ; sorry) ---END xor_to_xor3 @@ -392,11 +392,49 @@ theorem xor_to_xor4_proof : xor_to_xor4_before ⊑ xor_to_xor4_after := by intros try simp ---BEGIN xor_to_xor4 - apply xor_to_xor4_thm + all_goals (try extract_goal ; sorry) ---END xor_to_xor4 +def PR32830_before := [llvm| +{ +^0(%arg60 : i64, %arg61 : i64, %arg62 : i64): + %0 = "llvm.mlir.constant"() <{value = -1 : i64}> : () -> i64 + %1 = llvm.xor %arg60, %0 : i64 + %2 = llvm.xor %arg61, %0 : i64 + %3 = llvm.or %2, %arg60 : i64 + %4 = llvm.or %1, %arg62 : i64 + %5 = llvm.and %3, %4 : i64 + "llvm.return"(%5) : (i64) -> () +} +] +def PR32830_after := [llvm| +{ +^0(%arg60 : i64, %arg61 : i64, %arg62 : i64): + %0 = "llvm.mlir.constant"() <{value = -1 : i64}> : () -> i64 + %1 = llvm.xor %arg60, %0 : i64 + %2 = llvm.xor %arg61, %0 : i64 + %3 = llvm.or %arg60, %2 : i64 + %4 = llvm.or %arg62, %1 : i64 + %5 = llvm.and %3, %4 : i64 + "llvm.return"(%5) : (i64) -> () +} +] +theorem PR32830_proof : PR32830_before ⊑ PR32830_after := by + unfold PR32830_before PR32830_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN PR32830 + all_goals (try extract_goal ; sorry) + ---END PR32830 + + + def simplify_or_common_op_commute0_before := [llvm| { ^0(%arg45 : i4, %arg46 : i4, %arg47 : i4): @@ -424,7 +462,7 @@ theorem simplify_or_common_op_commute0_proof : simplify_or_common_op_commute0_be intros try simp ---BEGIN simplify_or_common_op_commute0 - apply simplify_or_common_op_commute0_thm + all_goals (try extract_goal ; sorry) ---END simplify_or_common_op_commute0 @@ -456,7 +494,7 @@ theorem simplify_or_common_op_commute1_proof : simplify_or_common_op_commute1_be intros try simp ---BEGIN simplify_or_common_op_commute1 - apply simplify_or_common_op_commute1_thm + all_goals (try extract_goal ; sorry) ---END simplify_or_common_op_commute1 @@ -490,7 +528,7 @@ theorem simplify_or_common_op_commute2_proof : simplify_or_common_op_commute2_be intros try simp ---BEGIN simplify_or_common_op_commute2 - apply simplify_or_common_op_commute2_thm + all_goals (try extract_goal ; sorry) ---END simplify_or_common_op_commute2 @@ -522,7 +560,7 @@ theorem simplify_and_common_op_commute1_proof : simplify_and_common_op_commute1_ intros try simp ---BEGIN simplify_and_common_op_commute1 - apply simplify_and_common_op_commute1_thm + all_goals (try extract_goal ; sorry) ---END simplify_and_common_op_commute1 @@ -556,7 +594,7 @@ theorem simplify_and_common_op_commute2_proof : simplify_and_common_op_commute2_ intros try simp ---BEGIN simplify_and_common_op_commute2 - apply simplify_and_common_op_commute2_thm + all_goals (try extract_goal ; sorry) ---END simplify_and_common_op_commute2 @@ -587,7 +625,7 @@ theorem reduce_xor_common_op_commute0_proof : reduce_xor_common_op_commute0_befo intros try simp ---BEGIN reduce_xor_common_op_commute0 - apply reduce_xor_common_op_commute0_thm + all_goals (try extract_goal ; sorry) ---END reduce_xor_common_op_commute0 @@ -618,7 +656,7 @@ theorem reduce_xor_common_op_commute1_proof : reduce_xor_common_op_commute1_befo intros try simp ---BEGIN reduce_xor_common_op_commute1 - apply reduce_xor_common_op_commute1_thm + all_goals (try extract_goal ; sorry) ---END reduce_xor_common_op_commute1 @@ -638,7 +676,7 @@ def annihilate_xor_common_op_commute2_after := [llvm| { ^0(%arg3 : i4, %arg4 : i4, %arg5 : i4, %arg6 : i4): %0 = llvm.mul %arg5, %arg5 : i4 - %1 = llvm.xor %0, %arg4 : i4 + %1 = llvm.xor %arg4, %0 : i4 %2 = llvm.xor %1, %arg6 : i4 "llvm.return"(%2) : (i4) -> () } @@ -652,7 +690,7 @@ theorem annihilate_xor_common_op_commute2_proof : annihilate_xor_common_op_commu intros try simp ---BEGIN annihilate_xor_common_op_commute2 - apply annihilate_xor_common_op_commute2_thm + all_goals (try extract_goal ; sorry) ---END annihilate_xor_common_op_commute2 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gandhorhnot_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gandhorhnot_proof.lean deleted file mode 100644 index fd52c6147..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gandhorhnot_proof.lean +++ /dev/null @@ -1,51 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gandhorhnot_proof -theorem and_to_xor1_thm (x x_1 : BitVec 32) : (x_1 ||| x) &&& (x_1 &&& x ^^^ 4294967295#32) = x_1 ^^^ x := sorry - -theorem and_to_xor2_thm (x x_1 : BitVec 32) : (x_1 &&& x ^^^ 4294967295#32) &&& (x_1 ||| x) = x_1 ^^^ x := sorry - -theorem and_to_xor3_thm (x x_1 : BitVec 32) : (x_1 ||| x) &&& (x &&& x_1 ^^^ 4294967295#32) = x_1 ^^^ x := sorry - -theorem and_to_xor4_thm (x x_1 : BitVec 32) : (x_1 &&& x ^^^ 4294967295#32) &&& (x ||| x_1) = x ^^^ x_1 := sorry - -theorem or_to_nxor1_thm (x x_1 : BitVec 32) : - x_1 &&& x ||| (x_1 ||| x) ^^^ 4294967295#32 = x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem or_to_nxor2_thm (x x_1 : BitVec 32) : - x_1 &&& x ||| (x ||| x_1) ^^^ 4294967295#32 = x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem or_to_nxor3_thm (x x_1 : BitVec 32) : - (x_1 ||| x) ^^^ 4294967295#32 ||| x_1 &&& x = x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem or_to_nxor4_thm (x x_1 : BitVec 32) : - (x_1 ||| x) ^^^ 4294967295#32 ||| x &&& x_1 = x ^^^ x_1 ^^^ 4294967295#32 := sorry - -theorem xor_to_xor1_thm (x x_1 : BitVec 32) : x_1 &&& x ^^^ (x_1 ||| x) = x_1 ^^^ x := sorry - -theorem xor_to_xor2_thm (x x_1 : BitVec 32) : x_1 &&& x ^^^ (x ||| x_1) = x_1 ^^^ x := sorry - -theorem xor_to_xor3_thm (x x_1 : BitVec 32) : (x_1 ||| x) ^^^ x_1 &&& x = x_1 ^^^ x := sorry - -theorem xor_to_xor4_thm (x x_1 : BitVec 32) : (x_1 ||| x) ^^^ x &&& x_1 = x ^^^ x_1 := sorry - -theorem simplify_or_common_op_commute0_thm (x x_1 x_2 : BitVec 4) : x_2 &&& x_1 &&& x ^^^ 15#4 ||| x_2 = 15#4 := sorry - -theorem simplify_or_common_op_commute1_thm (x x_1 x_2 : BitVec 4) : x_2 &&& x_1 &&& x ^^^ 15#4 ||| x_1 = 15#4 := sorry - -theorem simplify_or_common_op_commute2_thm (x x_1 x_2 x_3 : BitVec 4) : x_3 * x_3 &&& (x_2 &&& x_1) &&& x ^^^ 15#4 ||| x_2 = 15#4 := sorry - -theorem simplify_and_common_op_commute1_thm (x x_1 x_2 : BitVec 4) : ((x_2 ||| x_1 ||| x) ^^^ 15#4) &&& x_1 = 0#4 := sorry - -theorem simplify_and_common_op_commute2_thm (x x_1 x_2 x_3 : BitVec 4) : ((x_3 * x_3 ||| (x_2 ||| x_1) ||| x) ^^^ 15#4) &&& x_2 = 0#4 := sorry - -theorem reduce_xor_common_op_commute0_thm (x x_1 x_2 : BitVec 4) : x_2 ^^^ x_1 ^^^ x ||| x_2 = x_1 ^^^ x ||| x_2 := sorry - -theorem reduce_xor_common_op_commute1_thm (x x_1 x_2 : BitVec 4) : x_2 ^^^ x_1 ^^^ x ||| x_1 = x_2 ^^^ x ||| x_1 := sorry - -theorem annihilate_xor_common_op_commute2_thm (x x_1 x_2 x_3 : BitVec 4) : - x_3 * x_3 ^^^ (x_2 ^^^ x_1) ^^^ x ^^^ x_2 = x_3 * x_3 ^^^ x_1 ^^^ x := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gandhxorhmerge.lean b/SSA/Projects/InstCombine/tests/LLVM/gandhxorhmerge.lean index 29d5d80c5..eb46748fa 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gandhxorhmerge.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gandhxorhmerge.lean @@ -26,7 +26,7 @@ def test1_after := [llvm| { ^0(%arg9 : i32, %arg10 : i32, %arg11 : i32): %0 = llvm.xor %arg9, %arg10 : i32 - %1 = llvm.and %0, %arg11 : i32 + %1 = llvm.and %arg11, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] diff --git a/SSA/Projects/InstCombine/tests/LLVM/gandhxorhmerge_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gandhxorhmerge_proof.lean index 7b17d84f2..283fe44fb 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gandhxorhmerge_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gandhxorhmerge_proof.lean @@ -4,7 +4,7 @@ import SSA.Projects.InstCombine.LLVM.Semantics open BitVec section gandhxorhmerge_proof -theorem test1_thm (x x_1 x_2 : BitVec 32) : x_2 &&& x_1 ^^^ x_2 &&& x = (x_1 ^^^ x) &&& x_2 := sorry +theorem test1_thm (x x_1 x_2 : BitVec 32) : x_2 &&& x_1 ^^^ x_2 &&& x = x_2 &&& (x_1 ^^^ x) := sorry theorem test2_thm (x x_1 : BitVec 32) : x_1 &&& x ^^^ (x_1 ||| x) = x_1 ^^^ x := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gandhxorhor.lean b/SSA/Projects/InstCombine/tests/LLVM/gandhxorhor.lean index 1bf1f3b43..8afe903c0 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gandhxorhor.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gandhxorhor.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gandhxorhor_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -39,7 +39,7 @@ theorem and_xor_not_common_op_proof : and_xor_not_common_op_before ⊑ and_xor_n intros try simp ---BEGIN and_xor_not_common_op - apply and_xor_not_common_op_thm + all_goals (try extract_goal ; sorry) ---END and_xor_not_common_op @@ -70,7 +70,7 @@ theorem and_not_xor_common_op_proof : and_not_xor_common_op_before ⊑ and_not_x intros try simp ---BEGIN and_not_xor_common_op - apply and_not_xor_common_op_thm + all_goals (try extract_goal ; sorry) ---END and_not_xor_common_op @@ -130,43 +130,11 @@ theorem or2_proof : or2_before ⊑ or2_after := by intros try simp ---BEGIN or2 - apply or2_thm + all_goals (try extract_goal ; sorry) ---END or2 -def and_xor_or_negative_before := [llvm| -{ -^0(%arg648 : i64, %arg649 : i64, %arg650 : i64, %arg651 : i64): - %0 = llvm.and %arg649, %arg648 : i64 - %1 = llvm.xor %arg650, %0 : i64 - %2 = llvm.or %arg651, %1 : i64 - "llvm.return"(%2) : (i64) -> () -} -] -def and_xor_or_negative_after := [llvm| -{ -^0(%arg648 : i64, %arg649 : i64, %arg650 : i64, %arg651 : i64): - %0 = llvm.and %arg649, %arg648 : i64 - %1 = llvm.xor %0, %arg650 : i64 - %2 = llvm.or %1, %arg651 : i64 - "llvm.return"(%2) : (i64) -> () -} -] -theorem and_xor_or_negative_proof : and_xor_or_negative_before ⊑ and_xor_or_negative_after := by - unfold and_xor_or_negative_before and_xor_or_negative_after - simp_alive_peephole - simp_alive_undef - simp_alive_ops - simp_alive_case_bash - intros - try simp - ---BEGIN and_xor_or_negative - apply and_xor_or_negative_thm - ---END and_xor_or_negative - - - def and_shl_before := [llvm| { ^0(%arg644 : i8, %arg645 : i8, %arg646 : i8, %arg647 : i8): @@ -195,7 +163,7 @@ theorem and_shl_proof : and_shl_before ⊑ and_shl_after := by intros try simp ---BEGIN and_shl - apply and_shl_thm + all_goals (try extract_goal ; sorry) ---END and_shl @@ -228,7 +196,7 @@ theorem or_shl_proof : or_shl_before ⊑ or_shl_after := by intros try simp ---BEGIN or_shl - apply or_shl_thm + all_goals (try extract_goal ; sorry) ---END or_shl @@ -261,7 +229,7 @@ theorem or_lshr_proof : or_lshr_before ⊑ or_lshr_after := by intros try simp ---BEGIN or_lshr - apply or_lshr_thm + all_goals (try extract_goal ; sorry) ---END or_lshr @@ -294,7 +262,7 @@ theorem xor_lshr_proof : xor_lshr_before ⊑ xor_lshr_after := by intros try simp ---BEGIN xor_lshr - apply xor_lshr_thm + all_goals (try extract_goal ; sorry) ---END xor_lshr @@ -331,7 +299,7 @@ theorem xor_lshr_multiuse_proof : xor_lshr_multiuse_before ⊑ xor_lshr_multiuse intros try simp ---BEGIN xor_lshr_multiuse - apply xor_lshr_multiuse_thm + all_goals (try extract_goal ; sorry) ---END xor_lshr_multiuse @@ -370,7 +338,7 @@ theorem not_and_and_not_proof : not_and_and_not_before ⊑ not_and_and_not_after intros try simp ---BEGIN not_and_and_not - apply not_and_and_not_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_not @@ -392,7 +360,7 @@ def not_and_and_not_commute1_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.or %arg562, %arg563 : i32 %2 = llvm.xor %1, %0 : i32 - %3 = llvm.and %2, %arg561 : i32 + %3 = llvm.and %arg561, %2 : i32 "llvm.return"(%3) : (i32) -> () } ] @@ -405,7 +373,7 @@ theorem not_and_and_not_commute1_proof : not_and_and_not_commute1_before ⊑ not intros try simp ---BEGIN not_and_and_not_commute1 - apply not_and_and_not_commute1_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_not_commute1 @@ -444,7 +412,7 @@ theorem not_or_or_not_proof : not_or_or_not_before ⊑ not_or_or_not_after := by intros try simp ---BEGIN not_or_or_not - apply not_or_or_not_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_not @@ -466,7 +434,7 @@ def not_or_or_not_commute1_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg547, %arg548 : i32 %2 = llvm.xor %1, %0 : i32 - %3 = llvm.or %2, %arg546 : i32 + %3 = llvm.or %arg546, %2 : i32 "llvm.return"(%3) : (i32) -> () } ] @@ -479,7 +447,7 @@ theorem not_or_or_not_commute1_proof : not_or_or_not_commute1_before ⊑ not_or_ intros try simp ---BEGIN not_or_or_not_commute1 - apply not_or_or_not_commute1_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_not_commute1 @@ -517,7 +485,7 @@ theorem or_not_and_proof : or_not_and_before ⊑ or_not_and_after := by intros try simp ---BEGIN or_not_and - apply or_not_and_thm + all_goals (try extract_goal ; sorry) ---END or_not_and @@ -559,7 +527,7 @@ theorem or_not_and_commute1_proof : or_not_and_commute1_before ⊑ or_not_and_co intros try simp ---BEGIN or_not_and_commute1 - apply or_not_and_commute1_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_commute1 @@ -586,7 +554,7 @@ def or_not_and_commute2_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 42 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg532 : i32 - %3 = llvm.xor %2, %arg533 : i32 + %3 = llvm.xor %arg533, %2 : i32 %4 = llvm.xor %arg531, %1 : i32 %5 = llvm.and %3, %4 : i32 "llvm.return"(%5) : (i32) -> () @@ -601,7 +569,7 @@ theorem or_not_and_commute2_proof : or_not_and_commute2_before ⊑ or_not_and_co intros try simp ---BEGIN or_not_and_commute2 - apply or_not_and_commute2_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_commute2 @@ -639,7 +607,7 @@ theorem or_not_and_commute3_proof : or_not_and_commute3_before ⊑ or_not_and_co intros try simp ---BEGIN or_not_and_commute3 - apply or_not_and_commute3_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_commute3 @@ -666,7 +634,7 @@ def or_not_and_commute4_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 42 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg527 : i32 - %3 = llvm.xor %2, %arg526 : i32 + %3 = llvm.xor %arg526, %2 : i32 %4 = llvm.xor %arg525, %1 : i32 %5 = llvm.and %3, %4 : i32 "llvm.return"(%5) : (i32) -> () @@ -681,7 +649,7 @@ theorem or_not_and_commute4_proof : or_not_and_commute4_before ⊑ or_not_and_co intros try simp ---BEGIN or_not_and_commute4 - apply or_not_and_commute4_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_commute4 @@ -710,7 +678,7 @@ def or_not_and_commute5_after := [llvm| %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg522 : i32 %3 = llvm.sdiv %0, %arg524 : i32 - %4 = llvm.xor %3, %arg523 : i32 + %4 = llvm.xor %arg523, %3 : i32 %5 = llvm.xor %2, %1 : i32 %6 = llvm.and %4, %5 : i32 "llvm.return"(%6) : (i32) -> () @@ -725,7 +693,7 @@ theorem or_not_and_commute5_proof : or_not_and_commute5_before ⊑ or_not_and_co intros try simp ---BEGIN or_not_and_commute5 - apply or_not_and_commute5_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_commute5 @@ -763,7 +731,7 @@ theorem or_not_and_commute6_proof : or_not_and_commute6_before ⊑ or_not_and_co intros try simp ---BEGIN or_not_and_commute6 - apply or_not_and_commute6_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_commute6 @@ -801,7 +769,7 @@ theorem or_not_and_commute7_proof : or_not_and_commute7_before ⊑ or_not_and_co intros try simp ---BEGIN or_not_and_commute7 - apply or_not_and_commute7_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_commute7 @@ -845,7 +813,7 @@ theorem or_not_and_commute8_proof : or_not_and_commute8_before ⊑ or_not_and_co intros try simp ---BEGIN or_not_and_commute8 - apply or_not_and_commute8_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_commute8 @@ -891,11 +859,95 @@ theorem or_not_and_commute9_proof : or_not_and_commute9_before ⊑ or_not_and_co intros try simp ---BEGIN or_not_and_commute9 - apply or_not_and_commute9_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_commute9 +def or_not_and_wrong_c_before := [llvm| +{ +^0(%arg488 : i32, %arg489 : i32, %arg490 : i32, %arg491 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.or %arg488, %arg489 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.and %2, %arg490 : i32 + %4 = llvm.or %arg488, %arg491 : i32 + %5 = llvm.xor %4, %0 : i32 + %6 = llvm.and %5, %arg489 : i32 + %7 = llvm.or %3, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +def or_not_and_wrong_c_after := [llvm| +{ +^0(%arg488 : i32, %arg489 : i32, %arg490 : i32, %arg491 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.or %arg488, %arg489 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.and %arg490, %2 : i32 + %4 = llvm.or %arg488, %arg491 : i32 + %5 = llvm.xor %4, %0 : i32 + %6 = llvm.and %arg489, %5 : i32 + %7 = llvm.or %3, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +theorem or_not_and_wrong_c_proof : or_not_and_wrong_c_before ⊑ or_not_and_wrong_c_after := by + unfold or_not_and_wrong_c_before or_not_and_wrong_c_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN or_not_and_wrong_c + all_goals (try extract_goal ; sorry) + ---END or_not_and_wrong_c + + + +def or_not_and_wrong_b_before := [llvm| +{ +^0(%arg484 : i32, %arg485 : i32, %arg486 : i32, %arg487 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.or %arg484, %arg485 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.and %2, %arg486 : i32 + %4 = llvm.or %arg484, %arg486 : i32 + %5 = llvm.xor %4, %0 : i32 + %6 = llvm.and %5, %arg487 : i32 + %7 = llvm.or %3, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +def or_not_and_wrong_b_after := [llvm| +{ +^0(%arg484 : i32, %arg485 : i32, %arg486 : i32, %arg487 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.or %arg484, %arg485 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.and %arg486, %2 : i32 + %4 = llvm.or %arg484, %arg486 : i32 + %5 = llvm.xor %4, %0 : i32 + %6 = llvm.and %arg487, %5 : i32 + %7 = llvm.or %3, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +theorem or_not_and_wrong_b_proof : or_not_and_wrong_b_before ⊑ or_not_and_wrong_b_after := by + unfold or_not_and_wrong_b_before or_not_and_wrong_b_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN or_not_and_wrong_b + all_goals (try extract_goal ; sorry) + ---END or_not_and_wrong_b + + + def and_not_or_before := [llvm| { ^0(%arg481 : i32, %arg482 : i32, %arg483 : i32): @@ -929,7 +981,7 @@ theorem and_not_or_proof : and_not_or_before ⊑ and_not_or_after := by intros try simp ---BEGIN and_not_or - apply and_not_or_thm + all_goals (try extract_goal ; sorry) ---END and_not_or @@ -971,7 +1023,7 @@ theorem and_not_or_commute1_proof : and_not_or_commute1_before ⊑ and_not_or_co intros try simp ---BEGIN and_not_or_commute1 - apply and_not_or_commute1_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_commute1 @@ -998,7 +1050,7 @@ def and_not_or_commute2_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 42 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg476 : i32 - %3 = llvm.xor %2, %arg477 : i32 + %3 = llvm.xor %arg477, %2 : i32 %4 = llvm.and %3, %arg475 : i32 %5 = llvm.xor %4, %1 : i32 "llvm.return"(%5) : (i32) -> () @@ -1013,7 +1065,7 @@ theorem and_not_or_commute2_proof : and_not_or_commute2_before ⊑ and_not_or_co intros try simp ---BEGIN and_not_or_commute2 - apply and_not_or_commute2_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_commute2 @@ -1051,7 +1103,7 @@ theorem and_not_or_commute3_proof : and_not_or_commute3_before ⊑ and_not_or_co intros try simp ---BEGIN and_not_or_commute3 - apply and_not_or_commute3_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_commute3 @@ -1078,7 +1130,7 @@ def and_not_or_commute4_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 42 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg471 : i32 - %3 = llvm.xor %2, %arg470 : i32 + %3 = llvm.xor %arg470, %2 : i32 %4 = llvm.and %3, %arg469 : i32 %5 = llvm.xor %4, %1 : i32 "llvm.return"(%5) : (i32) -> () @@ -1093,7 +1145,7 @@ theorem and_not_or_commute4_proof : and_not_or_commute4_before ⊑ and_not_or_co intros try simp ---BEGIN and_not_or_commute4 - apply and_not_or_commute4_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_commute4 @@ -1122,7 +1174,7 @@ def and_not_or_commute5_after := [llvm| %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg466 : i32 %3 = llvm.sdiv %0, %arg468 : i32 - %4 = llvm.xor %3, %arg467 : i32 + %4 = llvm.xor %arg467, %3 : i32 %5 = llvm.and %4, %2 : i32 %6 = llvm.xor %5, %1 : i32 "llvm.return"(%6) : (i32) -> () @@ -1137,7 +1189,7 @@ theorem and_not_or_commute5_proof : and_not_or_commute5_before ⊑ and_not_or_co intros try simp ---BEGIN and_not_or_commute5 - apply and_not_or_commute5_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_commute5 @@ -1175,7 +1227,7 @@ theorem and_not_or_commute6_proof : and_not_or_commute6_before ⊑ and_not_or_co intros try simp ---BEGIN and_not_or_commute6 - apply and_not_or_commute6_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_commute6 @@ -1213,7 +1265,7 @@ theorem and_not_or_commute7_proof : and_not_or_commute7_before ⊑ and_not_or_co intros try simp ---BEGIN and_not_or_commute7 - apply and_not_or_commute7_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_commute7 @@ -1257,7 +1309,7 @@ theorem and_not_or_commute8_proof : and_not_or_commute8_before ⊑ and_not_or_co intros try simp ---BEGIN and_not_or_commute8 - apply and_not_or_commute8_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_commute8 @@ -1303,11 +1355,95 @@ theorem and_not_or_commute9_proof : and_not_or_commute9_before ⊑ and_not_or_co intros try simp ---BEGIN and_not_or_commute9 - apply and_not_or_commute9_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_commute9 +def and_not_or_wrong_c_before := [llvm| +{ +^0(%arg432 : i32, %arg433 : i32, %arg434 : i32, %arg435 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg432, %arg433 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.or %2, %arg434 : i32 + %4 = llvm.and %arg432, %arg435 : i32 + %5 = llvm.xor %4, %0 : i32 + %6 = llvm.or %5, %arg433 : i32 + %7 = llvm.and %3, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +def and_not_or_wrong_c_after := [llvm| +{ +^0(%arg432 : i32, %arg433 : i32, %arg434 : i32, %arg435 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg432, %arg433 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.or %arg434, %2 : i32 + %4 = llvm.and %arg432, %arg435 : i32 + %5 = llvm.xor %4, %0 : i32 + %6 = llvm.or %arg433, %5 : i32 + %7 = llvm.and %3, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +theorem and_not_or_wrong_c_proof : and_not_or_wrong_c_before ⊑ and_not_or_wrong_c_after := by + unfold and_not_or_wrong_c_before and_not_or_wrong_c_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN and_not_or_wrong_c + all_goals (try extract_goal ; sorry) + ---END and_not_or_wrong_c + + + +def and_not_or_wrong_b_before := [llvm| +{ +^0(%arg428 : i32, %arg429 : i32, %arg430 : i32, %arg431 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg428, %arg429 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.or %2, %arg430 : i32 + %4 = llvm.and %arg428, %arg430 : i32 + %5 = llvm.xor %4, %0 : i32 + %6 = llvm.or %5, %arg431 : i32 + %7 = llvm.and %3, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +def and_not_or_wrong_b_after := [llvm| +{ +^0(%arg428 : i32, %arg429 : i32, %arg430 : i32, %arg431 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg428, %arg429 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.or %arg430, %2 : i32 + %4 = llvm.and %arg428, %arg430 : i32 + %5 = llvm.xor %4, %0 : i32 + %6 = llvm.or %arg431, %5 : i32 + %7 = llvm.and %3, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +theorem and_not_or_wrong_b_proof : and_not_or_wrong_b_before ⊑ and_not_or_wrong_b_after := by + unfold and_not_or_wrong_b_before and_not_or_wrong_b_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN and_not_or_wrong_b + all_goals (try extract_goal ; sorry) + ---END and_not_or_wrong_b + + + def or_and_not_not_before := [llvm| { ^0(%arg425 : i32, %arg426 : i32, %arg427 : i32): @@ -1340,7 +1476,7 @@ theorem or_and_not_not_proof : or_and_not_not_before ⊑ or_and_not_not_after := intros try simp ---BEGIN or_and_not_not - apply or_and_not_not_thm + all_goals (try extract_goal ; sorry) ---END or_and_not_not @@ -1366,7 +1502,7 @@ def or_and_not_not_commute1_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 42 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg423 : i32 - %3 = llvm.and %2, %arg424 : i32 + %3 = llvm.and %arg424, %2 : i32 %4 = llvm.or %3, %arg422 : i32 %5 = llvm.xor %4, %1 : i32 "llvm.return"(%5) : (i32) -> () @@ -1381,7 +1517,7 @@ theorem or_and_not_not_commute1_proof : or_and_not_not_commute1_before ⊑ or_an intros try simp ---BEGIN or_and_not_not_commute1 - apply or_and_not_not_commute1_thm + all_goals (try extract_goal ; sorry) ---END or_and_not_not_commute1 @@ -1418,7 +1554,7 @@ theorem or_and_not_not_commute2_proof : or_and_not_not_commute2_before ⊑ or_an intros try simp ---BEGIN or_and_not_not_commute2 - apply or_and_not_not_commute2_thm + all_goals (try extract_goal ; sorry) ---END or_and_not_not_commute2 @@ -1455,7 +1591,7 @@ theorem or_and_not_not_commute3_proof : or_and_not_not_commute3_before ⊑ or_an intros try simp ---BEGIN or_and_not_not_commute3 - apply or_and_not_not_commute3_thm + all_goals (try extract_goal ; sorry) ---END or_and_not_not_commute3 @@ -1492,7 +1628,7 @@ theorem or_and_not_not_commute4_proof : or_and_not_not_commute4_before ⊑ or_an intros try simp ---BEGIN or_and_not_not_commute4 - apply or_and_not_not_commute4_thm + all_goals (try extract_goal ; sorry) ---END or_and_not_not_commute4 @@ -1529,7 +1665,7 @@ theorem or_and_not_not_commute5_proof : or_and_not_not_commute5_before ⊑ or_an intros try simp ---BEGIN or_and_not_not_commute5 - apply or_and_not_not_commute5_thm + all_goals (try extract_goal ; sorry) ---END or_and_not_not_commute5 @@ -1555,7 +1691,7 @@ def or_and_not_not_commute6_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 42 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg408 : i32 - %3 = llvm.and %2, %arg409 : i32 + %3 = llvm.and %arg409, %2 : i32 %4 = llvm.or %3, %arg407 : i32 %5 = llvm.xor %4, %1 : i32 "llvm.return"(%5) : (i32) -> () @@ -1570,7 +1706,7 @@ theorem or_and_not_not_commute6_proof : or_and_not_not_commute6_before ⊑ or_an intros try simp ---BEGIN or_and_not_not_commute6 - apply or_and_not_not_commute6_thm + all_goals (try extract_goal ; sorry) ---END or_and_not_not_commute6 @@ -1607,11 +1743,91 @@ theorem or_and_not_not_commute7_proof : or_and_not_not_commute7_before ⊑ or_an intros try simp ---BEGIN or_and_not_not_commute7 - apply or_and_not_not_commute7_thm + all_goals (try extract_goal ; sorry) ---END or_and_not_not_commute7 +def or_and_not_not_wrong_a_before := [llvm| +{ +^0(%arg382 : i32, %arg383 : i32, %arg384 : i32, %arg385 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.or %arg383, %arg385 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.or %arg382, %arg384 : i32 + %4 = llvm.xor %3, %0 : i32 + %5 = llvm.and %4, %arg383 : i32 + %6 = llvm.or %5, %2 : i32 + "llvm.return"(%6) : (i32) -> () +} +] +def or_and_not_not_wrong_a_after := [llvm| +{ +^0(%arg382 : i32, %arg383 : i32, %arg384 : i32, %arg385 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.or %arg383, %arg385 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.or %arg382, %arg384 : i32 + %4 = llvm.xor %3, %0 : i32 + %5 = llvm.and %arg383, %4 : i32 + %6 = llvm.or %5, %2 : i32 + "llvm.return"(%6) : (i32) -> () +} +] +theorem or_and_not_not_wrong_a_proof : or_and_not_not_wrong_a_before ⊑ or_and_not_not_wrong_a_after := by + unfold or_and_not_not_wrong_a_before or_and_not_not_wrong_a_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN or_and_not_not_wrong_a + all_goals (try extract_goal ; sorry) + ---END or_and_not_not_wrong_a + + + +def or_and_not_not_wrong_b_before := [llvm| +{ +^0(%arg378 : i32, %arg379 : i32, %arg380 : i32, %arg381 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.or %arg381, %arg378 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.or %arg378, %arg380 : i32 + %4 = llvm.xor %3, %0 : i32 + %5 = llvm.and %4, %arg379 : i32 + %6 = llvm.or %5, %2 : i32 + "llvm.return"(%6) : (i32) -> () +} +] +def or_and_not_not_wrong_b_after := [llvm| +{ +^0(%arg378 : i32, %arg379 : i32, %arg380 : i32, %arg381 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.or %arg381, %arg378 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.or %arg378, %arg380 : i32 + %4 = llvm.xor %3, %0 : i32 + %5 = llvm.and %arg379, %4 : i32 + %6 = llvm.or %5, %2 : i32 + "llvm.return"(%6) : (i32) -> () +} +] +theorem or_and_not_not_wrong_b_proof : or_and_not_not_wrong_b_before ⊑ or_and_not_not_wrong_b_after := by + unfold or_and_not_not_wrong_b_before or_and_not_not_wrong_b_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN or_and_not_not_wrong_b + all_goals (try extract_goal ; sorry) + ---END or_and_not_not_wrong_b + + + def and_or_not_not_before := [llvm| { ^0(%arg375 : i32, %arg376 : i32, %arg377 : i32): @@ -1644,7 +1860,7 @@ theorem and_or_not_not_proof : and_or_not_not_before ⊑ and_or_not_not_after := intros try simp ---BEGIN and_or_not_not - apply and_or_not_not_thm + all_goals (try extract_goal ; sorry) ---END and_or_not_not @@ -1670,7 +1886,7 @@ def and_or_not_not_commute1_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 42 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg373 : i32 - %3 = llvm.or %2, %arg374 : i32 + %3 = llvm.or %arg374, %2 : i32 %4 = llvm.and %3, %arg372 : i32 %5 = llvm.xor %4, %1 : i32 "llvm.return"(%5) : (i32) -> () @@ -1685,7 +1901,7 @@ theorem and_or_not_not_commute1_proof : and_or_not_not_commute1_before ⊑ and_o intros try simp ---BEGIN and_or_not_not_commute1 - apply and_or_not_not_commute1_thm + all_goals (try extract_goal ; sorry) ---END and_or_not_not_commute1 @@ -1722,7 +1938,7 @@ theorem and_or_not_not_commute2_proof : and_or_not_not_commute2_before ⊑ and_o intros try simp ---BEGIN and_or_not_not_commute2 - apply and_or_not_not_commute2_thm + all_goals (try extract_goal ; sorry) ---END and_or_not_not_commute2 @@ -1759,7 +1975,7 @@ theorem and_or_not_not_commute3_proof : and_or_not_not_commute3_before ⊑ and_o intros try simp ---BEGIN and_or_not_not_commute3 - apply and_or_not_not_commute3_thm + all_goals (try extract_goal ; sorry) ---END and_or_not_not_commute3 @@ -1796,7 +2012,7 @@ theorem and_or_not_not_commute4_proof : and_or_not_not_commute4_before ⊑ and_o intros try simp ---BEGIN and_or_not_not_commute4 - apply and_or_not_not_commute4_thm + all_goals (try extract_goal ; sorry) ---END and_or_not_not_commute4 @@ -1833,7 +2049,7 @@ theorem and_or_not_not_commute5_proof : and_or_not_not_commute5_before ⊑ and_o intros try simp ---BEGIN and_or_not_not_commute5 - apply and_or_not_not_commute5_thm + all_goals (try extract_goal ; sorry) ---END and_or_not_not_commute5 @@ -1859,7 +2075,7 @@ def and_or_not_not_commute6_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 42 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg358 : i32 - %3 = llvm.or %2, %arg359 : i32 + %3 = llvm.or %arg359, %2 : i32 %4 = llvm.and %3, %arg357 : i32 %5 = llvm.xor %4, %1 : i32 "llvm.return"(%5) : (i32) -> () @@ -1874,7 +2090,7 @@ theorem and_or_not_not_commute6_proof : and_or_not_not_commute6_before ⊑ and_o intros try simp ---BEGIN and_or_not_not_commute6 - apply and_or_not_not_commute6_thm + all_goals (try extract_goal ; sorry) ---END and_or_not_not_commute6 @@ -1911,7 +2127,7 @@ theorem and_or_not_not_commute7_proof : and_or_not_not_commute7_before ⊑ and_o intros try simp ---BEGIN and_or_not_not_commute7 - apply and_or_not_not_commute7_thm + all_goals (try extract_goal ; sorry) ---END and_or_not_not_commute7 @@ -1936,7 +2152,7 @@ def and_or_not_not_wrong_a_after := [llvm| %1 = llvm.and %arg333, %arg335 : i32 %2 = llvm.and %arg332, %arg334 : i32 %3 = llvm.xor %2, %0 : i32 - %4 = llvm.or %3, %arg333 : i32 + %4 = llvm.or %arg333, %3 : i32 %5 = llvm.xor %1, %4 : i32 "llvm.return"(%5) : (i32) -> () } @@ -1950,11 +2166,51 @@ theorem and_or_not_not_wrong_a_proof : and_or_not_not_wrong_a_before ⊑ and_or_ intros try simp ---BEGIN and_or_not_not_wrong_a - apply and_or_not_not_wrong_a_thm + all_goals (try extract_goal ; sorry) ---END and_or_not_not_wrong_a +def and_or_not_not_wrong_b_before := [llvm| +{ +^0(%arg328 : i32, %arg329 : i32, %arg330 : i32, %arg331 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg331, %arg328 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.and %arg328, %arg330 : i32 + %4 = llvm.xor %3, %0 : i32 + %5 = llvm.or %4, %arg329 : i32 + %6 = llvm.and %5, %2 : i32 + "llvm.return"(%6) : (i32) -> () +} +] +def and_or_not_not_wrong_b_after := [llvm| +{ +^0(%arg328 : i32, %arg329 : i32, %arg330 : i32, %arg331 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg331, %arg328 : i32 + %2 = llvm.xor %1, %0 : i32 + %3 = llvm.and %arg328, %arg330 : i32 + %4 = llvm.xor %3, %0 : i32 + %5 = llvm.or %arg329, %4 : i32 + %6 = llvm.and %5, %2 : i32 + "llvm.return"(%6) : (i32) -> () +} +] +theorem and_or_not_not_wrong_b_proof : and_or_not_not_wrong_b_before ⊑ and_or_not_not_wrong_b_after := by + unfold and_or_not_not_wrong_b_before and_or_not_not_wrong_b_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN and_or_not_not_wrong_b + all_goals (try extract_goal ; sorry) + ---END and_or_not_not_wrong_b + + + def and_not_or_or_not_or_xor_before := [llvm| { ^0(%arg325 : i32, %arg326 : i32, %arg327 : i32): @@ -1990,7 +2246,7 @@ theorem and_not_or_or_not_or_xor_proof : and_not_or_or_not_or_xor_before ⊑ and intros try simp ---BEGIN and_not_or_or_not_or_xor - apply and_not_or_or_not_or_xor_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_or_not_or_xor @@ -2030,7 +2286,7 @@ theorem and_not_or_or_not_or_xor_commute1_proof : and_not_or_or_not_or_xor_commu intros try simp ---BEGIN and_not_or_or_not_or_xor_commute1 - apply and_not_or_or_not_or_xor_commute1_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_or_not_or_xor_commute1 @@ -2074,7 +2330,7 @@ theorem and_not_or_or_not_or_xor_commute2_proof : and_not_or_or_not_or_xor_commu intros try simp ---BEGIN and_not_or_or_not_or_xor_commute2 - apply and_not_or_or_not_or_xor_commute2_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_or_not_or_xor_commute2 @@ -2114,7 +2370,7 @@ theorem and_not_or_or_not_or_xor_commute3_proof : and_not_or_or_not_or_xor_commu intros try simp ---BEGIN and_not_or_or_not_or_xor_commute3 - apply and_not_or_or_not_or_xor_commute3_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_or_not_or_xor_commute3 @@ -2158,7 +2414,7 @@ theorem and_not_or_or_not_or_xor_commute4_proof : and_not_or_or_not_or_xor_commu intros try simp ---BEGIN and_not_or_or_not_or_xor_commute4 - apply and_not_or_or_not_or_xor_commute4_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_or_not_or_xor_commute4 @@ -2198,7 +2454,7 @@ theorem and_not_or_or_not_or_xor_commute5_proof : and_not_or_or_not_or_xor_commu intros try simp ---BEGIN and_not_or_or_not_or_xor_commute5 - apply and_not_or_or_not_or_xor_commute5_thm + all_goals (try extract_goal ; sorry) ---END and_not_or_or_not_or_xor_commute5 @@ -2223,7 +2479,7 @@ def or_not_and_and_not_and_xor_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg290, %arg291 : i32 %2 = llvm.xor %1, %0 : i32 - %3 = llvm.or %2, %arg289 : i32 + %3 = llvm.or %arg289, %2 : i32 %4 = llvm.xor %arg290, %arg291 : i32 %5 = llvm.and %4, %arg289 : i32 %6 = llvm.xor %5, %3 : i32 @@ -2239,7 +2495,7 @@ theorem or_not_and_and_not_and_xor_proof : or_not_and_and_not_and_xor_before ⊑ intros try simp ---BEGIN or_not_and_and_not_and_xor - apply or_not_and_and_not_and_xor_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_and_not_and_xor @@ -2264,7 +2520,7 @@ def or_not_and_and_not_and_xor_commute1_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg288, %arg287 : i32 %2 = llvm.xor %1, %0 : i32 - %3 = llvm.or %2, %arg286 : i32 + %3 = llvm.or %arg286, %2 : i32 %4 = llvm.xor %arg287, %arg288 : i32 %5 = llvm.and %4, %arg286 : i32 %6 = llvm.xor %5, %3 : i32 @@ -2280,7 +2536,7 @@ theorem or_not_and_and_not_and_xor_commute1_proof : or_not_and_and_not_and_xor_c intros try simp ---BEGIN or_not_and_and_not_and_xor_commute1 - apply or_not_and_and_not_and_xor_commute1_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_and_not_and_xor_commute1 @@ -2325,7 +2581,7 @@ theorem or_not_and_and_not_and_xor_commute2_proof : or_not_and_and_not_and_xor_c intros try simp ---BEGIN or_not_and_and_not_and_xor_commute2 - apply or_not_and_and_not_and_xor_commute2_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_and_not_and_xor_commute2 @@ -2350,7 +2606,7 @@ def or_not_and_and_not_and_xor_commute3_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg281, %arg282 : i32 %2 = llvm.xor %1, %0 : i32 - %3 = llvm.or %2, %arg280 : i32 + %3 = llvm.or %arg280, %2 : i32 %4 = llvm.xor %arg282, %arg281 : i32 %5 = llvm.and %4, %arg280 : i32 %6 = llvm.xor %5, %3 : i32 @@ -2366,7 +2622,7 @@ theorem or_not_and_and_not_and_xor_commute3_proof : or_not_and_and_not_and_xor_c intros try simp ---BEGIN or_not_and_and_not_and_xor_commute3 - apply or_not_and_and_not_and_xor_commute3_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_and_not_and_xor_commute3 @@ -2411,7 +2667,7 @@ theorem or_not_and_and_not_and_xor_commute4_proof : or_not_and_and_not_and_xor_c intros try simp ---BEGIN or_not_and_and_not_and_xor_commute4 - apply or_not_and_and_not_and_xor_commute4_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_and_not_and_xor_commute4 @@ -2436,7 +2692,7 @@ def or_not_and_and_not_and_xor_commute5_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg275, %arg276 : i32 %2 = llvm.xor %1, %0 : i32 - %3 = llvm.or %2, %arg274 : i32 + %3 = llvm.or %arg274, %2 : i32 %4 = llvm.xor %arg275, %arg276 : i32 %5 = llvm.and %4, %arg274 : i32 %6 = llvm.xor %5, %3 : i32 @@ -2452,7 +2708,7 @@ theorem or_not_and_and_not_and_xor_commute5_proof : or_not_and_and_not_and_xor_c intros try simp ---BEGIN or_not_and_and_not_and_xor_commute5 - apply or_not_and_and_not_and_xor_commute5_thm + all_goals (try extract_goal ; sorry) ---END or_not_and_and_not_and_xor_commute5 @@ -2490,7 +2746,7 @@ theorem not_and_and_or_not_or_or_proof : not_and_and_or_not_or_or_before ⊑ not intros try simp ---BEGIN not_and_and_or_not_or_or - apply not_and_and_or_not_or_or_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_not_or_or @@ -2528,7 +2784,7 @@ theorem not_and_and_or_not_or_or_commute1_or_proof : not_and_and_or_not_or_or_co intros try simp ---BEGIN not_and_and_or_not_or_or_commute1_or - apply not_and_and_or_not_or_or_commute1_or_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_not_or_or_commute1_or @@ -2566,7 +2822,7 @@ theorem not_and_and_or_not_or_or_commute2_or_proof : not_and_and_or_not_or_or_co intros try simp ---BEGIN not_and_and_or_not_or_or_commute2_or - apply not_and_and_or_not_or_or_commute2_or_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_not_or_or_commute2_or @@ -2604,7 +2860,7 @@ theorem not_and_and_or_not_or_or_commute1_and_proof : not_and_and_or_not_or_or_c intros try simp ---BEGIN not_and_and_or_not_or_or_commute1_and - apply not_and_and_or_not_or_or_commute1_and_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_not_or_or_commute1_and @@ -2642,7 +2898,7 @@ theorem not_and_and_or_not_or_or_commute2_and_proof : not_and_and_or_not_or_or_c intros try simp ---BEGIN not_and_and_or_not_or_or_commute2_and - apply not_and_and_or_not_or_or_commute2_and_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_not_or_or_commute2_and @@ -2680,7 +2936,7 @@ theorem not_and_and_or_not_or_or_commute1_proof : not_and_and_or_not_or_or_commu intros try simp ---BEGIN not_and_and_or_not_or_or_commute1 - apply not_and_and_or_not_or_or_commute1_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_not_or_or_commute1 @@ -2722,7 +2978,7 @@ theorem not_and_and_or_not_or_or_commute2_proof : not_and_and_or_not_or_or_commu intros try simp ---BEGIN not_and_and_or_not_or_or_commute2 - apply not_and_and_or_not_or_or_commute2_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_not_or_or_commute2 @@ -2749,7 +3005,7 @@ def not_and_and_or_not_or_or_commute3_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 42 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg233 : i32 - %3 = llvm.xor %2, %arg234 : i32 + %3 = llvm.xor %arg234, %2 : i32 %4 = llvm.or %3, %arg232 : i32 %5 = llvm.xor %4, %1 : i32 "llvm.return"(%5) : (i32) -> () @@ -2764,7 +3020,7 @@ theorem not_and_and_or_not_or_or_commute3_proof : not_and_and_or_not_or_or_commu intros try simp ---BEGIN not_and_and_or_not_or_or_commute3 - apply not_and_and_or_not_or_or_commute3_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_not_or_or_commute3 @@ -2806,7 +3062,7 @@ theorem not_and_and_or_not_or_or_commute4_proof : not_and_and_or_not_or_or_commu intros try simp ---BEGIN not_and_and_or_not_or_or_commute4 - apply not_and_and_or_not_or_or_commute4_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_not_or_or_commute4 @@ -2844,7 +3100,7 @@ theorem not_or_or_and_not_and_and_proof : not_or_or_and_not_and_and_before ⊑ n intros try simp ---BEGIN not_or_or_and_not_and_and - apply not_or_or_and_not_and_and_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_not_and_and @@ -2882,7 +3138,7 @@ theorem not_or_or_and_not_and_and_commute1_and_proof : not_or_or_and_not_and_and intros try simp ---BEGIN not_or_or_and_not_and_and_commute1_and - apply not_or_or_and_not_and_and_commute1_and_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_not_and_and_commute1_and @@ -2920,7 +3176,7 @@ theorem not_or_or_and_not_and_and_commute2_and_proof : not_or_or_and_not_and_and intros try simp ---BEGIN not_or_or_and_not_and_and_commute2_and - apply not_or_or_and_not_and_and_commute2_and_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_not_and_and_commute2_and @@ -2958,7 +3214,7 @@ theorem not_or_or_and_not_and_and_commute1_or_proof : not_or_or_and_not_and_and_ intros try simp ---BEGIN not_or_or_and_not_and_and_commute1_or - apply not_or_or_and_not_and_and_commute1_or_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_not_and_and_commute1_or @@ -2996,7 +3252,7 @@ theorem not_or_or_and_not_and_and_commute2_or_proof : not_or_or_and_not_and_and_ intros try simp ---BEGIN not_or_or_and_not_and_and_commute2_or - apply not_or_or_and_not_and_and_commute2_or_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_not_and_and_commute2_or @@ -3034,7 +3290,7 @@ theorem not_or_or_and_not_and_and_commute1_proof : not_or_or_and_not_and_and_com intros try simp ---BEGIN not_or_or_and_not_and_and_commute1 - apply not_or_or_and_not_and_and_commute1_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_not_and_and_commute1 @@ -3076,7 +3332,7 @@ theorem not_or_or_and_not_and_and_commute2_proof : not_or_or_and_not_and_and_com intros try simp ---BEGIN not_or_or_and_not_and_and_commute2 - apply not_or_or_and_not_and_and_commute2_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_not_and_and_commute2 @@ -3104,7 +3360,7 @@ def not_or_or_and_not_and_and_commute3_after := [llvm| %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %2 = llvm.sdiv %0, %arg188 : i32 %3 = llvm.xor %arg187, %1 : i32 - %4 = llvm.xor %2, %arg189 : i32 + %4 = llvm.xor %arg189, %2 : i32 %5 = llvm.or %4, %3 : i32 "llvm.return"(%5) : (i32) -> () } @@ -3118,7 +3374,7 @@ theorem not_or_or_and_not_and_and_commute3_proof : not_or_or_and_not_and_and_com intros try simp ---BEGIN not_or_or_and_not_and_and_commute3 - apply not_or_or_and_not_and_and_commute3_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_not_and_and_commute3 @@ -3160,7 +3416,7 @@ theorem not_or_or_and_not_and_and_commute4_proof : not_or_or_and_not_and_and_com intros try simp ---BEGIN not_or_or_and_not_and_and_commute4 - apply not_or_or_and_not_and_and_commute4_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_not_and_and_commute4 @@ -3184,7 +3440,7 @@ def not_and_and_or_no_or_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg163, %0 : i32 %2 = llvm.xor %arg164, %0 : i32 - %3 = llvm.or %2, %arg165 : i32 + %3 = llvm.or %arg165, %2 : i32 %4 = llvm.and %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -3198,7 +3454,7 @@ theorem not_and_and_or_no_or_proof : not_and_and_or_no_or_before ⊑ not_and_and intros try simp ---BEGIN not_and_and_or_no_or - apply not_and_and_or_no_or_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_no_or @@ -3222,7 +3478,7 @@ def not_and_and_or_no_or_commute1_and_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg160, %0 : i32 %2 = llvm.xor %arg161, %0 : i32 - %3 = llvm.or %2, %arg162 : i32 + %3 = llvm.or %arg162, %2 : i32 %4 = llvm.and %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -3236,7 +3492,7 @@ theorem not_and_and_or_no_or_commute1_and_proof : not_and_and_or_no_or_commute1_ intros try simp ---BEGIN not_and_and_or_no_or_commute1_and - apply not_and_and_or_no_or_commute1_and_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_no_or_commute1_and @@ -3260,7 +3516,7 @@ def not_and_and_or_no_or_commute2_and_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg157, %0 : i32 %2 = llvm.xor %arg158, %0 : i32 - %3 = llvm.or %2, %arg159 : i32 + %3 = llvm.or %arg159, %2 : i32 %4 = llvm.and %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -3274,7 +3530,7 @@ theorem not_and_and_or_no_or_commute2_and_proof : not_and_and_or_no_or_commute2_ intros try simp ---BEGIN not_and_and_or_no_or_commute2_and - apply not_and_and_or_no_or_commute2_and_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_no_or_commute2_and @@ -3298,7 +3554,7 @@ def not_and_and_or_no_or_commute1_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg154, %0 : i32 %2 = llvm.xor %arg155, %0 : i32 - %3 = llvm.or %2, %arg156 : i32 + %3 = llvm.or %arg156, %2 : i32 %4 = llvm.and %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -3312,7 +3568,7 @@ theorem not_and_and_or_no_or_commute1_proof : not_and_and_or_no_or_commute1_befo intros try simp ---BEGIN not_and_and_or_no_or_commute1 - apply not_and_and_or_no_or_commute1_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_no_or_commute1 @@ -3340,7 +3596,7 @@ def not_and_and_or_no_or_commute2_after := [llvm| %2 = llvm.sdiv %0, %arg152 : i32 %3 = llvm.xor %arg151, %1 : i32 %4 = llvm.xor %2, %1 : i32 - %5 = llvm.or %4, %arg153 : i32 + %5 = llvm.or %arg153, %4 : i32 %6 = llvm.and %5, %3 : i32 "llvm.return"(%6) : (i32) -> () } @@ -3354,7 +3610,7 @@ theorem not_and_and_or_no_or_commute2_proof : not_and_and_or_no_or_commute2_befo intros try simp ---BEGIN not_and_and_or_no_or_commute2 - apply not_and_and_or_no_or_commute2_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_no_or_commute2 @@ -3396,7 +3652,7 @@ theorem not_and_and_or_no_or_commute3_proof : not_and_and_or_no_or_commute3_befo intros try simp ---BEGIN not_and_and_or_no_or_commute3 - apply not_and_and_or_no_or_commute3_thm + all_goals (try extract_goal ; sorry) ---END not_and_and_or_no_or_commute3 @@ -3420,7 +3676,7 @@ def not_or_or_and_no_and_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg121, %0 : i32 %2 = llvm.xor %arg122, %0 : i32 - %3 = llvm.and %2, %arg123 : i32 + %3 = llvm.and %arg123, %2 : i32 %4 = llvm.or %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -3434,7 +3690,7 @@ theorem not_or_or_and_no_and_proof : not_or_or_and_no_and_before ⊑ not_or_or_a intros try simp ---BEGIN not_or_or_and_no_and - apply not_or_or_and_no_and_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_no_and @@ -3458,7 +3714,7 @@ def not_or_or_and_no_and_commute1_or_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg118, %0 : i32 %2 = llvm.xor %arg119, %0 : i32 - %3 = llvm.and %2, %arg120 : i32 + %3 = llvm.and %arg120, %2 : i32 %4 = llvm.or %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -3472,7 +3728,7 @@ theorem not_or_or_and_no_and_commute1_or_proof : not_or_or_and_no_and_commute1_o intros try simp ---BEGIN not_or_or_and_no_and_commute1_or - apply not_or_or_and_no_and_commute1_or_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_no_and_commute1_or @@ -3496,7 +3752,7 @@ def not_or_or_and_no_and_commute2_or_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg115, %0 : i32 %2 = llvm.xor %arg116, %0 : i32 - %3 = llvm.and %2, %arg117 : i32 + %3 = llvm.and %arg117, %2 : i32 %4 = llvm.or %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -3510,7 +3766,7 @@ theorem not_or_or_and_no_and_commute2_or_proof : not_or_or_and_no_and_commute2_o intros try simp ---BEGIN not_or_or_and_no_and_commute2_or - apply not_or_or_and_no_and_commute2_or_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_no_and_commute2_or @@ -3534,7 +3790,7 @@ def not_or_or_and_no_and_commute1_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg112, %0 : i32 %2 = llvm.xor %arg113, %0 : i32 - %3 = llvm.and %2, %arg114 : i32 + %3 = llvm.and %arg114, %2 : i32 %4 = llvm.or %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -3548,7 +3804,7 @@ theorem not_or_or_and_no_and_commute1_proof : not_or_or_and_no_and_commute1_befo intros try simp ---BEGIN not_or_or_and_no_and_commute1 - apply not_or_or_and_no_and_commute1_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_no_and_commute1 @@ -3576,7 +3832,7 @@ def not_or_or_and_no_and_commute2_after := [llvm| %2 = llvm.sdiv %0, %arg110 : i32 %3 = llvm.xor %arg109, %1 : i32 %4 = llvm.xor %2, %1 : i32 - %5 = llvm.and %4, %arg111 : i32 + %5 = llvm.and %arg111, %4 : i32 %6 = llvm.or %5, %3 : i32 "llvm.return"(%6) : (i32) -> () } @@ -3590,7 +3846,7 @@ theorem not_or_or_and_no_and_commute2_proof : not_or_or_and_no_and_commute2_befo intros try simp ---BEGIN not_or_or_and_no_and_commute2 - apply not_or_or_and_no_and_commute2_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_no_and_commute2 @@ -3632,7 +3888,7 @@ theorem not_or_or_and_no_and_commute3_proof : not_or_or_and_no_and_commute3_befo intros try simp ---BEGIN not_or_or_and_no_and_commute3 - apply not_or_or_and_no_and_commute3_thm + all_goals (try extract_goal ; sorry) ---END not_or_or_and_no_and_commute3 @@ -3653,7 +3909,7 @@ def and_orn_xor_after := [llvm| ^0(%arg80 : i4, %arg81 : i4): %0 = "llvm.mlir.constant"() <{value = -1 : i4}> : () -> i4 %1 = llvm.xor %arg80, %0 : i4 - %2 = llvm.and %1, %arg81 : i4 + %2 = llvm.and %arg81, %1 : i4 "llvm.return"(%2) : (i4) -> () } ] @@ -3666,7 +3922,7 @@ theorem and_orn_xor_proof : and_orn_xor_before ⊑ and_orn_xor_after := by intros try simp ---BEGIN and_orn_xor - apply and_orn_xor_thm + all_goals (try extract_goal ; sorry) ---END and_orn_xor @@ -3704,7 +3960,7 @@ theorem and_orn_xor_commute8_proof : and_orn_xor_commute8_before ⊑ and_orn_xor intros try simp ---BEGIN and_orn_xor_commute8 - apply and_orn_xor_commute8_thm + all_goals (try extract_goal ; sorry) ---END and_orn_xor_commute8 @@ -3738,7 +3994,7 @@ theorem canonicalize_logic_first_or0_proof : canonicalize_logic_first_or0_before intros try simp ---BEGIN canonicalize_logic_first_or0 - apply canonicalize_logic_first_or0_thm + all_goals (try extract_goal ; sorry) ---END canonicalize_logic_first_or0 @@ -3772,7 +4028,7 @@ theorem canonicalize_logic_first_or0_nsw_proof : canonicalize_logic_first_or0_ns intros try simp ---BEGIN canonicalize_logic_first_or0_nsw - apply canonicalize_logic_first_or0_nsw_thm + all_goals (try extract_goal ; sorry) ---END canonicalize_logic_first_or0_nsw @@ -3806,7 +4062,7 @@ theorem canonicalize_logic_first_or0_nswnuw_proof : canonicalize_logic_first_or0 intros try simp ---BEGIN canonicalize_logic_first_or0_nswnuw - apply canonicalize_logic_first_or0_nswnuw_thm + all_goals (try extract_goal ; sorry) ---END canonicalize_logic_first_or0_nswnuw @@ -3840,7 +4096,7 @@ theorem canonicalize_logic_first_and0_proof : canonicalize_logic_first_and0_befo intros try simp ---BEGIN canonicalize_logic_first_and0 - apply canonicalize_logic_first_and0_thm + all_goals (try extract_goal ; sorry) ---END canonicalize_logic_first_and0 @@ -3874,7 +4130,7 @@ theorem canonicalize_logic_first_and0_nsw_proof : canonicalize_logic_first_and0_ intros try simp ---BEGIN canonicalize_logic_first_and0_nsw - apply canonicalize_logic_first_and0_nsw_thm + all_goals (try extract_goal ; sorry) ---END canonicalize_logic_first_and0_nsw @@ -3908,7 +4164,7 @@ theorem canonicalize_logic_first_and0_nswnuw_proof : canonicalize_logic_first_an intros try simp ---BEGIN canonicalize_logic_first_and0_nswnuw - apply canonicalize_logic_first_and0_nswnuw_thm + all_goals (try extract_goal ; sorry) ---END canonicalize_logic_first_and0_nswnuw @@ -3942,7 +4198,7 @@ theorem canonicalize_logic_first_xor_0_proof : canonicalize_logic_first_xor_0_be intros try simp ---BEGIN canonicalize_logic_first_xor_0 - apply canonicalize_logic_first_xor_0_thm + all_goals (try extract_goal ; sorry) ---END canonicalize_logic_first_xor_0 @@ -3976,7 +4232,7 @@ theorem canonicalize_logic_first_xor_0_nsw_proof : canonicalize_logic_first_xor_ intros try simp ---BEGIN canonicalize_logic_first_xor_0_nsw - apply canonicalize_logic_first_xor_0_nsw_thm + all_goals (try extract_goal ; sorry) ---END canonicalize_logic_first_xor_0_nsw @@ -4010,7 +4266,7 @@ theorem canonicalize_logic_first_xor_0_nswnuw_proof : canonicalize_logic_first_x intros try simp ---BEGIN canonicalize_logic_first_xor_0_nswnuw - apply canonicalize_logic_first_xor_0_nswnuw_thm + all_goals (try extract_goal ; sorry) ---END canonicalize_logic_first_xor_0_nswnuw diff --git a/SSA/Projects/InstCombine/tests/LLVM/gandhxorhor_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gandhxorhor_proof.lean deleted file mode 100644 index a4b12d816..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gandhxorhor_proof.lean +++ /dev/null @@ -1,541 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gandhxorhor_proof -theorem and_xor_not_common_op_thm (x x_1 : BitVec 32) : (x_1 ^^^ (x ^^^ 4294967295#32)) &&& x_1 = x_1 &&& x := sorry - -theorem and_not_xor_common_op_thm (x x_1 : BitVec 32) : (x_1 ^^^ x ^^^ 4294967295#32) &&& x = x &&& x_1 := sorry - -theorem or2_thm (x x_1 : BitVec 64) : x_1 &&& x ||| x_1 ^^^ x = x_1 ||| x := sorry - -theorem and_xor_or_negative_thm (x x_1 x_2 x_3 : BitVec 64) : x_3 ||| x_2 ^^^ x_1 &&& x = x_1 &&& x ^^^ x_2 ||| x_3 := sorry - -theorem and_shl_thm (x x_1 x_2 x_3 : BitVec 8) : - (Option.bind (if 8 ≤ x_2.toNat then none else some (x_3 <<< x_2.toNat)) fun a => - Option.bind (if 8 ≤ x_2.toNat then none else some (x_1 <<< x_2.toNat)) fun a_1 => some (a &&& (a_1 &&& x))) ⊑ - Option.bind (if 8 ≤ x_2.toNat then none else some ((x_1 &&& x_3) <<< x_2.toNat)) fun a => some (a &&& x) := sorry - -theorem or_shl_thm (x x_1 x_2 x_3 : BitVec 8) : - (Option.bind (if 8 ≤ x_2.toNat then none else some (x_3 <<< x_2.toNat)) fun a => - Option.bind (if 8 ≤ x_2.toNat then none else some (x <<< x_2.toNat)) fun a_1 => some (a ||| x_1 ||| a_1)) ⊑ - Option.bind (if 8 ≤ x_2.toNat then none else some ((x_3 ||| x) <<< x_2.toNat)) fun a => some (a ||| x_1) := sorry - -theorem or_lshr_thm (x x_1 x_2 x_3 : BitVec 8) : - (Option.bind (if 8 ≤ x_2.toNat then none else some (x_3 >>> x_2.toNat)) fun a => - Option.bind (if 8 ≤ x_2.toNat then none else some (x_1 >>> x_2.toNat)) fun a_1 => some (a ||| (a_1 ||| x))) ⊑ - Option.bind (if 8 ≤ x_2.toNat then none else some ((x_1 ||| x_3) >>> x_2.toNat)) fun a => some (a ||| x) := sorry - -theorem xor_lshr_thm (x x_1 x_2 x_3 : BitVec 8) : - (Option.bind (if 8 ≤ x_2.toNat then none else some (x_3 >>> x_2.toNat)) fun a => - Option.bind (if 8 ≤ x_2.toNat then none else some (x >>> x_2.toNat)) fun a_1 => some (a ^^^ x_1 ^^^ a_1)) ⊑ - Option.bind (if 8 ≤ x_2.toNat then none else some ((x_3 ^^^ x) >>> x_2.toNat)) fun a => some (a ^^^ x_1) := sorry - -theorem xor_lshr_multiuse_thm (x x_1 x_2 x_3 : BitVec 8) : - (Option.bind (if 8 ≤ x_2.toNat then none else some (x_3 >>> x_2.toNat)) fun a => - Option.bind (if 8 ≤ x_2.toNat then none else some (x_3 >>> x_2.toNat)) fun a_1 => - Option.bind (if 8 ≤ x_2.toNat then none else some (x >>> x_2.toNat)) fun a_2 => - if a_1 ^^^ x_1 ^^^ a_2 = 0#8 ∨ a ^^^ x_1 = intMin 8 ∧ a_1 ^^^ x_1 ^^^ a_2 = 255#8 then none - else some ((a ^^^ x_1).sdiv (a_1 ^^^ x_1 ^^^ a_2))) ⊑ - Option.bind (if 8 ≤ x_2.toNat then none else some (x_3 >>> x_2.toNat)) fun a => - Option.bind (if 8 ≤ x_2.toNat then none else some ((x_3 ^^^ x) >>> x_2.toNat)) fun a_1 => - if a_1 ^^^ x_1 = 0#8 ∨ a ^^^ x_1 = intMin 8 ∧ a_1 ^^^ x_1 = 255#8 then none - else some ((a ^^^ x_1).sdiv (a_1 ^^^ x_1)) := sorry - -theorem not_and_and_not_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - some (a &&& (x_1 ^^^ 4294967295#32) &&& (x ^^^ 4294967295#32))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some (a &&& ((x_1 ||| x) ^^^ 4294967295#32)) := sorry - -theorem not_and_and_not_commute1_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 &&& (x ^^^ 4294967295#32) = ((x_2 ||| x) ^^^ 4294967295#32) &&& x_1 := sorry - -theorem not_or_or_not_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - some (a ||| x_1 ^^^ 4294967295#32 ||| x ^^^ 4294967295#32)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some (a ||| x_1 &&& x ^^^ 4294967295#32) := sorry - -theorem not_or_or_not_commute1_thm (x x_1 x_2 : BitVec 32) : - x_2 ^^^ 4294967295#32 ||| x_1 ||| x ^^^ 4294967295#32 = x_2 &&& x ^^^ 4294967295#32 ||| x_1 := sorry - -theorem or_not_and_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| ((x_2 ||| x) ^^^ 4294967295#32) &&& x_1 = - (x_1 ^^^ x) &&& (x_2 ^^^ 4294967295#32) := sorry - -theorem or_not_and_commute1_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) fun a => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_1 => some (((x_2 ||| a) ^^^ 4294967295#32) &&& x ||| a_1 &&& ((x_2 ||| x) ^^^ 4294967295#32))) ⊑ - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a => some ((a ^^^ x) &&& (x_2 ^^^ 4294967295#32)) := sorry - -theorem or_not_and_commute2_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some (a &&& ((x_1 ||| x) ^^^ 4294967295#32) ||| ((x_1 ||| a_1) ^^^ 4294967295#32) &&& x)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ^^^ x) &&& (x_1 ^^^ 4294967295#32)) := sorry - -theorem or_not_and_commute3_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| ((x ||| x_1) ^^^ 4294967295#32) &&& x_2 = - (x_2 ^^^ x) &&& (x_1 ^^^ 4294967295#32) := sorry - -theorem or_not_and_commute4_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some (a &&& ((x_1 ||| x) ^^^ 4294967295#32) ||| ((x_1 ||| a_1) ^^^ 4294967295#32) &&& x)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ^^^ x) &&& (x_1 ^^^ 4294967295#32)) := sorry - -theorem or_not_and_commute5_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_1 => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_2 => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_3 => some (a &&& ((a_1 ||| x) ^^^ 4294967295#32) ||| ((a_2 ||| a_3) ^^^ 4294967295#32) &&& x)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_1 => some ((a ^^^ x) &&& (a_1 ^^^ 4294967295#32)) := sorry - -theorem or_not_and_commute6_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| ((x ||| x_2) ^^^ 4294967295#32) &&& x_1 = - (x_1 ^^^ x) &&& (x_2 ^^^ 4294967295#32) := sorry - -theorem or_not_and_commute7_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| ((x_1 ||| x) ^^^ 4294967295#32) &&& x_2 = - (x_2 ^^^ x) &&& (x_1 ^^^ 4294967295#32) := sorry - -theorem or_not_and_commute8_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_1 => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_2 => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_3 => some (((a ||| a_1) ^^^ 4294967295#32) &&& x ||| a_2 &&& ((x ||| a_3) ^^^ 4294967295#32))) ⊑ - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ^^^ x) &&& (a_1 ^^^ 4294967295#32)) := sorry - -theorem or_not_and_commute9_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_1 => - Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) - fun a_2 => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_3 => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_4 => - Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) - fun a_5 => - some (((a ||| a_1) ^^^ 4294967295#32) &&& a_2 ||| a_3 &&& ((a_4 ||| a_5) ^^^ 4294967295#32))) ⊑ - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a => - Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) fun a_1 => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_2 => some ((a ^^^ a_1) &&& (a_2 ^^^ 4294967295#32)) := sorry - -theorem and_not_or_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& (x_2 &&& x ^^^ 4294967295#32 ||| x_1) = - (x_1 ^^^ x) &&& x_2 ^^^ 4294967295#32 := sorry - -theorem and_not_or_commute1_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) fun a => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_1 => some ((x_2 &&& a ^^^ 4294967295#32 ||| x) &&& (a_1 ||| x_2 &&& x ^^^ 4294967295#32))) ⊑ - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a => some ((a ^^^ x) &&& x_2 ^^^ 4294967295#32) := sorry - -theorem and_not_or_commute2_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ||| x_1 &&& x ^^^ 4294967295#32) &&& (x_1 &&& a_1 ^^^ 4294967295#32 ||| x))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ^^^ x) &&& x_1 ^^^ 4294967295#32) := sorry - -theorem and_not_or_commute3_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& (x &&& x_1 ^^^ 4294967295#32 ||| x_2) = - (x_2 ^^^ x) &&& x_1 ^^^ 4294967295#32 := sorry - -theorem and_not_or_commute4_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ||| x_1 &&& x ^^^ 4294967295#32) &&& (x_1 &&& a_1 ^^^ 4294967295#32 ||| x))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ^^^ x) &&& x_1 ^^^ 4294967295#32) := sorry - -theorem and_not_or_commute5_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_1 => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_2 => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_3 => some ((a ||| a_1 &&& x ^^^ 4294967295#32) &&& (a_2 &&& a_3 ^^^ 4294967295#32 ||| x))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_1 => some ((a ^^^ x) &&& a_1 ^^^ 4294967295#32) := sorry - -theorem and_not_or_commute6_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& (x &&& x_2 ^^^ 4294967295#32 ||| x_1) = - (x_1 ^^^ x) &&& x_2 ^^^ 4294967295#32 := sorry - -theorem and_not_or_commute7_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& (x_1 &&& x ^^^ 4294967295#32 ||| x_2) = - (x_2 ^^^ x) &&& x_1 ^^^ 4294967295#32 := sorry - -theorem and_not_or_commute8_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_1 => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_2 => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_3 => some ((a &&& a_1 ^^^ 4294967295#32 ||| x) &&& (a_2 ||| x &&& a_3 ^^^ 4294967295#32))) ⊑ - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ^^^ x) &&& a_1 ^^^ 4294967295#32) := sorry - -theorem and_not_or_commute9_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_1 => - Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) - fun a_2 => - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a_3 => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_4 => - Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) - fun a_5 => some ((a &&& a_1 ^^^ 4294967295#32 ||| a_2) &&& (a_3 ||| a_4 &&& a_5 ^^^ 4294967295#32))) ⊑ - Option.bind (if x_1 = 0#32 ∨ 42#32 = intMin 32 ∧ x_1 = 4294967295#32 then none else some ((42#32).sdiv x_1)) - fun a => - Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) fun a_1 => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_2 => some ((a ^^^ a_1) &&& a_2 ^^^ 4294967295#32) := sorry - -theorem or_and_not_not_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| (x ||| x_2) ^^^ 4294967295#32 = - (x_1 &&& x ||| x_2) ^^^ 4294967295#32 := sorry - -theorem or_and_not_not_commute1_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some (a &&& ((x_1 ||| x) ^^^ 4294967295#32) ||| (a_1 ||| x_1) ^^^ 4294967295#32)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a &&& x ||| x_1) ^^^ 4294967295#32) := sorry - -theorem or_and_not_not_commute2_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| (x ||| x_2) ^^^ 4294967295#32 = - (x_1 &&& x ||| x_2) ^^^ 4294967295#32 := sorry - -theorem or_and_not_not_commute3_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| (x ||| x_1) ^^^ 4294967295#32 = - (x_2 &&& x ||| x_1) ^^^ 4294967295#32 := sorry - -theorem or_and_not_not_commute4_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| (x_2 ||| x) ^^^ 4294967295#32 = - (x_1 &&& x ||| x_2) ^^^ 4294967295#32 := sorry - -theorem or_and_not_not_commute5_thm (x x_1 x_2 : BitVec 32) : - (x_2 ||| x_1) ^^^ 4294967295#32 ||| ((x_1 ||| x) ^^^ 4294967295#32) &&& x_2 = - (x &&& x_2 ||| x_1) ^^^ 4294967295#32 := sorry - -theorem or_and_not_not_commute6_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some (a &&& ((x_1 ||| x) ^^^ 4294967295#32) ||| (a_1 ||| x) ^^^ 4294967295#32)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a &&& x_1 ||| x) ^^^ 4294967295#32) := sorry - -theorem or_and_not_not_commute7_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| (x_1 ||| x) ^^^ 4294967295#32 = - (x_2 &&& x ||| x_1) ^^^ 4294967295#32 := sorry - -theorem and_or_not_not_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& (x &&& x_2 ^^^ 4294967295#32) = - (x_1 ||| x) &&& x_2 ^^^ 4294967295#32 := sorry - -theorem and_or_not_not_commute1_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ||| x_1 &&& x ^^^ 4294967295#32) &&& (a_1 &&& x_1 ^^^ 4294967295#32))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ||| x) &&& x_1 ^^^ 4294967295#32) := sorry - -theorem and_or_not_not_commute2_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& (x &&& x_2 ^^^ 4294967295#32) = - (x_1 ||| x) &&& x_2 ^^^ 4294967295#32 := sorry - -theorem and_or_not_not_commute3_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& (x &&& x_1 ^^^ 4294967295#32) = - (x_2 ||| x) &&& x_1 ^^^ 4294967295#32 := sorry - -theorem and_or_not_not_commute4_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& (x_2 &&& x ^^^ 4294967295#32) = - (x_1 ||| x) &&& x_2 ^^^ 4294967295#32 := sorry - -theorem and_or_not_not_commute5_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32) &&& (x_1 &&& x ^^^ 4294967295#32 ||| x_2) = - (x ||| x_2) &&& x_1 ^^^ 4294967295#32 := sorry - -theorem and_or_not_not_commute6_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ||| x_1 &&& x ^^^ 4294967295#32) &&& (a_1 &&& x ^^^ 4294967295#32))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ||| x_1) &&& x ^^^ 4294967295#32) := sorry - -theorem and_or_not_not_commute7_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& (x_1 &&& x ^^^ 4294967295#32) = - (x_2 ||| x) &&& x_1 ^^^ 4294967295#32 := sorry - -theorem and_or_not_not_wrong_a_thm (x x_1 x_2 x_3 : BitVec 32) : - (x_3 &&& x_2 ^^^ 4294967295#32 ||| x_1) &&& (x_1 &&& x ^^^ 4294967295#32) = - x_1 &&& x ^^^ (x_3 &&& x_2 ^^^ 4294967295#32 ||| x_1) := sorry - -theorem and_not_or_or_not_or_xor_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| (x_2 ^^^ x_1 ||| x) ^^^ 4294967295#32 = - (x_2 ||| x_1) &&& (x_2 ^^^ x_1 ||| x) ^^^ 4294967295#32 := sorry - -theorem and_not_or_or_not_or_xor_commute1_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| (x_1 ^^^ x_2 ||| x) ^^^ 4294967295#32 = - (x_2 ||| x_1) &&& (x_1 ^^^ x_2 ||| x) ^^^ 4294967295#32 := sorry - -theorem and_not_or_or_not_or_xor_commute2_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some (a &&& ((x_1 ||| x) ^^^ 4294967295#32) ||| (x_1 ^^^ x ||| a_1) ^^^ 4294967295#32)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((x_1 ||| x) &&& (x_1 ^^^ x ||| a) ^^^ 4294967295#32) := sorry - -theorem and_not_or_or_not_or_xor_commute3_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x ||| (x_1 ^^^ x_2 ||| x) ^^^ 4294967295#32 = - (x_2 ||| x_1) &&& (x_1 ^^^ x_2 ||| x) ^^^ 4294967295#32 := sorry - -theorem and_not_or_or_not_or_xor_commute4_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some (a &&& ((x_1 ||| x) ^^^ 4294967295#32) ||| (a_1 ||| x_1 ^^^ x) ^^^ 4294967295#32)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((x_1 ||| x) &&& (a ||| x_1 ^^^ x) ^^^ 4294967295#32) := sorry - -theorem and_not_or_or_not_or_xor_commute5_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ x_1 ||| x) ^^^ 4294967295#32 ||| ((x_2 ||| x_1) ^^^ 4294967295#32) &&& x = - (x_2 ||| x_1) &&& (x_2 ^^^ x_1 ||| x) ^^^ 4294967295#32 := sorry - -theorem or_not_and_and_not_and_xor_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& ((x_2 ^^^ x_1) &&& x ^^^ 4294967295#32) = - (x_2 ^^^ x_1) &&& x ^^^ (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) := sorry - -theorem or_not_and_and_not_and_xor_commute1_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& ((x_1 ^^^ x_2) &&& x ^^^ 4294967295#32) = - (x_1 ^^^ x_2) &&& x ^^^ (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) := sorry - -theorem or_not_and_and_not_and_xor_commute2_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ||| x_1 &&& x ^^^ 4294967295#32) &&& ((x_1 ^^^ x) &&& a_1 ^^^ 4294967295#32))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((x_1 ^^^ x) &&& a ^^^ (a_1 ||| x_1 &&& x ^^^ 4294967295#32)) := sorry - -theorem or_not_and_and_not_and_xor_commute3_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) &&& ((x_1 ^^^ x_2) &&& x ^^^ 4294967295#32) = - (x_1 ^^^ x_2) &&& x ^^^ (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) := sorry - -theorem or_not_and_and_not_and_xor_commute4_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ||| x_1 &&& x ^^^ 4294967295#32) &&& (a_1 &&& (x_1 ^^^ x) ^^^ 4294967295#32))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some (a &&& (x_1 ^^^ x) ^^^ (a_1 ||| x_1 &&& x ^^^ 4294967295#32)) := sorry - -theorem or_not_and_and_not_and_xor_commute5_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ^^^ x_1) &&& x ^^^ 4294967295#32) &&& (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) = - (x_2 ^^^ x_1) &&& x ^^^ (x_2 &&& x_1 ^^^ 4294967295#32 ||| x) := sorry - -theorem not_and_and_or_not_or_or_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 &&& x ||| (x_1 ||| x_2 ||| x) ^^^ 4294967295#32 = - (x ^^^ x_1 ||| x_2) ^^^ 4294967295#32 := sorry - -theorem not_and_and_or_not_or_or_commute1_or_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 &&& x ||| (x ||| x_2 ||| x_1) ^^^ 4294967295#32 = - (x ^^^ x_1 ||| x_2) ^^^ 4294967295#32 := sorry - -theorem not_and_and_or_not_or_or_commute2_or_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 &&& x ||| (x_1 ||| x ||| x_2) ^^^ 4294967295#32 = - (x ^^^ x_1 ||| x_2) ^^^ 4294967295#32 := sorry - -theorem not_and_and_or_not_or_or_commute1_and_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 &&& x ||| (x ||| x_2 ||| x_1) ^^^ 4294967295#32 = - (x ^^^ x_1 ||| x_2) ^^^ 4294967295#32 := sorry - -theorem not_and_and_or_not_or_or_commute2_and_thm (x x_1 x_2 : BitVec 32) : - x_2 &&& x_1 &&& (x ^^^ 4294967295#32) ||| (x_2 ||| x ||| x_1) ^^^ 4294967295#32 = - (x_2 ^^^ x_1 ||| x) ^^^ 4294967295#32 := sorry - -theorem not_and_and_or_not_or_or_commute1_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 &&& x ||| (x_2 ||| x_1 ||| x) ^^^ 4294967295#32 = - (x ^^^ x_1 ||| x_2) ^^^ 4294967295#32 := sorry - -theorem not_and_and_or_not_or_or_commute2_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) fun a => - Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) fun a_1 => - some ((x_2 ^^^ 4294967295#32) &&& x_1 &&& a ||| (a_1 ||| (x_1 ||| x_2)) ^^^ 4294967295#32)) ⊑ - Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) fun a => - some ((a ^^^ x_1 ||| x_2) ^^^ 4294967295#32) := sorry - -theorem not_and_and_or_not_or_or_commute3_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some (a &&& (x_1 ^^^ 4294967295#32) &&& x ||| (a_1 ||| x_1 ||| x) ^^^ 4294967295#32)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ^^^ x ||| x_1) ^^^ 4294967295#32) := sorry - -theorem not_and_and_or_not_or_or_commute4_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some (a &&& ((x_1 ^^^ 4294967295#32) &&& x) ||| (x ||| x_1 ||| a_1) ^^^ 4294967295#32)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ^^^ x ||| x_1) ^^^ 4294967295#32) := sorry - -theorem not_or_or_and_not_and_and_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32 ||| x_1 ||| x) &&& (x_1 &&& x_2 &&& x ^^^ 4294967295#32) = - x ^^^ x_1 ||| x_2 ^^^ 4294967295#32 := sorry - -theorem not_or_or_and_not_and_and_commute1_and_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32 ||| x_1 ||| x) &&& (x &&& x_2 &&& x_1 ^^^ 4294967295#32) = - x ^^^ x_1 ||| x_2 ^^^ 4294967295#32 := sorry - -theorem not_or_or_and_not_and_and_commute2_and_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32 ||| x_1 ||| x) &&& (x_1 &&& x &&& x_2 ^^^ 4294967295#32) = - x ^^^ x_1 ||| x_2 ^^^ 4294967295#32 := sorry - -theorem not_or_or_and_not_and_and_commute1_or_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32 ||| x_1 ||| x) &&& (x &&& x_2 &&& x_1 ^^^ 4294967295#32) = - x ^^^ x_1 ||| x_2 ^^^ 4294967295#32 := sorry - -theorem not_or_or_and_not_and_and_commute2_or_thm (x x_1 x_2 : BitVec 32) : - (x_2 ||| x_1 ||| x ^^^ 4294967295#32) &&& (x_2 &&& x &&& x_1 ^^^ 4294967295#32) = - x_2 ^^^ x_1 ||| x ^^^ 4294967295#32 := sorry - -theorem not_or_or_and_not_and_and_commute1_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32 ||| x_1 ||| x) &&& (x_2 &&& x_1 &&& x ^^^ 4294967295#32) = - x ^^^ x_1 ||| x_2 ^^^ 4294967295#32 := sorry - -theorem not_or_or_and_not_and_and_commute2_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) fun a => - Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) fun a_1 => - some ((x_2 ^^^ 4294967295#32 ||| x_1 ||| a) &&& (a_1 &&& (x_1 &&& x_2) ^^^ 4294967295#32))) ⊑ - Option.bind (if x = 0#32 ∨ 42#32 = intMin 32 ∧ x = 4294967295#32 then none else some ((42#32).sdiv x)) fun a => - some (a ^^^ x_1 ||| x_2 ^^^ 4294967295#32) := sorry - -theorem not_or_or_and_not_and_and_commute3_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ||| x_1 ^^^ 4294967295#32 ||| x) &&& (a_1 &&& x_1 &&& x ^^^ 4294967295#32))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some (a ^^^ x ||| x_1 ^^^ 4294967295#32) := sorry - -theorem not_or_or_and_not_and_and_commute4_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ||| (x_1 ^^^ 4294967295#32 ||| x)) &&& (x &&& x_1 &&& a_1 ^^^ 4294967295#32))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some (a ^^^ x ||| x_1 ^^^ 4294967295#32) := sorry - -theorem not_and_and_or_no_or_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 &&& x ||| (x_1 ||| x_2) ^^^ 4294967295#32 = - (x_1 ^^^ 4294967295#32 ||| x) &&& (x_2 ^^^ 4294967295#32) := sorry - -theorem not_and_and_or_no_or_commute1_and_thm (x x_1 x_2 : BitVec 32) : - x_2 &&& x_1 &&& (x ^^^ 4294967295#32) ||| (x_1 ||| x) ^^^ 4294967295#32 = - (x_1 ^^^ 4294967295#32 ||| x_2) &&& (x ^^^ 4294967295#32) := sorry - -theorem not_and_and_or_no_or_commute2_and_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 &&& x ||| (x ||| x_2) ^^^ 4294967295#32 = - (x ^^^ 4294967295#32 ||| x_1) &&& (x_2 ^^^ 4294967295#32) := sorry - -theorem not_and_and_or_no_or_commute1_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 &&& x ||| (x_2 ||| x_1) ^^^ 4294967295#32 = - (x_1 ^^^ 4294967295#32 ||| x) &&& (x_2 ^^^ 4294967295#32) := sorry - -theorem not_and_and_or_no_or_commute2_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some (a &&& (x_1 ^^^ 4294967295#32) &&& x ||| (a_1 ||| x_1) ^^^ 4294967295#32)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ^^^ 4294967295#32 ||| x) &&& (x_1 ^^^ 4294967295#32)) := sorry - -theorem not_and_and_or_no_or_commute3_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - some (a &&& ((x_1 ^^^ 4294967295#32) &&& x) ||| (x ||| x_1) ^^^ 4294967295#32)) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ||| x ^^^ 4294967295#32) &&& (x_1 ^^^ 4294967295#32)) := sorry - -theorem not_or_or_and_no_and_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32 ||| x_1 ||| x) &&& (x_1 &&& x_2 ^^^ 4294967295#32) = - (x_1 ^^^ 4294967295#32) &&& x ||| x_2 ^^^ 4294967295#32 := sorry - -theorem not_or_or_and_no_and_commute1_or_thm (x x_1 x_2 : BitVec 32) : - (x_2 ||| x_1 ||| x ^^^ 4294967295#32) &&& (x_1 &&& x ^^^ 4294967295#32) = - (x_1 ^^^ 4294967295#32) &&& x_2 ||| x ^^^ 4294967295#32 := sorry - -theorem not_or_or_and_no_and_commute2_or_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32 ||| x_1 ||| x) &&& (x &&& x_2 ^^^ 4294967295#32) = - (x ^^^ 4294967295#32) &&& x_1 ||| x_2 ^^^ 4294967295#32 := sorry - -theorem not_or_or_and_no_and_commute1_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32 ||| x_1 ||| x) &&& (x_2 &&& x_1 ^^^ 4294967295#32) = - (x_1 ^^^ 4294967295#32) &&& x ||| x_2 ^^^ 4294967295#32 := sorry - -theorem not_or_or_and_no_and_commute2_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a_1 => some ((a ||| x_1 ^^^ 4294967295#32 ||| x) &&& (a_1 &&& x_1 ^^^ 4294967295#32))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some ((a ^^^ 4294967295#32) &&& x ||| x_1 ^^^ 4294967295#32) := sorry - -theorem not_or_or_and_no_and_commute3_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) fun a => - some ((a ||| (x_1 ^^^ 4294967295#32 ||| x)) &&& (x &&& x_1 ^^^ 4294967295#32))) ⊑ - Option.bind (if x_2 = 0#32 ∨ 42#32 = intMin 32 ∧ x_2 = 4294967295#32 then none else some ((42#32).sdiv x_2)) - fun a => some (a &&& (x ^^^ 4294967295#32) ||| x_1 ^^^ 4294967295#32) := sorry - -theorem and_orn_xor_thm (x x_1 : BitVec 4) : (x_1 ^^^ 15#4 ||| x) &&& (x_1 ^^^ x) = (x_1 ^^^ 15#4) &&& x := sorry - -theorem and_orn_xor_commute8_thm (x x_1 : BitVec 32) : - (x_1 * x_1 ^^^ x * x) &&& (x_1 * x_1 ||| x * x ^^^ 4294967295#32) = x_1 * x_1 &&& (x * x ^^^ 4294967295#32) := sorry - -theorem canonicalize_logic_first_or0_thm (x : BitVec 32) : x + 112#32 ||| 15#32 = (x ||| 15#32) + 112#32 := sorry - -theorem canonicalize_logic_first_or0_nsw_thm (x : BitVec 32) : x + 112#32 ||| 15#32 = (x ||| 15#32) + 112#32 := sorry - -theorem canonicalize_logic_first_or0_nswnuw_thm (x : BitVec 32) : x + 112#32 ||| 15#32 = (x ||| 15#32) + 112#32 := sorry - -theorem canonicalize_logic_first_and0_thm (x : BitVec 8) : x + 48#8 &&& 246#8 = (x &&& 246#8) + 48#8 := sorry - -theorem canonicalize_logic_first_and0_nsw_thm (x : BitVec 8) : x + 48#8 &&& 246#8 = (x &&& 246#8) + 48#8 := sorry - -theorem canonicalize_logic_first_and0_nswnuw_thm (x : BitVec 8) : x + 48#8 &&& 246#8 = (x &&& 246#8) + 48#8 := sorry - -theorem canonicalize_logic_first_xor_0_thm (x : BitVec 8) : x + 96#8 ^^^ 31#8 = (x ^^^ 31#8) + 96#8 := sorry - -theorem canonicalize_logic_first_xor_0_nsw_thm (x : BitVec 8) : x + 96#8 ^^^ 31#8 = (x ^^^ 31#8) + 96#8 := sorry - -theorem canonicalize_logic_first_xor_0_nswnuw_thm (x : BitVec 8) : x + 96#8 ^^^ 31#8 = (x ^^^ 31#8) + 96#8 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gannotations.lean b/SSA/Projects/InstCombine/tests/LLVM/gannotations.lean index 990fafbbc..517a7a415 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gannotations.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gannotations.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gannotations_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics diff --git a/SSA/Projects/InstCombine/tests/LLVM/gannotations_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gannotations_proof.lean deleted file mode 100644 index 7ef0dfc3c..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gannotations_proof.lean +++ /dev/null @@ -1,6 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gannotations_proof diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthadd.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthadd.lean index 311b2e652..22379436b 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthadd.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthadd.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gapinthadd_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -12,11 +12,11 @@ set_option linter.deprecated false set_option linter.unreachableTactic false set_option linter.unusedTactic false section gapinthadd_statements - + def test1_before := [llvm| { ^0(%arg12 : i1): - %0 = "llvm.mlir.constant"() <{value = 1 : i1}> : () -> i1 + %0 = "llvm.mlir.constant"() <{value = true}> : () -> i1 %1 = llvm.xor %arg12, %0 : i1 %2 = llvm.add %1, %0 : i1 "llvm.return"(%2) : (i1) -> () @@ -291,3 +291,5 @@ theorem test9_proof : test9_before ⊑ test9_after := by ---BEGIN test9 all_goals (try extract_goal ; sorry) ---END test9 + + diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthadd_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthadd_proof.lean deleted file mode 100644 index 62ececc52..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthadd_proof.lean +++ /dev/null @@ -1,6 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gapinthadd_proof diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthand.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthand.lean index 5dc23fddb..12a15200b 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthand.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthand.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gapinthand_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -37,7 +37,7 @@ theorem test0_proof : test0_before ⊑ test0_after := by intros try simp ---BEGIN test0 - apply test0_thm + all_goals (try extract_goal ; sorry) ---END test0 @@ -65,7 +65,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 @@ -96,7 +96,7 @@ theorem test3_proof : test3_before ⊑ test3_after := by intros try simp ---BEGIN test3 - apply test3_thm + all_goals (try extract_goal ; sorry) ---END test3 @@ -128,7 +128,7 @@ theorem test7_proof : test7_before ⊑ test7_after := by intros try simp ---BEGIN test7 - apply test7_thm + all_goals (try extract_goal ; sorry) ---END test7 @@ -157,7 +157,7 @@ theorem test8_proof : test8_before ⊑ test8_after := by intros try simp ---BEGIN test8 - apply test8_thm + all_goals (try extract_goal ; sorry) ---END test8 @@ -185,7 +185,7 @@ theorem test9_proof : test9_before ⊑ test9_after := by intros try simp ---BEGIN test9 - apply test9_thm + all_goals (try extract_goal ; sorry) ---END test9 @@ -216,7 +216,7 @@ theorem test10_proof : test10_before ⊑ test10_after := by intros try simp ---BEGIN test10 - apply test10_thm + all_goals (try extract_goal ; sorry) ---END test10 @@ -248,7 +248,7 @@ theorem test13_proof : test13_before ⊑ test13_after := by intros try simp ---BEGIN test13 - apply test13_thm + all_goals (try extract_goal ; sorry) ---END test13 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthand_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthand_proof.lean deleted file mode 100644 index 9b60c6ca5..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthand_proof.lean +++ /dev/null @@ -1,28 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gapinthand_proof -theorem test0_thm (x : BitVec 39) : x &&& 0#39 = 0#39 := sorry - -theorem test2_thm (x : BitVec 15) : x &&& 32767#15 = x := sorry - -theorem test3_thm (x : BitVec 23) : x &&& 127#23 &&& 128#23 = 0#23 := sorry - -theorem test7_thm (x : BitVec 47) : x.sshiftRight 39 &&& 255#47 = x >>> 39 := sorry - -theorem test8_thm (x : BitVec 999) : x &&& 0#999 = 0#999 := sorry - -theorem test9_thm (x : BitVec 1005) : - x &&& - 342882754299605542703496015699200579379649539745770754382000124278512336359979559197823481221022674600830295333617006984059886491421540493951506482390354393725906168794375391533474387361995876540094533828897487199474622120556760561893297406274466013266278287285969349365133754612883980378790581378220031#1005 = - x := sorry - -theorem test10_thm (x : BitVec 123) : x &&& 127#123 &&& 128#123 = 0#123 := sorry - -theorem test13_thm (x : BitVec 1024) : - (Option.bind (if 1024 ≤ 1016 % 2 ^ 1024 then none else some (x.sshiftRight (1016 % 2 ^ 1024))) fun a => - some (a &&& 255#1024)) ⊑ - if 1024 ≤ 1016 % 2 ^ 1024 then none else some (x >>> (1016 % 2 ^ 1024)) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthandhxorhmerge.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthandhxorhmerge.lean index 198fbef70..b7aea56de 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthandhxorhmerge.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthandhxorhmerge.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gapinthandhxorhmerge_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -26,7 +26,7 @@ def test1_after := [llvm| { ^0(%arg3 : i57, %arg4 : i57, %arg5 : i57): %0 = llvm.xor %arg3, %arg4 : i57 - %1 = llvm.and %0, %arg5 : i57 + %1 = llvm.and %arg5, %0 : i57 "llvm.return"(%1) : (i57) -> () } ] @@ -39,7 +39,7 @@ theorem test1_proof : test1_before ⊑ test1_after := by intros try simp ---BEGIN test1 - apply test1_thm + all_goals (try extract_goal ; sorry) ---END test1 @@ -69,7 +69,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthandhxorhmerge_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthandhxorhmerge_proof.lean deleted file mode 100644 index 05b2b156b..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthandhxorhmerge_proof.lean +++ /dev/null @@ -1,10 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gapinthandhxorhmerge_proof -theorem test1_thm (x x_1 x_2 : BitVec 57) : x_2 &&& x_1 ^^^ x_2 &&& x = (x_1 ^^^ x) &&& x_2 := sorry - -theorem test2_thm (x x_1 : BitVec 23) : x_1 &&& x ^^^ (x_1 ||| x) = x_1 ^^^ x := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthmul2.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthmul2.lean index 8815950dd..0fff8739d 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthmul2.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthmul2.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gapinthmul2_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -40,7 +40,7 @@ theorem test1_proof : test1_before ⊑ test1_after := by intros try simp ---BEGIN test1 - apply test1_thm + all_goals (try extract_goal ; sorry) ---END test1 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthmul2_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthmul2_proof.lean deleted file mode 100644 index e17fa1ef0..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthmul2_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gapinthmul2_proof -theorem test1_thm (x : BitVec 177) : x * 45671926166590716193865151022383844364247891968#177 = x <<< 155 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthor.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthor.lean index 9c84d97dc..32e90a755 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthor.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthor.lean @@ -63,7 +63,7 @@ def test2_after := [llvm| ^0(%arg3 : i39, %arg4 : i39): %0 = "llvm.mlir.constant"() <{value = -274877906944 : i39}> : () -> i39 %1 = llvm.and %arg4, %0 : i39 - %2 = llvm.add %1, %arg3 : i39 + %2 = llvm.add %arg3, %1 : i39 "llvm.return"(%2) : (i39) -> () } ] @@ -131,7 +131,7 @@ def test5_after := [llvm| ^0(%arg0 : i399, %arg1 : i399): %0 = "llvm.mlir.constant"() <{value = 18446742974197923840 : i399}> : () -> i399 %1 = llvm.and %arg1, %0 : i399 - %2 = llvm.add %1, %arg0 : i399 + %2 = llvm.add %arg0, %1 : i399 "llvm.return"(%2) : (i399) -> () } ] diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthor_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthor_proof.lean index d6862efb0..84c8b8e3e 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthor_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthor_proof.lean @@ -7,7 +7,7 @@ section gapinthor_proof theorem test1_thm (x : BitVec 23) : x ||| 8388607#23 ^^^ x = 8388607#23 := sorry theorem test2_thm (x x_1 : BitVec 39) : - x_1 + (x &&& 274877906944#39) &&& 274877906944#39 ||| x_1 &&& 274877906943#39 = (x &&& 274877906944#39) + x_1 := sorry + x_1 + (x &&& 274877906944#39) &&& 274877906944#39 ||| x_1 &&& 274877906943#39 = x_1 + (x &&& 274877906944#39) := sorry theorem test4_thm (x : BitVec 1023) : x ||| @@ -19,5 +19,5 @@ theorem test5_thm (x x_1 : BitVec 399) : x_1 + (x &&& 18446742974197923840#399) &&& 1291124939043454294827959586001505937164852896414611756415329678270323811008420597314822676640068915717951585711495839744#399 ||| x_1 &&& 274877906943#399 = - (x &&& 18446742974197923840#399) + x_1 := sorry + x_1 + (x &&& 18446742974197923840#399) := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthrem1.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthrem1.lean index f2649a16f..1d2ccc1b2 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthrem1.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthrem1.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gapinthrem1_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -38,7 +38,7 @@ theorem test1_proof : test1_before ⊑ test1_after := by intros try simp ---BEGIN test1 - apply test1_thm + all_goals (try extract_goal ; sorry) ---END test1 @@ -70,7 +70,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthrem1_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthrem1_proof.lean deleted file mode 100644 index 9504a9e2a..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthrem1_proof.lean +++ /dev/null @@ -1,10 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gapinthrem1_proof -theorem test1_thm (x : BitVec 33) : BitVec.ofNat 33 (x.toNat % 4096) = x &&& 4095#33 := sorry - -theorem test2_thm (x : BitVec 49) : BitVec.ofNat 49 (x.toNat % 8388608) = x &&& 8388607#49 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthshift.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthshift.lean index 6ee29ccd8..3fb819a50 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthshift.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthshift.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gapinthshift_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -40,7 +40,7 @@ theorem test6_proof : test6_before ⊑ test6_after := by intros try simp ---BEGIN test6 - apply test6_thm + all_goals (try extract_goal ; sorry) ---END test6 @@ -72,7 +72,7 @@ theorem test6a_proof : test6a_before ⊑ test6a_after := by intros try simp ---BEGIN test6a - apply test6a_thm + all_goals (try extract_goal ; sorry) ---END test6a @@ -103,7 +103,7 @@ theorem test8_proof : test8_before ⊑ test8_after := by intros try simp ---BEGIN test8 - apply test8_thm + all_goals (try extract_goal ; sorry) ---END test8 @@ -134,7 +134,7 @@ theorem test9_proof : test9_before ⊑ test9_after := by intros try simp ---BEGIN test9 - apply test9_thm + all_goals (try extract_goal ; sorry) ---END test9 @@ -499,7 +499,7 @@ def test25_after := [llvm| ^0(%arg2 : i37, %arg3 : i37): %0 = "llvm.mlir.constant"() <{value = -131072 : i37}> : () -> i37 %1 = llvm.and %arg2, %0 : i37 - %2 = llvm.add %1, %arg3 : i37 + %2 = llvm.add %arg3, %1 : i37 %3 = llvm.and %2, %0 : i37 "llvm.return"(%3) : (i37) -> () } diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthshift_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthshift_proof.lean deleted file mode 100644 index 984c0378b..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthshift_proof.lean +++ /dev/null @@ -1,14 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gapinthshift_proof -theorem test6_thm (x : BitVec 55) : x <<< 1 * 3#55 = x * 6#55 := sorry - -theorem test6a_thm (x : BitVec 55) : (x * 3#55) <<< 1 = x * 6#55 := sorry - -theorem test8_thm (x : BitVec 7) : x <<< 7 = 0#7 := sorry - -theorem test9_thm (x : BitVec 17) : x <<< 16 >>> 16 = x &&& 1#17 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthshifthsimplify.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthshifthsimplify.lean index 337610acb..49b3303ce 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthshifthsimplify.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthshifthsimplify.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gapinthshifthsimplify_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -39,7 +39,7 @@ theorem test0_proof : test0_before ⊑ test0_after := by intros try simp ---BEGIN test0 - apply test0_thm + all_goals (try extract_goal ; sorry) ---END test0 @@ -70,7 +70,7 @@ theorem test1_proof : test1_before ⊑ test1_after := by intros try simp ---BEGIN test1 - apply test1_thm + all_goals (try extract_goal ; sorry) ---END test1 @@ -101,7 +101,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthshifthsimplify_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthshifthsimplify_proof.lean deleted file mode 100644 index d10493073..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthshifthsimplify_proof.lean +++ /dev/null @@ -1,21 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gapinthshifthsimplify_proof -theorem test0_thm (x x_1 x_2 : BitVec 41) : - (Option.bind (if 41 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - Option.bind (if 41 ≤ x_1.toNat then none else some (x <<< x_1.toNat)) fun a_1 => some (a &&& a_1)) ⊑ - if 41 ≤ x_1.toNat then none else some ((x_2 &&& x) <<< x_1.toNat) := sorry - -theorem test1_thm (x x_1 x_2 : BitVec 57) : - (Option.bind (if 57 ≤ x_1.toNat then none else some (x_2 >>> x_1.toNat)) fun a => - Option.bind (if 57 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a_1 => some (a ||| a_1)) ⊑ - if 57 ≤ x_1.toNat then none else some ((x_2 ||| x) >>> x_1.toNat) := sorry - -theorem test2_thm (x x_1 x_2 : BitVec 49) : - (Option.bind (if 49 ≤ x_1.toNat then none else some (x_2.sshiftRight x_1.toNat)) fun a => - Option.bind (if 49 ≤ x_1.toNat then none else some (x.sshiftRight x_1.toNat)) fun a_1 => some (a ^^^ a_1)) ⊑ - if 49 ≤ x_1.toNat then none else some ((x_2 ^^^ x).sshiftRight x_1.toNat) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthsub.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthsub.lean index 1d295a9b9..6de4ea1da 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthsub.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthsub.lean @@ -171,7 +171,7 @@ def test6_after := [llvm| ^0(%arg17 : i57, %arg18 : i57): %0 = "llvm.mlir.constant"() <{value = -1 : i57}> : () -> i57 %1 = llvm.xor %arg18, %0 : i57 - %2 = llvm.and %1, %arg17 : i57 + %2 = llvm.and %arg17, %1 : i57 "llvm.return"(%2) : (i57) -> () } ] diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthsub_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthsub_proof.lean index 62b142ca4..b43b5c054 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthsub_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthsub_proof.lean @@ -6,7 +6,7 @@ open BitVec section gapinthsub_proof theorem test5_thm (x x_1 x_2 : BitVec 19) : x_2 - (x_1 - x) = x - x_1 + x_2 := sorry -theorem test6_thm (x x_1 : BitVec 57) : x_1 - (x_1 &&& x) = (x ^^^ 144115188075855871#57) &&& x_1 := sorry +theorem test6_thm (x x_1 : BitVec 57) : x_1 - (x_1 &&& x) = x_1 &&& (x ^^^ 144115188075855871#57) := sorry theorem test7_thm (x : BitVec 77) : 151115727451828646838271#77 - x = x ^^^ 151115727451828646838271#77 := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthxor1.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthxor1.lean index 6b660e4ac..3c49e20c5 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthxor1.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthxor1.lean @@ -72,7 +72,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 @@ -100,7 +100,7 @@ theorem test3_proof : test3_before ⊑ test3_after := by intros try simp ---BEGIN test3 - apply test3_thm + all_goals (try extract_goal ; sorry) ---END test3 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthxor1_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthxor1_proof.lean index 94b04942e..9a4cd415f 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthxor1_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthxor1_proof.lean @@ -7,10 +7,6 @@ section gapinthxor1_proof theorem test1_thm (x x_1 : BitVec 47) : x_1 &&& 70368744177664#47 ^^^ x &&& 70368744177661#47 = x_1 &&& 70368744177664#47 ||| x &&& 70368744177661#47 := sorry -theorem test2_thm (x : BitVec 15) : x ^^^ 0#15 = x := sorry - -theorem test3_thm (x : BitVec 23) : x ^^^ x = 0#23 := sorry - theorem test4_thm (x : BitVec 37) : x ^^^ (137438953471#37 ^^^ x) = 137438953471#37 := sorry theorem test5_thm (x : BitVec 7) : (x ||| 23#7) ^^^ 23#7 = x &&& 104#7 := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthxor2.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthxor2.lean index a7a7a5118..69f8557db 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthxor2.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gapinthxor2.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gapinthxor2_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -44,7 +44,7 @@ theorem test1_proof : test1_before ⊑ test1_after := by intros try simp ---BEGIN test1 - apply test1_thm + all_goals (try extract_goal ; sorry) ---END test1 @@ -72,7 +72,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 @@ -100,7 +100,7 @@ theorem test3_proof : test3_before ⊑ test3_after := by intros try simp ---BEGIN test3 - apply test3_thm + all_goals (try extract_goal ; sorry) ---END test3 @@ -130,7 +130,7 @@ theorem test4_proof : test4_before ⊑ test4_after := by intros try simp ---BEGIN test4 - apply test4_thm + all_goals (try extract_goal ; sorry) ---END test4 @@ -161,7 +161,7 @@ theorem test5_proof : test5_before ⊑ test5_after := by intros try simp ---BEGIN test5 - apply test5_thm + all_goals (try extract_goal ; sorry) ---END test5 @@ -190,7 +190,7 @@ theorem test6_proof : test6_before ⊑ test6_after := by intros try simp ---BEGIN test6 - apply test6_thm + all_goals (try extract_goal ; sorry) ---END test6 @@ -224,7 +224,7 @@ theorem test7_proof : test7_before ⊑ test7_after := by intros try simp ---BEGIN test7 - apply test7_thm + all_goals (try extract_goal ; sorry) ---END test7 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gapinthxor2_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gapinthxor2_proof.lean deleted file mode 100644 index acc423356..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gapinthxor2_proof.lean +++ /dev/null @@ -1,33 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gapinthxor2_proof -theorem test1_thm (x x_1 : BitVec 447) : - x_1 &&& 70368744177664#447 ^^^ x &&& 70368744177663#447 = - x_1 &&& 70368744177664#447 ||| x &&& 70368744177663#447 := sorry - -theorem test2_thm (x : BitVec 1005) : x ^^^ 0#1005 = x := sorry - -theorem test3_thm (x : BitVec 123) : x ^^^ x = 0#123 := sorry - -theorem test4_thm (x : BitVec 737) : - x ^^^ - (722947573429303679218971863604384733017946601434003846318950894300849620572466815975903723774778879224549853567560703123999563997664868082592397590652658203246283799419575326866593810558132103097281884026581639773628137471#737 ^^^ - x) = - 722947573429303679218971863604384733017946601434003846318950894300849620572466815975903723774778879224549853567560703123999563997664868082592397590652658203246283799419575326866593810558132103097281884026581639773628137471#737 := sorry - -theorem test5_thm (x : BitVec 700) : - (x ||| 288230376151711743#700) ^^^ 288230376151711743#700 = - x &&& - 5260135901548373507240989882880128665550339802823173859498280903068732154297080822113666536277588451226982968856178217713019432250183803863127814770651880849955223671128444598191663757884322716983062875584069632#700 := sorry - -theorem test6_thm (x : BitVec 77) : x ^^^ 23#77 ^^^ 23#77 = x := sorry - -theorem test7_thm (x : BitVec 1023) : - (x ||| 70368744177663#1023) ^^^ 703687463#1023 = - x &&& - 89884656743115795386465259539451236680898848947115328636715040578866337902750481566354238661203768010560056939935696678829394884407208311246423715319737062188883946712432742638151109800623047059726541476042502884419075341171231440736956555270413618581675255342293149119973622969239858152417678094443367890944#1023 ||| - 70368040490200#1023 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gashrhlshr.lean b/SSA/Projects/InstCombine/tests/LLVM/gashrhlshr.lean index 3fcd8a063..ecde0075c 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gashrhlshr.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gashrhlshr.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gashrhlshr_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -15,19 +15,19 @@ section gashrhlshr_statements def ashr_known_pos_exact_before := [llvm| { -^0(%arg23 : i8, %arg24 : i8): +^0(%arg35 : i8, %arg36 : i8): %0 = "llvm.mlir.constant"() <{value = 127 : i8}> : () -> i8 - %1 = llvm.and %arg23, %0 : i8 - %2 = llvm.ashr %1, %arg24 : i8 + %1 = llvm.and %arg35, %0 : i8 + %2 = llvm.ashr %1, %arg36 : i8 "llvm.return"(%2) : (i8) -> () } ] def ashr_known_pos_exact_after := [llvm| { -^0(%arg23 : i8, %arg24 : i8): +^0(%arg35 : i8, %arg36 : i8): %0 = "llvm.mlir.constant"() <{value = 127 : i8}> : () -> i8 - %1 = llvm.and %arg23, %0 : i8 - %2 = llvm.lshr %1, %arg24 : i8 + %1 = llvm.and %arg35, %0 : i8 + %2 = llvm.lshr %1, %arg36 : i8 "llvm.return"(%2) : (i8) -> () } ] @@ -40,27 +40,27 @@ theorem ashr_known_pos_exact_proof : ashr_known_pos_exact_before ⊑ ashr_known_ intros try simp ---BEGIN ashr_known_pos_exact - apply ashr_known_pos_exact_thm + all_goals (try extract_goal ; sorry) ---END ashr_known_pos_exact def lshr_mul_times_3_div_2_before := [llvm| { -^0(%arg20 : i32): +^0(%arg32 : i32): %0 = "llvm.mlir.constant"() <{value = 3 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %2 = llvm.mul %arg20, %0 : i32 + %2 = llvm.mul %arg32, %0 : i32 %3 = llvm.lshr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def lshr_mul_times_3_div_2_after := [llvm| { -^0(%arg20 : i32): +^0(%arg32 : i32): %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %1 = llvm.lshr %arg20, %0 : i32 - %2 = llvm.add %1, %arg20 : i32 + %1 = llvm.lshr %arg32, %0 : i32 + %2 = llvm.add %arg32, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -73,27 +73,27 @@ theorem lshr_mul_times_3_div_2_proof : lshr_mul_times_3_div_2_before ⊑ lshr_mu intros try simp ---BEGIN lshr_mul_times_3_div_2 - apply lshr_mul_times_3_div_2_thm + all_goals (try extract_goal ; sorry) ---END lshr_mul_times_3_div_2 def lshr_mul_times_3_div_2_exact_before := [llvm| { -^0(%arg19 : i32): +^0(%arg31 : i32): %0 = "llvm.mlir.constant"() <{value = 3 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %2 = llvm.mul %arg19, %0 : i32 + %2 = llvm.mul %arg31, %0 : i32 %3 = llvm.lshr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def lshr_mul_times_3_div_2_exact_after := [llvm| { -^0(%arg19 : i32): +^0(%arg31 : i32): %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %1 = llvm.lshr %arg19, %0 : i32 - %2 = llvm.add %1, %arg19 : i32 + %1 = llvm.lshr %arg31, %0 : i32 + %2 = llvm.add %arg31, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -106,27 +106,27 @@ theorem lshr_mul_times_3_div_2_exact_proof : lshr_mul_times_3_div_2_exact_before intros try simp ---BEGIN lshr_mul_times_3_div_2_exact - apply lshr_mul_times_3_div_2_exact_thm + all_goals (try extract_goal ; sorry) ---END lshr_mul_times_3_div_2_exact def lshr_mul_times_3_div_2_exact_2_before := [llvm| { -^0(%arg16 : i32): +^0(%arg28 : i32): %0 = "llvm.mlir.constant"() <{value = 3 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %2 = llvm.mul %arg16, %0 : i32 + %2 = llvm.mul %arg28, %0 : i32 %3 = llvm.lshr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def lshr_mul_times_3_div_2_exact_2_after := [llvm| { -^0(%arg16 : i32): +^0(%arg28 : i32): %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %1 = llvm.lshr %arg16, %0 : i32 - %2 = llvm.add %1, %arg16 : i32 + %1 = llvm.lshr %arg28, %0 : i32 + %2 = llvm.add %arg28, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -139,27 +139,27 @@ theorem lshr_mul_times_3_div_2_exact_2_proof : lshr_mul_times_3_div_2_exact_2_be intros try simp ---BEGIN lshr_mul_times_3_div_2_exact_2 - apply lshr_mul_times_3_div_2_exact_2_thm + all_goals (try extract_goal ; sorry) ---END lshr_mul_times_3_div_2_exact_2 def lshr_mul_times_5_div_4_before := [llvm| { -^0(%arg15 : i32): +^0(%arg27 : i32): %0 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %2 = llvm.mul %arg15, %0 : i32 + %2 = llvm.mul %arg27, %0 : i32 %3 = llvm.lshr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def lshr_mul_times_5_div_4_after := [llvm| { -^0(%arg15 : i32): +^0(%arg27 : i32): %0 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %1 = llvm.lshr %arg15, %0 : i32 - %2 = llvm.add %1, %arg15 : i32 + %1 = llvm.lshr %arg27, %0 : i32 + %2 = llvm.add %arg27, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -172,27 +172,27 @@ theorem lshr_mul_times_5_div_4_proof : lshr_mul_times_5_div_4_before ⊑ lshr_mu intros try simp ---BEGIN lshr_mul_times_5_div_4 - apply lshr_mul_times_5_div_4_thm + all_goals (try extract_goal ; sorry) ---END lshr_mul_times_5_div_4 def lshr_mul_times_5_div_4_exact_before := [llvm| { -^0(%arg14 : i32): +^0(%arg26 : i32): %0 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %2 = llvm.mul %arg14, %0 : i32 + %2 = llvm.mul %arg26, %0 : i32 %3 = llvm.lshr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def lshr_mul_times_5_div_4_exact_after := [llvm| { -^0(%arg14 : i32): +^0(%arg26 : i32): %0 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %1 = llvm.lshr %arg14, %0 : i32 - %2 = llvm.add %1, %arg14 : i32 + %1 = llvm.lshr %arg26, %0 : i32 + %2 = llvm.add %arg26, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -205,27 +205,27 @@ theorem lshr_mul_times_5_div_4_exact_proof : lshr_mul_times_5_div_4_exact_before intros try simp ---BEGIN lshr_mul_times_5_div_4_exact - apply lshr_mul_times_5_div_4_exact_thm + all_goals (try extract_goal ; sorry) ---END lshr_mul_times_5_div_4_exact def lshr_mul_times_5_div_4_exact_2_before := [llvm| { -^0(%arg11 : i32): +^0(%arg23 : i32): %0 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %2 = llvm.mul %arg11, %0 : i32 + %2 = llvm.mul %arg23, %0 : i32 %3 = llvm.lshr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def lshr_mul_times_5_div_4_exact_2_after := [llvm| { -^0(%arg11 : i32): +^0(%arg23 : i32): %0 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %1 = llvm.lshr %arg11, %0 : i32 - %2 = llvm.add %1, %arg11 : i32 + %1 = llvm.lshr %arg23, %0 : i32 + %2 = llvm.add %arg23, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -238,27 +238,27 @@ theorem lshr_mul_times_5_div_4_exact_2_proof : lshr_mul_times_5_div_4_exact_2_be intros try simp ---BEGIN lshr_mul_times_5_div_4_exact_2 - apply lshr_mul_times_5_div_4_exact_2_thm + all_goals (try extract_goal ; sorry) ---END lshr_mul_times_5_div_4_exact_2 def ashr_mul_times_3_div_2_before := [llvm| { -^0(%arg10 : i32): +^0(%arg22 : i32): %0 = "llvm.mlir.constant"() <{value = 3 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %2 = llvm.mul %arg10, %0 : i32 + %2 = llvm.mul %arg22, %0 : i32 %3 = llvm.ashr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def ashr_mul_times_3_div_2_after := [llvm| { -^0(%arg10 : i32): +^0(%arg22 : i32): %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %1 = llvm.ashr %arg10, %0 : i32 - %2 = llvm.add %1, %arg10 : i32 + %1 = llvm.lshr %arg22, %0 : i32 + %2 = llvm.add %arg22, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -271,27 +271,27 @@ theorem ashr_mul_times_3_div_2_proof : ashr_mul_times_3_div_2_before ⊑ ashr_mu intros try simp ---BEGIN ashr_mul_times_3_div_2 - apply ashr_mul_times_3_div_2_thm + all_goals (try extract_goal ; sorry) ---END ashr_mul_times_3_div_2 def ashr_mul_times_3_div_2_exact_before := [llvm| { -^0(%arg9 : i32): +^0(%arg21 : i32): %0 = "llvm.mlir.constant"() <{value = 3 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %2 = llvm.mul %arg9, %0 : i32 + %2 = llvm.mul %arg21, %0 : i32 %3 = llvm.ashr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def ashr_mul_times_3_div_2_exact_after := [llvm| { -^0(%arg9 : i32): +^0(%arg21 : i32): %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %1 = llvm.ashr %arg9, %0 : i32 - %2 = llvm.add %1, %arg9 : i32 + %1 = llvm.ashr %arg21, %0 : i32 + %2 = llvm.add %arg21, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -304,27 +304,27 @@ theorem ashr_mul_times_3_div_2_exact_proof : ashr_mul_times_3_div_2_exact_before intros try simp ---BEGIN ashr_mul_times_3_div_2_exact - apply ashr_mul_times_3_div_2_exact_thm + all_goals (try extract_goal ; sorry) ---END ashr_mul_times_3_div_2_exact def ashr_mul_times_3_div_2_exact_2_before := [llvm| { -^0(%arg5 : i32): +^0(%arg17 : i32): %0 = "llvm.mlir.constant"() <{value = 3 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %2 = llvm.mul %arg5, %0 : i32 + %2 = llvm.mul %arg17, %0 : i32 %3 = llvm.ashr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def ashr_mul_times_3_div_2_exact_2_after := [llvm| { -^0(%arg5 : i32): +^0(%arg17 : i32): %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %1 = llvm.ashr %arg5, %0 : i32 - %2 = llvm.add %1, %arg5 : i32 + %1 = llvm.ashr %arg17, %0 : i32 + %2 = llvm.add %arg17, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -337,27 +337,27 @@ theorem ashr_mul_times_3_div_2_exact_2_proof : ashr_mul_times_3_div_2_exact_2_be intros try simp ---BEGIN ashr_mul_times_3_div_2_exact_2 - apply ashr_mul_times_3_div_2_exact_2_thm + all_goals (try extract_goal ; sorry) ---END ashr_mul_times_3_div_2_exact_2 def ashr_mul_times_5_div_4_before := [llvm| { -^0(%arg4 : i32): +^0(%arg16 : i32): %0 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %2 = llvm.mul %arg4, %0 : i32 + %2 = llvm.mul %arg16, %0 : i32 %3 = llvm.ashr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def ashr_mul_times_5_div_4_after := [llvm| { -^0(%arg4 : i32): +^0(%arg16 : i32): %0 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %1 = llvm.ashr %arg4, %0 : i32 - %2 = llvm.add %1, %arg4 : i32 + %1 = llvm.lshr %arg16, %0 : i32 + %2 = llvm.add %arg16, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -370,27 +370,27 @@ theorem ashr_mul_times_5_div_4_proof : ashr_mul_times_5_div_4_before ⊑ ashr_mu intros try simp ---BEGIN ashr_mul_times_5_div_4 - apply ashr_mul_times_5_div_4_thm + all_goals (try extract_goal ; sorry) ---END ashr_mul_times_5_div_4 def ashr_mul_times_5_div_4_exact_before := [llvm| { -^0(%arg3 : i32): +^0(%arg15 : i32): %0 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %2 = llvm.mul %arg3, %0 : i32 + %2 = llvm.mul %arg15, %0 : i32 %3 = llvm.ashr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def ashr_mul_times_5_div_4_exact_after := [llvm| { -^0(%arg3 : i32): +^0(%arg15 : i32): %0 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %1 = llvm.ashr %arg3, %0 : i32 - %2 = llvm.add %1, %arg3 : i32 + %1 = llvm.ashr %arg15, %0 : i32 + %2 = llvm.add %arg15, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -403,27 +403,27 @@ theorem ashr_mul_times_5_div_4_exact_proof : ashr_mul_times_5_div_4_exact_before intros try simp ---BEGIN ashr_mul_times_5_div_4_exact - apply ashr_mul_times_5_div_4_exact_thm + all_goals (try extract_goal ; sorry) ---END ashr_mul_times_5_div_4_exact def ashr_mul_times_5_div_4_exact_2_before := [llvm| { -^0(%arg0 : i32): +^0(%arg12 : i32): %0 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %2 = llvm.mul %arg0, %0 : i32 + %2 = llvm.mul %arg12, %0 : i32 %3 = llvm.ashr %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def ashr_mul_times_5_div_4_exact_2_after := [llvm| { -^0(%arg0 : i32): +^0(%arg12 : i32): %0 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %1 = llvm.ashr %arg0, %0 : i32 - %2 = llvm.add %1, %arg0 : i32 + %1 = llvm.ashr %arg12, %0 : i32 + %2 = llvm.add %arg12, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -436,7 +436,83 @@ theorem ashr_mul_times_5_div_4_exact_2_proof : ashr_mul_times_5_div_4_exact_2_be intros try simp ---BEGIN ashr_mul_times_5_div_4_exact_2 - apply ashr_mul_times_5_div_4_exact_2_thm + all_goals (try extract_goal ; sorry) ---END ashr_mul_times_5_div_4_exact_2 + +def lsb_mask_sign_zext_wrong_cst2_before := [llvm| +{ +^0(%arg8 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 + %2 = "llvm.mlir.constant"() <{value = 31 : i32}> : () -> i32 + %3 = llvm.add %arg8, %0 : i32 + %4 = llvm.xor %arg8, %1 : i32 + %5 = llvm.and %3, %4 : i32 + %6 = llvm.lshr %5, %2 : i32 + "llvm.return"(%6) : (i32) -> () +} +] +def lsb_mask_sign_zext_wrong_cst2_after := [llvm| +{ +^0(%arg8 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = "llvm.mlir.constant"() <{value = 31 : i32}> : () -> i32 + %2 = llvm.add %arg8, %0 : i32 + %3 = llvm.and %2, %arg8 : i32 + %4 = llvm.lshr %3, %1 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem lsb_mask_sign_zext_wrong_cst2_proof : lsb_mask_sign_zext_wrong_cst2_before ⊑ lsb_mask_sign_zext_wrong_cst2_after := by + unfold lsb_mask_sign_zext_wrong_cst2_before lsb_mask_sign_zext_wrong_cst2_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN lsb_mask_sign_zext_wrong_cst2 + all_goals (try extract_goal ; sorry) + ---END lsb_mask_sign_zext_wrong_cst2 + + + +def lsb_mask_sign_sext_wrong_cst2_before := [llvm| +{ +^0(%arg2 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 + %2 = "llvm.mlir.constant"() <{value = 31 : i32}> : () -> i32 + %3 = llvm.add %arg2, %0 : i32 + %4 = llvm.xor %arg2, %1 : i32 + %5 = llvm.and %3, %4 : i32 + %6 = llvm.ashr %5, %2 : i32 + "llvm.return"(%6) : (i32) -> () +} +] +def lsb_mask_sign_sext_wrong_cst2_after := [llvm| +{ +^0(%arg2 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = "llvm.mlir.constant"() <{value = 31 : i32}> : () -> i32 + %2 = llvm.add %arg2, %0 : i32 + %3 = llvm.and %2, %arg2 : i32 + %4 = llvm.ashr %3, %1 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem lsb_mask_sign_sext_wrong_cst2_proof : lsb_mask_sign_sext_wrong_cst2_before ⊑ lsb_mask_sign_sext_wrong_cst2_after := by + unfold lsb_mask_sign_sext_wrong_cst2_before lsb_mask_sign_sext_wrong_cst2_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN lsb_mask_sign_sext_wrong_cst2 + all_goals (try extract_goal ; sorry) + ---END lsb_mask_sign_sext_wrong_cst2 + + diff --git a/SSA/Projects/InstCombine/tests/LLVM/gashrhlshr_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gashrhlshr_proof.lean deleted file mode 100644 index b2987b5f4..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gashrhlshr_proof.lean +++ /dev/null @@ -1,34 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gashrhlshr_proof -theorem ashr_known_pos_exact_thm (x x_1 : BitVec 8) : - (if 8 ≤ x.toNat then none else some ((x_1 &&& 127#8).sshiftRight x.toNat)) ⊑ - if 8 ≤ x.toNat then none else some ((x_1 &&& 127#8) >>> x.toNat) := sorry - -theorem lshr_mul_times_3_div_2_thm (x : BitVec 32) : (x * 3#32) >>> 1 = x >>> 1 + x := sorry - -theorem lshr_mul_times_3_div_2_exact_thm (x : BitVec 32) : (x * 3#32) >>> 1 = x >>> 1 + x := sorry - -theorem lshr_mul_times_3_div_2_exact_2_thm (x : BitVec 32) : (x * 3#32) >>> 1 = x >>> 1 + x := sorry - -theorem lshr_mul_times_5_div_4_thm (x : BitVec 32) : (x * 5#32) >>> 2 = x >>> 2 + x := sorry - -theorem lshr_mul_times_5_div_4_exact_thm (x : BitVec 32) : (x * 5#32) >>> 2 = x >>> 2 + x := sorry - -theorem lshr_mul_times_5_div_4_exact_2_thm (x : BitVec 32) : (x * 5#32) >>> 2 = x >>> 2 + x := sorry - -theorem ashr_mul_times_3_div_2_thm (x : BitVec 32) : (x * 3#32).sshiftRight 1 = x.sshiftRight 1 + x := sorry - -theorem ashr_mul_times_3_div_2_exact_thm (x : BitVec 32) : (x * 3#32).sshiftRight 1 = x.sshiftRight 1 + x := sorry - -theorem ashr_mul_times_3_div_2_exact_2_thm (x : BitVec 32) : (x * 3#32).sshiftRight 1 = x.sshiftRight 1 + x := sorry - -theorem ashr_mul_times_5_div_4_thm (x : BitVec 32) : (x * 5#32).sshiftRight 2 = x.sshiftRight 2 + x := sorry - -theorem ashr_mul_times_5_div_4_exact_thm (x : BitVec 32) : (x * 5#32).sshiftRight 2 = x.sshiftRight 2 + x := sorry - -theorem ashr_mul_times_5_div_4_exact_2_thm (x : BitVec 32) : (x * 5#32).sshiftRight 2 = x.sshiftRight 2 + x := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gavghlsb.lean b/SSA/Projects/InstCombine/tests/LLVM/gavghlsb.lean index d2ccaea5f..fa3b0597f 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gavghlsb.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gavghlsb.lean @@ -29,7 +29,7 @@ def avg_lsb_after := [llvm| ^0(%arg4 : i8, %arg5 : i8): %0 = "llvm.mlir.constant"() <{value = 1 : i8}> : () -> i8 %1 = llvm.and %arg4, %0 : i8 - %2 = llvm.and %1, %arg5 : i8 + %2 = llvm.and %arg5, %1 : i8 "llvm.return"(%2) : (i8) -> () } ] diff --git a/SSA/Projects/InstCombine/tests/LLVM/gavghlsb_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gavghlsb_proof.lean index 488c6ce85..0f80edb35 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gavghlsb_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gavghlsb_proof.lean @@ -4,5 +4,5 @@ import SSA.Projects.InstCombine.LLVM.Semantics open BitVec section gavghlsb_proof -theorem avg_lsb_thm (x x_1 : BitVec 8) : ((x_1 &&& 1#8) + (x &&& 1#8)) >>> 1 = x &&& 1#8 &&& x_1 := sorry +theorem avg_lsb_thm (x x_1 : BitVec 8) : ((x_1 &&& 1#8) + (x &&& 1#8)) >>> 1 = x_1 &&& (x &&& 1#8) := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gbinophandhshifts.lean b/SSA/Projects/InstCombine/tests/LLVM/gbinophandhshifts.lean index af70613a9..5a3ccba6f 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gbinophandhshifts.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gbinophandhshifts.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gbinophandhshifts_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -45,7 +45,7 @@ theorem shl_and_and_proof : shl_and_and_before ⊑ shl_and_and_after := by intros try simp ---BEGIN shl_and_and - apply shl_and_and_thm + all_goals (try extract_goal ; sorry) ---END shl_and_and @@ -85,7 +85,7 @@ theorem shl_and_and_fail_proof : shl_and_and_fail_before ⊑ shl_and_and_fail_af intros try simp ---BEGIN shl_and_and_fail - apply shl_and_and_fail_thm + all_goals (try extract_goal ; sorry) ---END shl_and_and_fail @@ -122,7 +122,7 @@ theorem shl_add_add_proof : shl_add_add_before ⊑ shl_add_add_after := by intros try simp ---BEGIN shl_add_add - apply shl_add_add_thm + all_goals (try extract_goal ; sorry) ---END shl_add_add @@ -145,7 +145,7 @@ def shl_and_xor_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 10 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 1 : i8}> : () -> i8 %2 = llvm.and %arg158, %0 : i8 - %3 = llvm.xor %2, %arg159 : i8 + %3 = llvm.xor %arg159, %2 : i8 %4 = llvm.shl %3, %1 : i8 "llvm.return"(%4) : (i8) -> () } @@ -159,7 +159,7 @@ theorem shl_and_xor_proof : shl_and_xor_before ⊑ shl_and_xor_after := by intros try simp ---BEGIN shl_and_xor - apply shl_and_xor_thm + all_goals (try extract_goal ; sorry) ---END shl_and_xor @@ -182,7 +182,7 @@ def shl_and_add_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 59 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 1 : i8}> : () -> i8 %2 = llvm.and %arg157, %0 : i8 - %3 = llvm.add %2, %arg156 : i8 + %3 = llvm.add %arg156, %2 : i8 %4 = llvm.shl %3, %1 : i8 "llvm.return"(%4) : (i8) -> () } @@ -196,7 +196,7 @@ theorem shl_and_add_proof : shl_and_add_before ⊑ shl_and_add_after := by intros try simp ---BEGIN shl_and_add - apply shl_and_add_thm + all_goals (try extract_goal ; sorry) ---END shl_and_add @@ -219,7 +219,7 @@ def lshr_or_and_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -64 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 5 : i8}> : () -> i8 %2 = llvm.or %arg152, %0 : i8 - %3 = llvm.and %2, %arg153 : i8 + %3 = llvm.and %arg153, %2 : i8 %4 = llvm.lshr %3, %1 : i8 "llvm.return"(%4) : (i8) -> () } @@ -233,7 +233,7 @@ theorem lshr_or_and_proof : lshr_or_and_before ⊑ lshr_or_and_after := by intros try simp ---BEGIN lshr_or_and - apply lshr_or_and_thm + all_goals (try extract_goal ; sorry) ---END lshr_or_and @@ -270,7 +270,7 @@ theorem lshr_or_or_fail_proof : lshr_or_or_fail_before ⊑ lshr_or_or_fail_after intros try simp ---BEGIN lshr_or_or_fail - apply lshr_or_or_fail_thm + all_goals (try extract_goal ; sorry) ---END lshr_or_or_fail @@ -303,7 +303,7 @@ theorem lshr_or_or_no_const_proof : lshr_or_or_no_const_before ⊑ lshr_or_or_no intros try simp ---BEGIN lshr_or_or_no_const - apply lshr_or_or_no_const_thm + all_goals (try extract_goal ; sorry) ---END lshr_or_or_no_const @@ -336,7 +336,7 @@ theorem shl_xor_xor_no_const_proof : shl_xor_xor_no_const_before ⊑ shl_xor_xor intros try simp ---BEGIN shl_xor_xor_no_const - apply shl_xor_xor_no_const_thm + all_goals (try extract_goal ; sorry) ---END shl_xor_xor_no_const @@ -369,7 +369,7 @@ theorem shl_add_add_no_const_proof : shl_add_add_no_const_before ⊑ shl_add_add intros try simp ---BEGIN shl_add_add_no_const - apply shl_add_add_no_const_thm + all_goals (try extract_goal ; sorry) ---END shl_add_add_no_const @@ -406,7 +406,7 @@ theorem lshr_xor_or_good_mask_proof : lshr_xor_or_good_mask_before ⊑ lshr_xor_ intros try simp ---BEGIN lshr_xor_or_good_mask - apply lshr_xor_or_good_mask_thm + all_goals (try extract_goal ; sorry) ---END lshr_xor_or_good_mask @@ -443,7 +443,7 @@ theorem shl_xor_xor_good_mask_proof : shl_xor_xor_good_mask_before ⊑ shl_xor_x intros try simp ---BEGIN shl_xor_xor_good_mask - apply shl_xor_xor_good_mask_thm + all_goals (try extract_goal ; sorry) ---END shl_xor_xor_good_mask @@ -480,7 +480,7 @@ theorem shl_xor_xor_bad_mask_distribute_proof : shl_xor_xor_bad_mask_distribute_ intros try simp ---BEGIN shl_xor_xor_bad_mask_distribute - apply shl_xor_xor_bad_mask_distribute_thm + all_goals (try extract_goal ; sorry) ---END shl_xor_xor_bad_mask_distribute @@ -503,7 +503,7 @@ def shl_add_and_after := [llvm| %0 = "llvm.mlir.constant"() <{value = 61 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 1 : i8}> : () -> i8 %2 = llvm.add %arg97, %0 : i8 - %3 = llvm.and %2, %arg96 : i8 + %3 = llvm.and %arg96, %2 : i8 %4 = llvm.shl %3, %1 : i8 "llvm.return"(%4) : (i8) -> () } @@ -517,7 +517,7 @@ theorem shl_add_and_proof : shl_add_and_before ⊑ shl_add_and_after := by intros try simp ---BEGIN shl_add_and - apply shl_add_and_thm + all_goals (try extract_goal ; sorry) ---END shl_add_and @@ -538,7 +538,7 @@ def and_ashr_not_after := [llvm| ^0(%arg81 : i8, %arg82 : i8, %arg83 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg82, %0 : i8 - %2 = llvm.and %1, %arg81 : i8 + %2 = llvm.and %arg81, %1 : i8 %3 = llvm.ashr %2, %arg83 : i8 "llvm.return"(%3) : (i8) -> () } @@ -552,7 +552,7 @@ theorem and_ashr_not_proof : and_ashr_not_before ⊑ and_ashr_not_after := by intros try simp ---BEGIN and_ashr_not - apply and_ashr_not_thm + all_goals (try extract_goal ; sorry) ---END and_ashr_not @@ -573,7 +573,7 @@ def and_ashr_not_commuted_after := [llvm| ^0(%arg78 : i8, %arg79 : i8, %arg80 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg79, %0 : i8 - %2 = llvm.and %1, %arg78 : i8 + %2 = llvm.and %arg78, %1 : i8 %3 = llvm.ashr %2, %arg80 : i8 "llvm.return"(%3) : (i8) -> () } @@ -587,7 +587,7 @@ theorem and_ashr_not_commuted_proof : and_ashr_not_commuted_before ⊑ and_ashr_ intros try simp ---BEGIN and_ashr_not_commuted - apply and_ashr_not_commuted_thm + all_goals (try extract_goal ; sorry) ---END and_ashr_not_commuted @@ -608,7 +608,7 @@ def or_ashr_not_after := [llvm| ^0(%arg54 : i8, %arg55 : i8, %arg56 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg55, %0 : i8 - %2 = llvm.or %1, %arg54 : i8 + %2 = llvm.or %arg54, %1 : i8 %3 = llvm.ashr %2, %arg56 : i8 "llvm.return"(%3) : (i8) -> () } @@ -622,7 +622,7 @@ theorem or_ashr_not_proof : or_ashr_not_before ⊑ or_ashr_not_after := by intros try simp ---BEGIN or_ashr_not - apply or_ashr_not_thm + all_goals (try extract_goal ; sorry) ---END or_ashr_not @@ -643,7 +643,7 @@ def or_ashr_not_commuted_after := [llvm| ^0(%arg51 : i8, %arg52 : i8, %arg53 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg52, %0 : i8 - %2 = llvm.or %1, %arg51 : i8 + %2 = llvm.or %arg51, %1 : i8 %3 = llvm.ashr %2, %arg53 : i8 "llvm.return"(%3) : (i8) -> () } @@ -657,7 +657,7 @@ theorem or_ashr_not_commuted_proof : or_ashr_not_commuted_before ⊑ or_ashr_not intros try simp ---BEGIN or_ashr_not_commuted - apply or_ashr_not_commuted_thm + all_goals (try extract_goal ; sorry) ---END or_ashr_not_commuted @@ -692,7 +692,7 @@ theorem xor_ashr_not_proof : xor_ashr_not_before ⊑ xor_ashr_not_after := by intros try simp ---BEGIN xor_ashr_not - apply xor_ashr_not_thm + all_goals (try extract_goal ; sorry) ---END xor_ashr_not @@ -727,7 +727,7 @@ theorem xor_ashr_not_commuted_proof : xor_ashr_not_commuted_before ⊑ xor_ashr_ intros try simp ---BEGIN xor_ashr_not_commuted - apply xor_ashr_not_commuted_thm + all_goals (try extract_goal ; sorry) ---END xor_ashr_not_commuted @@ -763,7 +763,7 @@ theorem xor_ashr_not_fail_lshr_ashr_proof : xor_ashr_not_fail_lshr_ashr_before intros try simp ---BEGIN xor_ashr_not_fail_lshr_ashr - apply xor_ashr_not_fail_lshr_ashr_thm + all_goals (try extract_goal ; sorry) ---END xor_ashr_not_fail_lshr_ashr @@ -799,7 +799,7 @@ theorem xor_ashr_not_fail_ashr_lshr_proof : xor_ashr_not_fail_ashr_lshr_before intros try simp ---BEGIN xor_ashr_not_fail_ashr_lshr - apply xor_ashr_not_fail_ashr_lshr_thm + all_goals (try extract_goal ; sorry) ---END xor_ashr_not_fail_ashr_lshr @@ -834,7 +834,7 @@ theorem xor_ashr_not_fail_invalid_xor_constant_proof : xor_ashr_not_fail_invalid intros try simp ---BEGIN xor_ashr_not_fail_invalid_xor_constant - apply xor_ashr_not_fail_invalid_xor_constant_thm + all_goals (try extract_goal ; sorry) ---END xor_ashr_not_fail_invalid_xor_constant diff --git a/SSA/Projects/InstCombine/tests/LLVM/gbinophandhshifts_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gbinophandhshifts_proof.lean deleted file mode 100644 index 4dd6eca7f..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gbinophandhshifts_proof.lean +++ /dev/null @@ -1,103 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gbinophandhshifts_proof -theorem shl_and_and_thm (x x_1 : BitVec 8) : x_1 <<< 4 &&& (x <<< 4 &&& 88#8) = (x &&& x_1) <<< 4 &&& 80#8 := sorry - -theorem shl_and_and_fail_thm (x x_1 : BitVec 8) : x_1 <<< 4 &&& (x <<< 5 &&& 88#8) = x_1 <<< 4 &&& (x <<< 5 &&& 64#8) := sorry - -theorem shl_add_add_thm (x x_1 : BitVec 8) : x_1 <<< 2 + (x <<< 2 + 48#8) = (x + x_1) <<< 2 + 48#8 := sorry - -theorem shl_and_xor_thm (x x_1 : BitVec 8) : x_1 <<< 1 ^^^ x <<< 1 &&& 20#8 = (x &&& 10#8 ^^^ x_1) <<< 1 := sorry - -theorem shl_and_add_thm (x x_1 : BitVec 8) : x_1 <<< 1 + (x <<< 1 &&& 119#8) = ((x &&& 59#8) + x_1) <<< 1 := sorry - -theorem lshr_or_and_thm (x x_1 : BitVec 8) : (x_1 >>> 5 ||| 198#8) &&& x >>> 5 = ((x_1 ||| 192#8) &&& x) >>> 5 := sorry - -theorem lshr_or_or_fail_thm (x x_1 : BitVec 8) : x_1 >>> 5 ||| (x >>> 5 ||| 198#8) = (x ||| x_1) >>> 5 ||| 198#8 := sorry - -theorem lshr_or_or_no_const_thm (x x_1 x_2 x_3 : BitVec 8) : - (Option.bind (if 8 ≤ x_2.toNat then none else some (x_3 >>> x_2.toNat)) fun a => - Option.bind (if 8 ≤ x_2.toNat then none else some (x_1 >>> x_2.toNat)) fun a_1 => some (a ||| (a_1 ||| x))) ⊑ - Option.bind (if 8 ≤ x_2.toNat then none else some ((x_1 ||| x_3) >>> x_2.toNat)) fun a => some (a ||| x) := sorry - -theorem shl_xor_xor_no_const_thm (x x_1 x_2 x_3 : BitVec 8) : - (Option.bind (if 8 ≤ x_2.toNat then none else some (x_3 <<< x_2.toNat)) fun a => - Option.bind (if 8 ≤ x_2.toNat then none else some (x_1 <<< x_2.toNat)) fun a_1 => some (a ^^^ (a_1 ^^^ x))) ⊑ - Option.bind (if 8 ≤ x_2.toNat then none else some ((x_1 ^^^ x_3) <<< x_2.toNat)) fun a => some (a ^^^ x) := sorry - -theorem shl_add_add_no_const_thm (x x_1 x_2 x_3 : BitVec 8) : - (Option.bind (if 8 ≤ x_2.toNat then none else some (x_3 <<< x_2.toNat)) fun a => - Option.bind (if 8 ≤ x_2.toNat then none else some (x_1 <<< x_2.toNat)) fun a_1 => some (a + (a_1 + x))) ⊑ - Option.bind (if 8 ≤ x_2.toNat then none else some ((x_1 + x_3) <<< x_2.toNat)) fun a => some (a + x) := sorry - -theorem lshr_xor_or_good_mask_thm (x x_1 : BitVec 8) : x_1 >>> 4 ||| x >>> 4 ^^^ 48#8 = (x ||| x_1) >>> 4 ||| 48#8 := sorry - -theorem shl_xor_xor_good_mask_thm (x x_1 : BitVec 8) : x_1 <<< 1 ^^^ (x <<< 1 ^^^ 88#8) = (x ^^^ x_1) <<< 1 ^^^ 88#8 := sorry - -theorem shl_xor_xor_bad_mask_distribute_thm (x x_1 : BitVec 8) : x_1 <<< 1 ^^^ (x <<< 1 ^^^ 188#8) = (x ^^^ x_1) <<< 1 ^^^ 188#8 := sorry - -theorem shl_add_and_thm (x x_1 : BitVec 8) : x_1 <<< 1 &&& x <<< 1 + 123#8 = (x + 61#8 &&& x_1) <<< 1 := sorry - -theorem and_ashr_not_thm (x x_1 x_2 : BitVec 8) : - (Option.bind (if 8 ≤ x_1.toNat then none else some (x_2.sshiftRight x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x.sshiftRight x_1.toNat)) fun a_1 => - some (a &&& (a_1 ^^^ 255#8))) ⊑ - if 8 ≤ x_1.toNat then none else some (((x ^^^ 255#8) &&& x_2).sshiftRight x_1.toNat) := sorry - -theorem and_ashr_not_commuted_thm (x x_1 x_2 : BitVec 8) : - (Option.bind (if 8 ≤ x_1.toNat then none else some (x_2.sshiftRight x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x.sshiftRight x_1.toNat)) fun a_1 => - some ((a ^^^ 255#8) &&& a_1)) ⊑ - if 8 ≤ x_1.toNat then none else some (((x_2 ^^^ 255#8) &&& x).sshiftRight x_1.toNat) := sorry - -theorem or_ashr_not_thm (x x_1 x_2 : BitVec 8) : - (Option.bind (if 8 ≤ x_1.toNat then none else some (x_2.sshiftRight x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x.sshiftRight x_1.toNat)) fun a_1 => - some (a ||| a_1 ^^^ 255#8)) ⊑ - if 8 ≤ x_1.toNat then none else some ((x ^^^ 255#8 ||| x_2).sshiftRight x_1.toNat) := sorry - -theorem or_ashr_not_commuted_thm (x x_1 x_2 : BitVec 8) : - (Option.bind (if 8 ≤ x_1.toNat then none else some (x_2.sshiftRight x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x.sshiftRight x_1.toNat)) fun a_1 => - some (a ^^^ 255#8 ||| a_1)) ⊑ - if 8 ≤ x_1.toNat then none else some ((x_2 ^^^ 255#8 ||| x).sshiftRight x_1.toNat) := sorry - -theorem xor_ashr_not_thm (x x_1 x_2 : BitVec 8) : - (Option.bind (if 8 ≤ x_1.toNat then none else some (x_2.sshiftRight x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x.sshiftRight x_1.toNat)) fun a_1 => - some (a ^^^ (a_1 ^^^ 255#8))) ⊑ - Option.bind (if 8 ≤ x_1.toNat then none else some ((x ^^^ x_2).sshiftRight x_1.toNat)) fun a => - some (a ^^^ 255#8) := sorry - -theorem xor_ashr_not_commuted_thm (x x_1 x_2 : BitVec 8) : - (Option.bind (if 8 ≤ x_1.toNat then none else some (x_2.sshiftRight x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x.sshiftRight x_1.toNat)) fun a_1 => - some (a ^^^ 255#8 ^^^ a_1)) ⊑ - Option.bind (if 8 ≤ x_1.toNat then none else some ((x_2 ^^^ x).sshiftRight x_1.toNat)) fun a => - some (a ^^^ 255#8) := sorry - -theorem xor_ashr_not_fail_lshr_ashr_thm (x x_1 x_2 : BitVec 8) : - (Option.bind (if 8 ≤ x_1.toNat then none else some (x_2 >>> x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x.sshiftRight x_1.toNat)) fun a_1 => - some (a ^^^ (a_1 ^^^ 255#8))) ⊑ - Option.bind (if 8 ≤ x_1.toNat then none else some (x.sshiftRight x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x_2 >>> x_1.toNat)) fun a_1 => - some (a ^^^ a_1 ^^^ 255#8) := sorry - -theorem xor_ashr_not_fail_ashr_lshr_thm (x x_1 x_2 : BitVec 8) : - (Option.bind (if 8 ≤ x_1.toNat then none else some (x_2.sshiftRight x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a_1 => some (a ^^^ (a_1 ^^^ 255#8))) ⊑ - Option.bind (if 8 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x_2.sshiftRight x_1.toNat)) fun a_1 => - some (a ^^^ a_1 ^^^ 255#8) := sorry - -theorem xor_ashr_not_fail_invalid_xor_constant_thm (x x_1 x_2 : BitVec 8) : - (Option.bind (if 8 ≤ x_1.toNat then none else some (x_2.sshiftRight x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x.sshiftRight x_1.toNat)) fun a_1 => - some (a ^^^ (a_1 ^^^ 254#8))) ⊑ - Option.bind (if 8 ≤ x_1.toNat then none else some ((x ^^^ x_2).sshiftRight x_1.toNat)) fun a => - some (a ^^^ 254#8) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gbinophofhdisplacedhshifts.lean b/SSA/Projects/InstCombine/tests/LLVM/gbinophofhdisplacedhshifts.lean index 0875d96fe..2390531e4 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gbinophofhdisplacedhshifts.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gbinophofhdisplacedhshifts.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gbinophofhdisplacedhshifts_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -43,7 +43,7 @@ theorem shl_or_proof : shl_or_before ⊑ shl_or_after := by intros try simp ---BEGIN shl_or - apply shl_or_thm + all_goals (try extract_goal ; sorry) ---END shl_or @@ -78,7 +78,7 @@ theorem lshr_or_proof : lshr_or_before ⊑ lshr_or_after := by intros try simp ---BEGIN lshr_or - apply lshr_or_thm + all_goals (try extract_goal ; sorry) ---END lshr_or @@ -113,7 +113,7 @@ theorem ashr_or_proof : ashr_or_before ⊑ ashr_or_after := by intros try simp ---BEGIN ashr_or - apply ashr_or_thm + all_goals (try extract_goal ; sorry) ---END ashr_or @@ -148,7 +148,7 @@ theorem shl_xor_proof : shl_xor_before ⊑ shl_xor_after := by intros try simp ---BEGIN shl_xor - apply shl_xor_thm + all_goals (try extract_goal ; sorry) ---END shl_xor @@ -183,7 +183,7 @@ theorem lshr_xor_proof : lshr_xor_before ⊑ lshr_xor_after := by intros try simp ---BEGIN lshr_xor - apply lshr_xor_thm + all_goals (try extract_goal ; sorry) ---END lshr_xor @@ -218,7 +218,7 @@ theorem ashr_xor_proof : ashr_xor_before ⊑ ashr_xor_after := by intros try simp ---BEGIN ashr_xor - apply ashr_xor_thm + all_goals (try extract_goal ; sorry) ---END ashr_xor @@ -253,7 +253,7 @@ theorem shl_and_proof : shl_and_before ⊑ shl_and_after := by intros try simp ---BEGIN shl_and - apply shl_and_thm + all_goals (try extract_goal ; sorry) ---END shl_and @@ -288,7 +288,7 @@ theorem lshr_and_proof : lshr_and_before ⊑ lshr_and_after := by intros try simp ---BEGIN lshr_and - apply lshr_and_thm + all_goals (try extract_goal ; sorry) ---END lshr_and @@ -323,7 +323,7 @@ theorem ashr_and_proof : ashr_and_before ⊑ ashr_and_after := by intros try simp ---BEGIN ashr_and - apply ashr_and_thm + all_goals (try extract_goal ; sorry) ---END ashr_and @@ -358,7 +358,7 @@ theorem shl_add_proof : shl_add_before ⊑ shl_add_after := by intros try simp ---BEGIN shl_add - apply shl_add_thm + all_goals (try extract_goal ; sorry) ---END shl_add @@ -393,7 +393,7 @@ theorem shl_or_commuted_proof : shl_or_commuted_before ⊑ shl_or_commuted_after intros try simp ---BEGIN shl_or_commuted - apply shl_or_commuted_thm + all_goals (try extract_goal ; sorry) ---END shl_or_commuted @@ -428,7 +428,7 @@ theorem shl_or_with_or_disjoint_instead_of_add_proof : shl_or_with_or_disjoint_i intros try simp ---BEGIN shl_or_with_or_disjoint_instead_of_add - apply shl_or_with_or_disjoint_instead_of_add_thm + all_goals (try extract_goal ; sorry) ---END shl_or_with_or_disjoint_instead_of_add diff --git a/SSA/Projects/InstCombine/tests/LLVM/gbinophofhdisplacedhshifts_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gbinophofhdisplacedhshifts_proof.lean deleted file mode 100644 index cb14baa6c..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gbinophofhdisplacedhshifts_proof.lean +++ /dev/null @@ -1,76 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gbinophofhdisplacedhshifts_proof -theorem shl_or_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (16#8 <<< x.toNat)) fun a => - Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some (3#8 <<< ((x.toNat + 1) % 256))) fun a_1 => - some (a ||| a_1)) ⊑ - if 8 ≤ x.toNat then none else some (22#8 <<< x.toNat) := sorry - -theorem lshr_or_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (16#8 >>> x.toNat)) fun a => - Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some (3#8 >>> ((x.toNat + 1) % 256))) fun a_1 => - some (a ||| a_1)) ⊑ - if 8 ≤ x.toNat then none else some (17#8 >>> x.toNat) := sorry - -theorem ashr_or_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some ((192#8).sshiftRight x.toNat)) fun a => - Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some ((128#8).sshiftRight ((x.toNat + 1) % 256))) - fun a_1 => some (a ||| a_1)) ⊑ - if 8 ≤ x.toNat then none else some ((192#8).sshiftRight x.toNat) := sorry - -theorem shl_xor_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (16#8 <<< x.toNat)) fun a => - Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some (3#8 <<< ((x.toNat + 1) % 256))) fun a_1 => - some (a ^^^ a_1)) ⊑ - if 8 ≤ x.toNat then none else some (22#8 <<< x.toNat) := sorry - -theorem lshr_xor_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (16#8 >>> x.toNat)) fun a => - Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some (3#8 >>> ((x.toNat + 1) % 256))) fun a_1 => - some (a ^^^ a_1)) ⊑ - if 8 ≤ x.toNat then none else some (17#8 >>> x.toNat) := sorry - -theorem ashr_xor_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some ((128#8).sshiftRight x.toNat)) fun a => - Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some ((192#8).sshiftRight ((x.toNat + 1) % 256))) - fun a_1 => some (a ^^^ a_1)) ⊑ - if 8 ≤ x.toNat then none else some (96#8 >>> x.toNat) := sorry - -theorem shl_and_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (48#8 <<< x.toNat)) fun a => - Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some (8#8 <<< ((x.toNat + 1) % 256))) fun a_1 => - some (a &&& a_1)) ⊑ - if 8 ≤ x.toNat then none else some (16#8 <<< x.toNat) := sorry - -theorem lshr_and_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (48#8 >>> x.toNat)) fun a => - Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some (64#8 >>> ((x.toNat + 1) % 256))) fun a_1 => - some (a &&& a_1)) ⊑ - if 8 ≤ x.toNat then none else some (32#8 >>> x.toNat) := sorry - -theorem ashr_and_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some ((192#8).sshiftRight x.toNat)) fun a => - Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some ((128#8).sshiftRight ((x.toNat + 1) % 256))) - fun a_1 => some (a &&& a_1)) ⊑ - if 8 ≤ x.toNat then none else some ((192#8).sshiftRight x.toNat) := sorry - -theorem shl_add_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (16#8 <<< x.toNat)) fun a => - Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some (7#8 <<< ((x.toNat + 1) % 256))) fun a_1 => - some (a + a_1)) ⊑ - if 8 ≤ x.toNat then none else some (30#8 <<< x.toNat) := sorry - -theorem shl_or_commuted_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ (x.toNat + 1) % 256 then none else some (3#8 <<< ((x.toNat + 1) % 256))) fun a => - Option.bind (if 8 ≤ x.toNat then none else some (16#8 <<< x.toNat)) fun a_1 => some (a ||| a_1)) ⊑ - if 8 ≤ x.toNat then none else some (22#8 <<< x.toNat) := sorry - -theorem shl_or_with_or_disjoint_instead_of_add_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (16#8 <<< x.toNat)) fun a => - Option.bind (if 8 ≤ x.toNat ||| 1 then none else some (3#8 <<< (x.toNat ||| 1))) fun a_1 => some (a ||| a_1)) ⊑ - if 8 ≤ x.toNat then none else some (22#8 <<< x.toNat) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehashrhshlhtohmasking.lean b/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehashrhshlhtohmasking.lean index 11bc88f5f..745c69a53 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehashrhshlhtohmasking.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehashrhshlhtohmasking.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gcanonicalizehashrhshlhtohmasking_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -39,7 +39,7 @@ theorem positive_samevar_proof : positive_samevar_before ⊑ positive_samevar_af intros try simp ---BEGIN positive_samevar - apply positive_samevar_thm + all_goals (try extract_goal ; sorry) ---END positive_samevar @@ -70,7 +70,7 @@ theorem positive_sameconst_proof : positive_sameconst_before ⊑ positive_sameco intros try simp ---BEGIN positive_sameconst - apply positive_sameconst_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst @@ -104,7 +104,7 @@ theorem positive_biggerashr_proof : positive_biggerashr_before ⊑ positive_bigg intros try simp ---BEGIN positive_biggerashr - apply positive_biggerashr_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerashr @@ -138,7 +138,7 @@ theorem positive_biggershl_proof : positive_biggershl_before ⊑ positive_bigger intros try simp ---BEGIN positive_biggershl - apply positive_biggershl_thm + all_goals (try extract_goal ; sorry) ---END positive_biggershl @@ -169,7 +169,7 @@ theorem positive_samevar_shlnuw_proof : positive_samevar_shlnuw_before ⊑ posit intros try simp ---BEGIN positive_samevar_shlnuw - apply positive_samevar_shlnuw_thm + all_goals (try extract_goal ; sorry) ---END positive_samevar_shlnuw @@ -200,7 +200,7 @@ theorem positive_sameconst_shlnuw_proof : positive_sameconst_shlnuw_before ⊑ p intros try simp ---BEGIN positive_sameconst_shlnuw - apply positive_sameconst_shlnuw_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_shlnuw @@ -234,7 +234,7 @@ theorem positive_biggerashr_shlnuw_proof : positive_biggerashr_shlnuw_before ⊑ intros try simp ---BEGIN positive_biggerashr_shlnuw - apply positive_biggerashr_shlnuw_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerashr_shlnuw @@ -268,7 +268,7 @@ theorem positive_biggershl_shlnuw_proof : positive_biggershl_shlnuw_before ⊑ p intros try simp ---BEGIN positive_biggershl_shlnuw - apply positive_biggershl_shlnuw_thm + all_goals (try extract_goal ; sorry) ---END positive_biggershl_shlnuw @@ -299,7 +299,7 @@ theorem positive_samevar_shlnsw_proof : positive_samevar_shlnsw_before ⊑ posit intros try simp ---BEGIN positive_samevar_shlnsw - apply positive_samevar_shlnsw_thm + all_goals (try extract_goal ; sorry) ---END positive_samevar_shlnsw @@ -330,7 +330,7 @@ theorem positive_sameconst_shlnsw_proof : positive_sameconst_shlnsw_before ⊑ p intros try simp ---BEGIN positive_sameconst_shlnsw - apply positive_sameconst_shlnsw_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_shlnsw @@ -364,7 +364,7 @@ theorem positive_biggerashr_shlnsw_proof : positive_biggerashr_shlnsw_before ⊑ intros try simp ---BEGIN positive_biggerashr_shlnsw - apply positive_biggerashr_shlnsw_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerashr_shlnsw @@ -398,7 +398,7 @@ theorem positive_biggershl_shlnsw_proof : positive_biggershl_shlnsw_before ⊑ p intros try simp ---BEGIN positive_biggershl_shlnsw - apply positive_biggershl_shlnsw_thm + all_goals (try extract_goal ; sorry) ---END positive_biggershl_shlnsw @@ -429,7 +429,7 @@ theorem positive_samevar_shlnuwnsw_proof : positive_samevar_shlnuwnsw_before ⊑ intros try simp ---BEGIN positive_samevar_shlnuwnsw - apply positive_samevar_shlnuwnsw_thm + all_goals (try extract_goal ; sorry) ---END positive_samevar_shlnuwnsw @@ -460,7 +460,7 @@ theorem positive_sameconst_shlnuwnsw_proof : positive_sameconst_shlnuwnsw_before intros try simp ---BEGIN positive_sameconst_shlnuwnsw - apply positive_sameconst_shlnuwnsw_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_shlnuwnsw @@ -494,7 +494,7 @@ theorem positive_biggerashr_shlnuwnsw_proof : positive_biggerashr_shlnuwnsw_befo intros try simp ---BEGIN positive_biggerashr_shlnuwnsw - apply positive_biggerashr_shlnuwnsw_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerashr_shlnuwnsw @@ -528,7 +528,7 @@ theorem positive_biggershl_shlnuwnsw_proof : positive_biggershl_shlnuwnsw_before intros try simp ---BEGIN positive_biggershl_shlnuwnsw - apply positive_biggershl_shlnuwnsw_thm + all_goals (try extract_goal ; sorry) ---END positive_biggershl_shlnuwnsw @@ -556,7 +556,7 @@ theorem positive_samevar_ashrexact_proof : positive_samevar_ashrexact_before ⊑ intros try simp ---BEGIN positive_samevar_ashrexact - apply positive_samevar_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_samevar_ashrexact @@ -585,7 +585,7 @@ theorem positive_sameconst_ashrexact_proof : positive_sameconst_ashrexact_before intros try simp ---BEGIN positive_sameconst_ashrexact - apply positive_sameconst_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_ashrexact @@ -617,7 +617,7 @@ theorem positive_biggerashr_ashrexact_proof : positive_biggerashr_ashrexact_befo intros try simp ---BEGIN positive_biggerashr_ashrexact - apply positive_biggerashr_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerashr_ashrexact @@ -649,7 +649,7 @@ theorem positive_biggershl_ashrexact_proof : positive_biggershl_ashrexact_before intros try simp ---BEGIN positive_biggershl_ashrexact - apply positive_biggershl_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_biggershl_ashrexact @@ -677,7 +677,7 @@ theorem positive_samevar_shlnsw_ashrexact_proof : positive_samevar_shlnsw_ashrex intros try simp ---BEGIN positive_samevar_shlnsw_ashrexact - apply positive_samevar_shlnsw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_samevar_shlnsw_ashrexact @@ -706,7 +706,7 @@ theorem positive_sameconst_shlnsw_ashrexact_proof : positive_sameconst_shlnsw_as intros try simp ---BEGIN positive_sameconst_shlnsw_ashrexact - apply positive_sameconst_shlnsw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_shlnsw_ashrexact @@ -738,7 +738,7 @@ theorem positive_biggerashr_shlnsw_ashrexact_proof : positive_biggerashr_shlnsw_ intros try simp ---BEGIN positive_biggerashr_shlnsw_ashrexact - apply positive_biggerashr_shlnsw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerashr_shlnsw_ashrexact @@ -770,7 +770,7 @@ theorem positive_biggershl_shlnsw_ashrexact_proof : positive_biggershl_shlnsw_as intros try simp ---BEGIN positive_biggershl_shlnsw_ashrexact - apply positive_biggershl_shlnsw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_biggershl_shlnsw_ashrexact @@ -798,7 +798,7 @@ theorem positive_samevar_shlnuw_ashrexact_proof : positive_samevar_shlnuw_ashrex intros try simp ---BEGIN positive_samevar_shlnuw_ashrexact - apply positive_samevar_shlnuw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_samevar_shlnuw_ashrexact @@ -827,7 +827,7 @@ theorem positive_sameconst_shlnuw_ashrexact_proof : positive_sameconst_shlnuw_as intros try simp ---BEGIN positive_sameconst_shlnuw_ashrexact - apply positive_sameconst_shlnuw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_shlnuw_ashrexact @@ -859,7 +859,7 @@ theorem positive_biggerashr_shlnuw_ashrexact_proof : positive_biggerashr_shlnuw_ intros try simp ---BEGIN positive_biggerashr_shlnuw_ashrexact - apply positive_biggerashr_shlnuw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerashr_shlnuw_ashrexact @@ -891,7 +891,7 @@ theorem positive_biggershl_shlnuw_ashrexact_proof : positive_biggershl_shlnuw_as intros try simp ---BEGIN positive_biggershl_shlnuw_ashrexact - apply positive_biggershl_shlnuw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_biggershl_shlnuw_ashrexact @@ -919,7 +919,7 @@ theorem positive_samevar_shlnuwnsw_ashrexact_proof : positive_samevar_shlnuwnsw_ intros try simp ---BEGIN positive_samevar_shlnuwnsw_ashrexact - apply positive_samevar_shlnuwnsw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_samevar_shlnuwnsw_ashrexact @@ -948,7 +948,7 @@ theorem positive_sameconst_shlnuwnsw_ashrexact_proof : positive_sameconst_shlnuw intros try simp ---BEGIN positive_sameconst_shlnuwnsw_ashrexact - apply positive_sameconst_shlnuwnsw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_shlnuwnsw_ashrexact @@ -980,7 +980,7 @@ theorem positive_biggerashr_shlnuwnsw_ashrexact_proof : positive_biggerashr_shln intros try simp ---BEGIN positive_biggerashr_shlnuwnsw_ashrexact - apply positive_biggerashr_shlnuwnsw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerashr_shlnuwnsw_ashrexact @@ -1012,7 +1012,7 @@ theorem positive_biggershl_shlnuwnsw_ashrexact_proof : positive_biggershl_shlnuw intros try simp ---BEGIN positive_biggershl_shlnuwnsw_ashrexact - apply positive_biggershl_shlnuwnsw_ashrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_biggershl_shlnuwnsw_ashrexact diff --git a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehashrhshlhtohmasking_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehashrhshlhtohmasking_proof.lean deleted file mode 100644 index 81402cfc7..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehashrhshlhtohmasking_proof.lean +++ /dev/null @@ -1,94 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gcanonicalizehashrhshlhtohmasking_proof -theorem positive_samevar_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (x_1.sshiftRight x.toNat)) fun a => - if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ - Option.bind (if 8 ≤ x.toNat then none else some (255#8 <<< x.toNat)) fun a => some (a &&& x_1) := sorry - -theorem positive_sameconst_thm (x : BitVec 8) : x.sshiftRight 3 <<< 3 = x &&& 248#8 := sorry - -theorem positive_biggerashr_thm (x : BitVec 8) : x.sshiftRight 6 <<< 3 = x.sshiftRight 3 &&& 248#8 := sorry - -theorem positive_biggershl_thm (x : BitVec 8) : x.sshiftRight 3 <<< 6 = x <<< 3 &&& 192#8 := sorry - -theorem positive_samevar_shlnuw_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (x_1.sshiftRight x.toNat)) fun a => - if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ - Option.bind (if 8 ≤ x.toNat then none else some (255#8 <<< x.toNat)) fun a => some (a &&& x_1) := sorry - -theorem positive_sameconst_shlnuw_thm (x : BitVec 8) : x.sshiftRight 3 <<< 3 = x &&& 248#8 := sorry - -theorem positive_biggerashr_shlnuw_thm (x : BitVec 8) : x.sshiftRight 6 <<< 3 = x.sshiftRight 3 &&& 248#8 := sorry - -theorem positive_biggershl_shlnuw_thm (x : BitVec 8) : x.sshiftRight 3 <<< 6 = x <<< 3 &&& 192#8 := sorry - -theorem positive_samevar_shlnsw_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (x_1.sshiftRight x.toNat)) fun a => - if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ - Option.bind (if 8 ≤ x.toNat then none else some (255#8 <<< x.toNat)) fun a => some (a &&& x_1) := sorry - -theorem positive_sameconst_shlnsw_thm (x : BitVec 8) : x.sshiftRight 3 <<< 3 = x &&& 248#8 := sorry - -theorem positive_biggerashr_shlnsw_thm (x : BitVec 8) : x.sshiftRight 6 <<< 3 = x.sshiftRight 3 &&& 248#8 := sorry - -theorem positive_biggershl_shlnsw_thm (x : BitVec 8) : x.sshiftRight 3 <<< 6 = x <<< 3 &&& 192#8 := sorry - -theorem positive_samevar_shlnuwnsw_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (x_1.sshiftRight x.toNat)) fun a => - if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ - Option.bind (if 8 ≤ x.toNat then none else some (255#8 <<< x.toNat)) fun a => some (a &&& x_1) := sorry - -theorem positive_sameconst_shlnuwnsw_thm (x : BitVec 8) : x.sshiftRight 3 <<< 3 = x &&& 248#8 := sorry - -theorem positive_biggerashr_shlnuwnsw_thm (x : BitVec 8) : x.sshiftRight 6 <<< 3 = x.sshiftRight 3 &&& 248#8 := sorry - -theorem positive_biggershl_shlnuwnsw_thm (x : BitVec 8) : x.sshiftRight 3 <<< 6 = x <<< 3 &&& 64#8 := sorry - -theorem positive_samevar_ashrexact_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (x_1.sshiftRight x.toNat)) fun a => - if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ - some x_1 := sorry - -theorem positive_sameconst_ashrexact_thm (x : BitVec 8) : x.sshiftRight 3 <<< 3 = x := sorry - -theorem positive_biggerashr_ashrexact_thm (x : BitVec 8) : x.sshiftRight 6 <<< 3 = x.sshiftRight 3 := sorry - -theorem positive_biggershl_ashrexact_thm (x : BitVec 8) : x.sshiftRight 3 <<< 6 = x <<< 3 := sorry - -theorem positive_samevar_shlnsw_ashrexact_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (x_1.sshiftRight x.toNat)) fun a => - if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ - some x_1 := sorry - -theorem positive_sameconst_shlnsw_ashrexact_thm (x : BitVec 8) : x.sshiftRight 3 <<< 3 = x := sorry - -theorem positive_biggerashr_shlnsw_ashrexact_thm (x : BitVec 8) : x.sshiftRight 6 <<< 3 = x.sshiftRight 3 := sorry - -theorem positive_biggershl_shlnsw_ashrexact_thm (x : BitVec 8) : x.sshiftRight 3 <<< 6 = x <<< 3 := sorry - -theorem positive_samevar_shlnuw_ashrexact_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (x_1.sshiftRight x.toNat)) fun a => - if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ - some x_1 := sorry - -theorem positive_sameconst_shlnuw_ashrexact_thm (x : BitVec 8) : x.sshiftRight 3 <<< 3 = x := sorry - -theorem positive_biggerashr_shlnuw_ashrexact_thm (x : BitVec 8) : x.sshiftRight 6 <<< 3 = x.sshiftRight 3 := sorry - -theorem positive_biggershl_shlnuw_ashrexact_thm (x : BitVec 8) : x.sshiftRight 3 <<< 6 = x <<< 3 := sorry - -theorem positive_samevar_shlnuwnsw_ashrexact_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (x_1.sshiftRight x.toNat)) fun a => - if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ - some x_1 := sorry - -theorem positive_sameconst_shlnuwnsw_ashrexact_thm (x : BitVec 8) : x.sshiftRight 3 <<< 3 = x := sorry - -theorem positive_biggerashr_shlnuwnsw_ashrexact_thm (x : BitVec 8) : x.sshiftRight 6 <<< 3 = x.sshiftRight 3 := sorry - -theorem positive_biggershl_shlnuwnsw_ashrexact_thm (x : BitVec 8) : x.sshiftRight 3 <<< 6 = x <<< 3 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehlshrhshlhtohmasking.lean b/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehlshrhshlhtohmasking.lean index e15ef0b86..cbd2cf91f 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehlshrhshlhtohmasking.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehlshrhshlhtohmasking.lean @@ -70,7 +70,7 @@ theorem positive_sameconst_proof : positive_sameconst_before ⊑ positive_sameco intros try simp ---BEGIN positive_sameconst - apply positive_sameconst_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst @@ -200,7 +200,7 @@ theorem positive_sameconst_shlnuw_proof : positive_sameconst_shlnuw_before ⊑ p intros try simp ---BEGIN positive_sameconst_shlnuw - apply positive_sameconst_shlnuw_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_shlnuw @@ -330,7 +330,7 @@ theorem positive_sameconst_shlnsw_proof : positive_sameconst_shlnsw_before ⊑ p intros try simp ---BEGIN positive_sameconst_shlnsw - apply positive_sameconst_shlnsw_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_shlnsw @@ -460,7 +460,7 @@ theorem positive_sameconst_shlnuwnsw_proof : positive_sameconst_shlnuwnsw_before intros try simp ---BEGIN positive_sameconst_shlnuwnsw - apply positive_sameconst_shlnuwnsw_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_shlnuwnsw diff --git a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehlshrhshlhtohmasking_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehlshrhshlhtohmasking_proof.lean index dc0348632..0ab3676e3 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehlshrhshlhtohmasking_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehlshrhshlhtohmasking_proof.lean @@ -9,8 +9,6 @@ theorem positive_samevar_thm (x x_1 : BitVec 8) : if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ Option.bind (if 8 ≤ x.toNat then none else some (255#8 <<< x.toNat)) fun a => some (a &&& x_1) := sorry -theorem positive_sameconst_thm (x : BitVec 8) : x >>> 3 <<< 3 = x &&& 248#8 := sorry - theorem positive_biggerlshr_thm (x : BitVec 8) : x >>> 6 <<< 3 = x >>> 3 &&& 24#8 := sorry theorem positive_biggershl_thm (x : BitVec 8) : x >>> 3 <<< 6 = x <<< 3 &&& 192#8 := sorry @@ -20,8 +18,6 @@ theorem positive_samevar_shlnuw_thm (x x_1 : BitVec 8) : if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ Option.bind (if 8 ≤ x.toNat then none else some (255#8 <<< x.toNat)) fun a => some (a &&& x_1) := sorry -theorem positive_sameconst_shlnuw_thm (x : BitVec 8) : x >>> 3 <<< 3 = x &&& 248#8 := sorry - theorem positive_biggerlshr_shlnuw_thm (x : BitVec 8) : x >>> 6 <<< 3 = x >>> 3 &&& 24#8 := sorry theorem positive_biggershl_shlnuw_thm (x : BitVec 8) : x >>> 3 <<< 6 = x <<< 3 &&& 192#8 := sorry @@ -31,8 +27,6 @@ theorem positive_samevar_shlnsw_thm (x x_1 : BitVec 8) : if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ Option.bind (if 8 ≤ x.toNat then none else some (255#8 <<< x.toNat)) fun a => some (a &&& x_1) := sorry -theorem positive_sameconst_shlnsw_thm (x : BitVec 8) : x >>> 3 <<< 3 = x &&& 248#8 := sorry - theorem positive_biggerlshr_shlnsw_thm (x : BitVec 8) : x >>> 6 <<< 3 = x >>> 3 &&& 24#8 := sorry theorem positive_biggershl_shlnsw_thm (x : BitVec 8) : x >>> 3 <<< 6 = x <<< 3 &&& 64#8 := sorry @@ -42,8 +36,6 @@ theorem positive_samevar_shlnuwnsw_thm (x x_1 : BitVec 8) : if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ Option.bind (if 8 ≤ x.toNat then none else some (255#8 <<< x.toNat)) fun a => some (a &&& x_1) := sorry -theorem positive_sameconst_shlnuwnsw_thm (x : BitVec 8) : x >>> 3 <<< 3 = x &&& 248#8 := sorry - theorem positive_biggerlshr_shlnuwnsw_thm (x : BitVec 8) : x >>> 6 <<< 3 = x >>> 3 &&& 24#8 := sorry theorem positive_biggershl_shlnuwnsw_thm (x : BitVec 8) : x >>> 3 <<< 6 = x <<< 3 &&& 64#8 := sorry @@ -53,7 +45,7 @@ theorem positive_samevar_lshrexact_thm (x x_1 : BitVec 8) : if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ some x_1 := sorry -theorem positive_sameconst_lshrexact_thm (x : BitVec 8) : x >>> 3 <<< 3 = x := sorry +theorem positive_sameconst_lshrexact_thm (x : BitVec 8) : x &&& 248#8 = x := sorry theorem positive_biggerlshr_lshrexact_thm (x : BitVec 8) : x >>> 6 <<< 3 = x >>> 3 := sorry @@ -64,7 +56,7 @@ theorem positive_samevar_shlnsw_lshrexact_thm (x x_1 : BitVec 8) : if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ some x_1 := sorry -theorem positive_sameconst_shlnsw_lshrexact_thm (x : BitVec 8) : x >>> 3 <<< 3 = x := sorry +theorem positive_sameconst_shlnsw_lshrexact_thm (x : BitVec 8) : x &&& 248#8 = x := sorry theorem positive_biggerlshr_shlnsw_lshrexact_thm (x : BitVec 8) : x >>> 6 <<< 3 = x >>> 3 := sorry @@ -75,7 +67,7 @@ theorem positive_samevar_shlnuw_lshrexact_thm (x x_1 : BitVec 8) : if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ some x_1 := sorry -theorem positive_sameconst_shlnuw_lshrexact_thm (x : BitVec 8) : x >>> 3 <<< 3 = x := sorry +theorem positive_sameconst_shlnuw_lshrexact_thm (x : BitVec 8) : x &&& 248#8 = x := sorry theorem positive_biggerlshr_shlnuw_lshrexact_thm (x : BitVec 8) : x >>> 6 <<< 3 = x >>> 3 := sorry @@ -86,7 +78,7 @@ theorem positive_samevar_shlnuwnsw_lshrexact_thm (x x_1 : BitVec 8) : if 8 ≤ x.toNat then none else some (a <<< x.toNat)) ⊑ some x_1 := sorry -theorem positive_sameconst_shlnuwnsw_lshrexact_thm (x : BitVec 8) : x >>> 3 <<< 3 = x := sorry +theorem positive_sameconst_shlnuwnsw_lshrexact_thm (x : BitVec 8) : x &&& 248#8 = x := sorry theorem positive_biggerlshr_shlnuwnsw_lshrexact_thm (x : BitVec 8) : x >>> 6 <<< 3 = x >>> 3 := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehshlhlshrhtohmasking.lean b/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehshlhlshrhtohmasking.lean index 5fe3ee02a..e4866644d 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehshlhlshrhtohmasking.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehshlhlshrhtohmasking.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gcanonicalizehshlhlshrhtohmasking_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -39,7 +39,7 @@ theorem positive_samevar_proof : positive_samevar_before ⊑ positive_samevar_af intros try simp ---BEGIN positive_samevar - apply positive_samevar_thm + all_goals (try extract_goal ; sorry) ---END positive_samevar @@ -70,7 +70,7 @@ theorem positive_sameconst_proof : positive_sameconst_before ⊑ positive_sameco intros try simp ---BEGIN positive_sameconst - apply positive_sameconst_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst @@ -104,7 +104,7 @@ theorem positive_biggerShl_proof : positive_biggerShl_before ⊑ positive_bigger intros try simp ---BEGIN positive_biggerShl - apply positive_biggerShl_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerShl @@ -138,7 +138,7 @@ theorem positive_biggerLshr_proof : positive_biggerLshr_before ⊑ positive_bigg intros try simp ---BEGIN positive_biggerLshr - apply positive_biggerLshr_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerLshr @@ -172,7 +172,7 @@ theorem positive_biggerLshr_lshrexact_proof : positive_biggerLshr_lshrexact_befo intros try simp ---BEGIN positive_biggerLshr_lshrexact - apply positive_biggerLshr_lshrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerLshr_lshrexact @@ -200,7 +200,7 @@ theorem positive_samevar_shlnuw_proof : positive_samevar_shlnuw_before ⊑ posit intros try simp ---BEGIN positive_samevar_shlnuw - apply positive_samevar_shlnuw_thm + all_goals (try extract_goal ; sorry) ---END positive_samevar_shlnuw @@ -229,7 +229,7 @@ theorem positive_sameconst_shlnuw_proof : positive_sameconst_shlnuw_before ⊑ p intros try simp ---BEGIN positive_sameconst_shlnuw - apply positive_sameconst_shlnuw_thm + all_goals (try extract_goal ; sorry) ---END positive_sameconst_shlnuw @@ -261,7 +261,7 @@ theorem positive_biggerShl_shlnuw_proof : positive_biggerShl_shlnuw_before ⊑ p intros try simp ---BEGIN positive_biggerShl_shlnuw - apply positive_biggerShl_shlnuw_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerShl_shlnuw @@ -293,7 +293,7 @@ theorem positive_biggerLshr_shlnuw_proof : positive_biggerLshr_shlnuw_before ⊑ intros try simp ---BEGIN positive_biggerLshr_shlnuw - apply positive_biggerLshr_shlnuw_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerLshr_shlnuw @@ -325,7 +325,7 @@ theorem positive_biggerLshr_shlnuw_lshrexact_proof : positive_biggerLshr_shlnuw_ intros try simp ---BEGIN positive_biggerLshr_shlnuw_lshrexact - apply positive_biggerLshr_shlnuw_lshrexact_thm + all_goals (try extract_goal ; sorry) ---END positive_biggerLshr_shlnuw_lshrexact diff --git a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehshlhlshrhtohmasking_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehshlhlshrhtohmasking_proof.lean deleted file mode 100644 index 8938ee650..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gcanonicalizehshlhlshrhtohmasking_proof.lean +++ /dev/null @@ -1,32 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gcanonicalizehshlhlshrhtohmasking_proof -theorem positive_samevar_thm (x x_1 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if 32 ≤ x.toNat then none else some (a >>> x.toNat)) ⊑ - Option.bind (if 32 ≤ x.toNat then none else some (4294967295#32 >>> x.toNat)) fun a => some (a &&& x_1) := sorry - -theorem positive_sameconst_thm (x : BitVec 32) : x <<< 5 >>> 5 = x &&& 134217727#32 := sorry - -theorem positive_biggerShl_thm (x : BitVec 32) : x <<< 10 >>> 5 = x <<< 5 &&& 134217696#32 := sorry - -theorem positive_biggerLshr_thm (x : BitVec 32) : x <<< 5 >>> 10 = x >>> 5 &&& 4194303#32 := sorry - -theorem positive_biggerLshr_lshrexact_thm (x : BitVec 32) : x <<< 5 >>> 10 = x >>> 5 &&& 4194303#32 := sorry - -theorem positive_samevar_shlnuw_thm (x x_1 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if 32 ≤ x.toNat then none else some (a >>> x.toNat)) ⊑ - some x_1 := sorry - -theorem positive_sameconst_shlnuw_thm (x : BitVec 32) : x <<< 5 >>> 5 = x := sorry - -theorem positive_biggerShl_shlnuw_thm (x : BitVec 32) : x <<< 10 >>> 5 = x <<< 5 := sorry - -theorem positive_biggerLshr_shlnuw_thm (x : BitVec 32) : x <<< 5 >>> 10 = x >>> 5 := sorry - -theorem positive_biggerLshr_shlnuw_lshrexact_thm (x : BitVec 32) : x <<< 5 >>> 10 = x >>> 5 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gdemand_shrink_nsw.lean b/SSA/Projects/InstCombine/tests/LLVM/gdemand_shrink_nsw.lean index e5e5db26f..429cf112e 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gdemand_shrink_nsw.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gdemand_shrink_nsw.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gdemand_shrink_nsw_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics diff --git a/SSA/Projects/InstCombine/tests/LLVM/gdemand_shrink_nsw_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gdemand_shrink_nsw_proof.lean deleted file mode 100644 index e47cee16f..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gdemand_shrink_nsw_proof.lean +++ /dev/null @@ -1,6 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gdemand_shrink_nsw_proof diff --git a/SSA/Projects/InstCombine/tests/LLVM/gdemorgan.lean b/SSA/Projects/InstCombine/tests/LLVM/gdemorgan.lean index 6e8d5b813..3b002fdd4 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gdemorgan.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gdemorgan.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gdemorgan_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -41,7 +41,7 @@ theorem demorgan_or_apint1_proof : demorgan_or_apint1_before ⊑ demorgan_or_api intros try simp ---BEGIN demorgan_or_apint1 - apply demorgan_or_apint1_thm + all_goals (try extract_goal ; sorry) ---END demorgan_or_apint1 @@ -74,7 +74,7 @@ theorem demorgan_or_apint2_proof : demorgan_or_apint2_before ⊑ demorgan_or_api intros try simp ---BEGIN demorgan_or_apint2 - apply demorgan_or_apint2_thm + all_goals (try extract_goal ; sorry) ---END demorgan_or_apint2 @@ -107,7 +107,7 @@ theorem demorgan_and_apint1_proof : demorgan_and_apint1_before ⊑ demorgan_and_ intros try simp ---BEGIN demorgan_and_apint1 - apply demorgan_and_apint1_thm + all_goals (try extract_goal ; sorry) ---END demorgan_and_apint1 @@ -140,7 +140,7 @@ theorem demorgan_and_apint2_proof : demorgan_and_apint2_before ⊑ demorgan_and_ intros try simp ---BEGIN demorgan_and_apint2 - apply demorgan_and_apint2_thm + all_goals (try extract_goal ; sorry) ---END demorgan_and_apint2 @@ -173,7 +173,7 @@ theorem demorgan_and_apint3_proof : demorgan_and_apint3_before ⊑ demorgan_and_ intros try simp ---BEGIN demorgan_and_apint3 - apply demorgan_and_apint3_thm + all_goals (try extract_goal ; sorry) ---END demorgan_and_apint3 @@ -206,7 +206,7 @@ theorem demorgan_and_apint4_proof : demorgan_and_apint4_before ⊑ demorgan_and_ intros try simp ---BEGIN demorgan_and_apint4 - apply demorgan_and_apint4_thm + all_goals (try extract_goal ; sorry) ---END demorgan_and_apint4 @@ -239,7 +239,7 @@ theorem demorgan_and_apint5_proof : demorgan_and_apint5_before ⊑ demorgan_and_ intros try simp ---BEGIN demorgan_and_apint5 - apply demorgan_and_apint5_thm + all_goals (try extract_goal ; sorry) ---END demorgan_and_apint5 @@ -271,7 +271,7 @@ theorem test3_proof : test3_before ⊑ test3_after := by intros try simp ---BEGIN test3 - apply test3_thm + all_goals (try extract_goal ; sorry) ---END test3 @@ -304,7 +304,7 @@ theorem test4_proof : test4_before ⊑ test4_after := by intros try simp ---BEGIN test4 - apply test4_thm + all_goals (try extract_goal ; sorry) ---END test4 @@ -336,7 +336,7 @@ theorem test5_proof : test5_before ⊑ test5_after := by intros try simp ---BEGIN test5 - apply test5_thm + all_goals (try extract_goal ; sorry) ---END test5 @@ -368,7 +368,7 @@ theorem test3_apint_proof : test3_apint_before ⊑ test3_apint_after := by intros try simp ---BEGIN test3_apint - apply test3_apint_thm + all_goals (try extract_goal ; sorry) ---END test3_apint @@ -402,7 +402,7 @@ theorem test4_apint_proof : test4_apint_before ⊑ test4_apint_after := by intros try simp ---BEGIN test4_apint - apply test4_apint_thm + all_goals (try extract_goal ; sorry) ---END test4_apint @@ -434,7 +434,7 @@ theorem test5_apint_proof : test5_apint_before ⊑ test5_apint_after := by intros try simp ---BEGIN test5_apint - apply test5_apint_thm + all_goals (try extract_goal ; sorry) ---END test5_apint @@ -454,7 +454,7 @@ def demorgan_nand_after := [llvm| ^0(%arg38 : i8, %arg39 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg39, %0 : i8 - %2 = llvm.or %1, %arg38 : i8 + %2 = llvm.or %arg38, %1 : i8 "llvm.return"(%2) : (i8) -> () } ] @@ -467,7 +467,7 @@ theorem demorgan_nand_proof : demorgan_nand_before ⊑ demorgan_nand_after := by intros try simp ---BEGIN demorgan_nand - apply demorgan_nand_thm + all_goals (try extract_goal ; sorry) ---END demorgan_nand @@ -487,7 +487,7 @@ def demorgan_nand_apint1_after := [llvm| ^0(%arg36 : i7, %arg37 : i7): %0 = "llvm.mlir.constant"() <{value = -1 : i7}> : () -> i7 %1 = llvm.xor %arg37, %0 : i7 - %2 = llvm.or %1, %arg36 : i7 + %2 = llvm.or %arg36, %1 : i7 "llvm.return"(%2) : (i7) -> () } ] @@ -500,7 +500,7 @@ theorem demorgan_nand_apint1_proof : demorgan_nand_apint1_before ⊑ demorgan_na intros try simp ---BEGIN demorgan_nand_apint1 - apply demorgan_nand_apint1_thm + all_goals (try extract_goal ; sorry) ---END demorgan_nand_apint1 @@ -520,7 +520,7 @@ def demorgan_nand_apint2_after := [llvm| ^0(%arg34 : i117, %arg35 : i117): %0 = "llvm.mlir.constant"() <{value = -1 : i117}> : () -> i117 %1 = llvm.xor %arg35, %0 : i117 - %2 = llvm.or %1, %arg34 : i117 + %2 = llvm.or %arg34, %1 : i117 "llvm.return"(%2) : (i117) -> () } ] @@ -533,7 +533,7 @@ theorem demorgan_nand_apint2_proof : demorgan_nand_apint2_before ⊑ demorgan_na intros try simp ---BEGIN demorgan_nand_apint2 - apply demorgan_nand_apint2_thm + all_goals (try extract_goal ; sorry) ---END demorgan_nand_apint2 @@ -553,7 +553,7 @@ def demorgan_nor_after := [llvm| ^0(%arg32 : i8, %arg33 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg33, %0 : i8 - %2 = llvm.and %1, %arg32 : i8 + %2 = llvm.and %arg32, %1 : i8 "llvm.return"(%2) : (i8) -> () } ] @@ -566,7 +566,7 @@ theorem demorgan_nor_proof : demorgan_nor_before ⊑ demorgan_nor_after := by intros try simp ---BEGIN demorgan_nor - apply demorgan_nor_thm + all_goals (try extract_goal ; sorry) ---END demorgan_nor @@ -592,7 +592,7 @@ def demorgan_nor_use2a_after := [llvm| %2 = llvm.xor %arg30, %0 : i8 %3 = llvm.mul %2, %1 : i8 %4 = llvm.xor %arg31, %0 : i8 - %5 = llvm.and %4, %arg30 : i8 + %5 = llvm.and %arg30, %4 : i8 %6 = llvm.sdiv %5, %3 : i8 "llvm.return"(%6) : (i8) -> () } @@ -606,7 +606,7 @@ theorem demorgan_nor_use2a_proof : demorgan_nor_use2a_before ⊑ demorgan_nor_us intros try simp ---BEGIN demorgan_nor_use2a - apply demorgan_nor_use2a_thm + all_goals (try extract_goal ; sorry) ---END demorgan_nor_use2a @@ -631,7 +631,7 @@ def demorgan_nor_use2b_after := [llvm| %1 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %2 = llvm.mul %arg29, %0 : i8 %3 = llvm.xor %arg29, %1 : i8 - %4 = llvm.and %3, %arg28 : i8 + %4 = llvm.and %arg28, %3 : i8 %5 = llvm.sdiv %4, %2 : i8 "llvm.return"(%5) : (i8) -> () } @@ -645,11 +645,51 @@ theorem demorgan_nor_use2b_proof : demorgan_nor_use2b_before ⊑ demorgan_nor_us intros try simp ---BEGIN demorgan_nor_use2b - apply demorgan_nor_use2b_thm + all_goals (try extract_goal ; sorry) ---END demorgan_nor_use2b +def demorgan_nor_use2c_before := [llvm| +{ +^0(%arg26 : i8, %arg27 : i8): + %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 + %1 = "llvm.mlir.constant"() <{value = 23 : i8}> : () -> i8 + %2 = llvm.xor %arg26, %0 : i8 + %3 = llvm.or %2, %arg27 : i8 + %4 = llvm.mul %3, %1 : i8 + %5 = llvm.xor %3, %0 : i8 + %6 = llvm.sdiv %5, %4 : i8 + "llvm.return"(%6) : (i8) -> () +} +] +def demorgan_nor_use2c_after := [llvm| +{ +^0(%arg26 : i8, %arg27 : i8): + %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 + %1 = "llvm.mlir.constant"() <{value = 23 : i8}> : () -> i8 + %2 = llvm.xor %arg26, %0 : i8 + %3 = llvm.or %arg27, %2 : i8 + %4 = llvm.mul %3, %1 : i8 + %5 = llvm.xor %3, %0 : i8 + %6 = llvm.sdiv %5, %4 : i8 + "llvm.return"(%6) : (i8) -> () +} +] +theorem demorgan_nor_use2c_proof : demorgan_nor_use2c_before ⊑ demorgan_nor_use2c_after := by + unfold demorgan_nor_use2c_before demorgan_nor_use2c_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN demorgan_nor_use2c + all_goals (try extract_goal ; sorry) + ---END demorgan_nor_use2c + + + def demorgan_nor_use2ab_before := [llvm| { ^0(%arg24 : i8, %arg25 : i8): @@ -676,7 +716,7 @@ def demorgan_nor_use2ab_after := [llvm| %4 = llvm.xor %arg24, %1 : i8 %5 = llvm.mul %4, %2 : i8 %6 = llvm.xor %arg25, %1 : i8 - %7 = llvm.and %6, %arg24 : i8 + %7 = llvm.and %arg24, %6 : i8 %8 = llvm.sdiv %7, %3 : i8 %9 = llvm.sdiv %8, %5 : i8 "llvm.return"(%9) : (i8) -> () @@ -691,11 +731,101 @@ theorem demorgan_nor_use2ab_proof : demorgan_nor_use2ab_before ⊑ demorgan_nor_ intros try simp ---BEGIN demorgan_nor_use2ab - apply demorgan_nor_use2ab_thm + all_goals (try extract_goal ; sorry) ---END demorgan_nor_use2ab +def demorgan_nor_use2ac_before := [llvm| +{ +^0(%arg22 : i8, %arg23 : i8): + %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 + %1 = "llvm.mlir.constant"() <{value = 17 : i8}> : () -> i8 + %2 = "llvm.mlir.constant"() <{value = 23 : i8}> : () -> i8 + %3 = llvm.xor %arg22, %0 : i8 + %4 = llvm.mul %3, %1 : i8 + %5 = llvm.or %3, %arg23 : i8 + %6 = llvm.mul %5, %2 : i8 + %7 = llvm.xor %5, %0 : i8 + %8 = llvm.sdiv %7, %6 : i8 + %9 = llvm.sdiv %8, %4 : i8 + "llvm.return"(%9) : (i8) -> () +} +] +def demorgan_nor_use2ac_after := [llvm| +{ +^0(%arg22 : i8, %arg23 : i8): + %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 + %1 = "llvm.mlir.constant"() <{value = 17 : i8}> : () -> i8 + %2 = "llvm.mlir.constant"() <{value = 23 : i8}> : () -> i8 + %3 = llvm.xor %arg22, %0 : i8 + %4 = llvm.mul %3, %1 : i8 + %5 = llvm.or %arg23, %3 : i8 + %6 = llvm.mul %5, %2 : i8 + %7 = llvm.xor %5, %0 : i8 + %8 = llvm.sdiv %7, %6 : i8 + %9 = llvm.sdiv %8, %4 : i8 + "llvm.return"(%9) : (i8) -> () +} +] +theorem demorgan_nor_use2ac_proof : demorgan_nor_use2ac_before ⊑ demorgan_nor_use2ac_after := by + unfold demorgan_nor_use2ac_before demorgan_nor_use2ac_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN demorgan_nor_use2ac + all_goals (try extract_goal ; sorry) + ---END demorgan_nor_use2ac + + + +def demorgan_nor_use2bc_before := [llvm| +{ +^0(%arg20 : i8, %arg21 : i8): + %0 = "llvm.mlir.constant"() <{value = 23 : i8}> : () -> i8 + %1 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 + %2 = llvm.mul %arg21, %0 : i8 + %3 = llvm.xor %arg20, %1 : i8 + %4 = llvm.or %3, %arg21 : i8 + %5 = llvm.mul %4, %0 : i8 + %6 = llvm.xor %4, %1 : i8 + %7 = llvm.sdiv %6, %5 : i8 + %8 = llvm.sdiv %7, %2 : i8 + "llvm.return"(%8) : (i8) -> () +} +] +def demorgan_nor_use2bc_after := [llvm| +{ +^0(%arg20 : i8, %arg21 : i8): + %0 = "llvm.mlir.constant"() <{value = 23 : i8}> : () -> i8 + %1 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 + %2 = llvm.mul %arg21, %0 : i8 + %3 = llvm.xor %arg20, %1 : i8 + %4 = llvm.or %arg21, %3 : i8 + %5 = llvm.mul %4, %0 : i8 + %6 = llvm.xor %4, %1 : i8 + %7 = llvm.sdiv %6, %5 : i8 + %8 = llvm.sdiv %7, %2 : i8 + "llvm.return"(%8) : (i8) -> () +} +] +theorem demorgan_nor_use2bc_proof : demorgan_nor_use2bc_before ⊑ demorgan_nor_use2bc_after := by + unfold demorgan_nor_use2bc_before demorgan_nor_use2bc_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN demorgan_nor_use2bc + all_goals (try extract_goal ; sorry) + ---END demorgan_nor_use2bc + + + def demorganize_constant2_before := [llvm| { ^0(%arg18 : i32): @@ -724,7 +854,7 @@ theorem demorganize_constant2_proof : demorganize_constant2_before ⊑ demorgani intros try simp ---BEGIN demorganize_constant2 - apply demorganize_constant2_thm + all_goals (try extract_goal ; sorry) ---END demorganize_constant2 @@ -757,7 +887,7 @@ theorem demorgan_plus_and_to_xor_proof : demorgan_plus_and_to_xor_before ⊑ dem intros try simp ---BEGIN demorgan_plus_and_to_xor - apply demorgan_plus_and_to_xor_thm + all_goals (try extract_goal ; sorry) ---END demorgan_plus_and_to_xor @@ -791,7 +921,7 @@ theorem PR45984_proof : PR45984_before ⊑ PR45984_after := by intros try simp ---BEGIN PR45984 - apply PR45984_thm + all_goals (try extract_goal ; sorry) ---END PR45984 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gdemorgan_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gdemorgan_proof.lean deleted file mode 100644 index 7370adb2a..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gdemorgan_proof.lean +++ /dev/null @@ -1,98 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gdemorgan_proof -theorem demorgan_or_apint1_thm (x x_1 : BitVec 43) : - x_1 ^^^ 8796093022207#43 ||| x ^^^ 8796093022207#43 = x_1 &&& x ^^^ 8796093022207#43 := sorry - -theorem demorgan_or_apint2_thm (x x_1 : BitVec 129) : - x_1 ^^^ 680564733841876926926749214863536422911#129 ||| x ^^^ 680564733841876926926749214863536422911#129 = - x_1 &&& x ^^^ 680564733841876926926749214863536422911#129 := sorry - -theorem demorgan_and_apint1_thm (x x_1 : BitVec 477) : - (x_1 ^^^ - 390218568789499028922699653724145788218574767833121393857394619953171467352470702515038262882936496394978366390175827861930996959911035663286271#477) &&& - (x ^^^ - 390218568789499028922699653724145788218574767833121393857394619953171467352470702515038262882936496394978366390175827861930996959911035663286271#477) = - (x_1 ||| x) ^^^ - 390218568789499028922699653724145788218574767833121393857394619953171467352470702515038262882936496394978366390175827861930996959911035663286271#477 := sorry - -theorem demorgan_and_apint2_thm (x x_1 : BitVec 129) : - (x_1 ^^^ 680564733841876926926749214863536422911#129) &&& (x ^^^ 680564733841876926926749214863536422911#129) = - (x_1 ||| x) ^^^ 680564733841876926926749214863536422911#129 := sorry - -theorem demorgan_and_apint3_thm (x x_1 : BitVec 65) : - (x_1 ^^^ 36893488147419103231#65) &&& (36893488147419103231#65 ^^^ x) = - (x_1 ||| x) ^^^ 36893488147419103231#65 := sorry - -theorem demorgan_and_apint4_thm (x x_1 : BitVec 66) : - (x_1 ^^^ 73786976294838206463#66) &&& (x ^^^ 73786976294838206463#66) = - (x_1 ||| x) ^^^ 73786976294838206463#66 := sorry - -theorem demorgan_and_apint5_thm (x x_1 : BitVec 47) : - (x_1 ^^^ 140737488355327#47) &&& (x ^^^ 140737488355327#47) = (x_1 ||| x) ^^^ 140737488355327#47 := sorry - -theorem test3_thm (x x_1 : BitVec 32) : - (x_1 ^^^ 4294967295#32) &&& (x ^^^ 4294967295#32) ^^^ 4294967295#32 = x_1 ||| x := sorry - -theorem test4_thm (x : BitVec 32) : (x ^^^ 4294967295#32) &&& 5#32 ^^^ 4294967295#32 = x ||| 4294967290#32 := sorry - -theorem test5_thm (x x_1 : BitVec 32) : - (x_1 ^^^ 4294967295#32 ||| x ^^^ 4294967295#32) ^^^ 4294967295#32 = x_1 &&& x := sorry - -theorem test3_apint_thm (x x_1 : BitVec 47) : - (x_1 ^^^ 140737488355327#47) &&& (x ^^^ 140737488355327#47) ^^^ 140737488355327#47 = x_1 ||| x := sorry - -theorem test4_apint_thm (x : BitVec 61) : (x ^^^ 2305843009213693951#61) &&& 5#61 = x &&& 5#61 ^^^ 5#61 := sorry - -theorem test5_apint_thm (x x_1 : BitVec 71) : - (x_1 ^^^ 2361183241434822606847#71 ||| x ^^^ 2361183241434822606847#71) ^^^ 2361183241434822606847#71 = - x_1 &&& x := sorry - -theorem demorgan_nand_thm (x x_1 : BitVec 8) : (x_1 ^^^ 255#8) &&& x ^^^ 255#8 = x ^^^ 255#8 ||| x_1 := sorry - -theorem demorgan_nand_apint1_thm (x x_1 : BitVec 7) : (x_1 ^^^ 127#7) &&& x ^^^ 127#7 = x ^^^ 127#7 ||| x_1 := sorry - -theorem demorgan_nand_apint2_thm (x x_1 : BitVec 117) : - (x_1 ^^^ 166153499473114484112975882535043071#117) &&& x ^^^ 166153499473114484112975882535043071#117 = - x ^^^ 166153499473114484112975882535043071#117 ||| x_1 := sorry - -theorem demorgan_nor_thm (x x_1 : BitVec 8) : (x_1 ^^^ 255#8 ||| x) ^^^ 255#8 = (x ^^^ 255#8) &&& x_1 := sorry - -theorem demorgan_nor_use2a_thm (x x_1 : BitVec 8) : - (if (x_1 ^^^ 255#8) * 23#8 = 0#8 ∨ (x_1 ^^^ 255#8 ||| x) ^^^ 255#8 = intMin 8 ∧ (x_1 ^^^ 255#8) * 23#8 = 255#8 then - none - else some (((x_1 ^^^ 255#8 ||| x) ^^^ 255#8).sdiv ((x_1 ^^^ 255#8) * 23#8))) ⊑ - if (x_1 ^^^ 255#8) * 23#8 = 0#8 ∨ (x ^^^ 255#8) &&& x_1 = intMin 8 ∧ (x_1 ^^^ 255#8) * 23#8 = 255#8 then none - else some (((x ^^^ 255#8) &&& x_1).sdiv ((x_1 ^^^ 255#8) * 23#8)) := sorry - -theorem demorgan_nor_use2b_thm (x x_1 : BitVec 8) : - (if x * 23#8 = 0#8 ∨ (x_1 ^^^ 255#8 ||| x) ^^^ 255#8 = intMin 8 ∧ x * 23#8 = 255#8 then none - else some (((x_1 ^^^ 255#8 ||| x) ^^^ 255#8).sdiv (x * 23#8))) ⊑ - if x * 23#8 = 0#8 ∨ (x ^^^ 255#8) &&& x_1 = intMin 8 ∧ x * 23#8 = 255#8 then none - else some (((x ^^^ 255#8) &&& x_1).sdiv (x * 23#8)) := sorry - -theorem demorgan_nor_use2ab_thm (x x_1 : BitVec 8) : - (Option.bind - (if x * 23#8 = 0#8 ∨ (x_1 ^^^ 255#8 ||| x) ^^^ 255#8 = intMin 8 ∧ x * 23#8 = 255#8 then none - else some (((x_1 ^^^ 255#8 ||| x) ^^^ 255#8).sdiv (x * 23#8))) - fun a => - if (x_1 ^^^ 255#8) * 17#8 = 0#8 ∨ a = intMin 8 ∧ (x_1 ^^^ 255#8) * 17#8 = 255#8 then none - else some (a.sdiv ((x_1 ^^^ 255#8) * 17#8))) ⊑ - Option.bind - (if x * 23#8 = 0#8 ∨ (x ^^^ 255#8) &&& x_1 = intMin 8 ∧ x * 23#8 = 255#8 then none - else some (((x ^^^ 255#8) &&& x_1).sdiv (x * 23#8))) - fun a => - if (x_1 ^^^ 255#8) * 17#8 = 0#8 ∨ a = intMin 8 ∧ (x_1 ^^^ 255#8) * 17#8 = 255#8 then none - else some (a.sdiv ((x_1 ^^^ 255#8) * 17#8)) := sorry - -theorem demorganize_constant2_thm (x : BitVec 32) : (x ||| 15#32) ^^^ 4294967295#32 = x &&& 4294967280#32 ^^^ 4294967280#32 := sorry - -theorem demorgan_plus_and_to_xor_thm (x x_1 : BitVec 32) : - (x_1 &&& x ||| (x_1 ||| x) ^^^ 4294967295#32) ^^^ 4294967295#32 = x_1 ^^^ x := sorry - -theorem PR45984_thm (x x_1 : BitVec 32) : - x_1 ^^^ x ||| (x_1 ||| x) ^^^ 4294967295#32 = x_1 &&& x ^^^ 4294967295#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gdistribute.lean b/SSA/Projects/InstCombine/tests/LLVM/gdistribute.lean index 58cec6573..5e00a1bc6 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gdistribute.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gdistribute.lean @@ -88,7 +88,7 @@ def factorize3_before := [llvm| def factorize3_after := [llvm| { ^0(%arg5 : i32, %arg6 : i32, %arg7 : i32): - %0 = llvm.or %arg7, %arg5 : i32 + %0 = llvm.or %arg5, %arg7 : i32 "llvm.return"(%0) : (i32) -> () } ] diff --git a/SSA/Projects/InstCombine/tests/LLVM/gdistribute_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gdistribute_proof.lean index 386496cae..fad79d673 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gdistribute_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gdistribute_proof.lean @@ -8,7 +8,7 @@ theorem factorize_thm (x : BitVec 32) : (x ||| 1#32) &&& (x ||| 2#32) = x := sor theorem factorize2_thm (x : BitVec 32) : 3#32 * x - 2#32 * x = x := sorry -theorem factorize3_thm (x x_1 x_2 : BitVec 32) : (x_2 ||| (x_1 ||| x)) &&& (x_2 ||| x) = x ||| x_2 := sorry +theorem factorize3_thm (x x_1 x_2 : BitVec 32) : (x_2 ||| (x_1 ||| x)) &&& (x_2 ||| x) = x_2 ||| x := sorry theorem factorize4_thm (x x_1 : BitVec 32) : x_1 <<< 1 * x - x * x_1 = x_1 * x := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gdivhi1.lean b/SSA/Projects/InstCombine/tests/LLVM/gdivhi1.lean index cb0bcc1f8..edd63edf7 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gdivhi1.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gdivhi1.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gdivhi1_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -12,7 +12,7 @@ set_option linter.deprecated false set_option linter.unreachableTactic false set_option linter.unusedTactic false section gdivhi1_statements - + def sdiv_i1_is_op0_before := [llvm| { ^0(%arg6 : i1, %arg7 : i1): @@ -35,7 +35,7 @@ theorem sdiv_i1_is_op0_proof : sdiv_i1_is_op0_before ⊑ sdiv_i1_is_op0_after := intros try simp ---BEGIN sdiv_i1_is_op0 - apply sdiv_i1_is_op0_thm + all_goals (try extract_goal ; sorry) ---END sdiv_i1_is_op0 @@ -50,7 +50,7 @@ def srem_i1_is_zero_before := [llvm| def srem_i1_is_zero_after := [llvm| { ^0(%arg2 : i1, %arg3 : i1): - %0 = "llvm.mlir.constant"() <{value = 0 : i1}> : () -> i1 + %0 = "llvm.mlir.constant"() <{value = false}> : () -> i1 "llvm.return"(%0) : (i1) -> () } ] @@ -78,7 +78,7 @@ def urem_i1_is_zero_before := [llvm| def urem_i1_is_zero_after := [llvm| { ^0(%arg0 : i1, %arg1 : i1): - %0 = "llvm.mlir.constant"() <{value = 0 : i1}> : () -> i1 + %0 = "llvm.mlir.constant"() <{value = false}> : () -> i1 "llvm.return"(%0) : (i1) -> () } ] @@ -93,3 +93,5 @@ theorem urem_i1_is_zero_proof : urem_i1_is_zero_before ⊑ urem_i1_is_zero_after ---BEGIN urem_i1_is_zero all_goals (try extract_goal ; sorry) ---END urem_i1_is_zero + + diff --git a/SSA/Projects/InstCombine/tests/LLVM/gdivhi1_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gdivhi1_proof.lean deleted file mode 100644 index cc7ed5f05..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gdivhi1_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gdivhi1_proof -theorem sdiv_i1_is_op0_thm (x x_1 : BitVec 1) : (if x = 0#1 then none else some (x_1.sdiv x)) ⊑ some x_1 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gdivhshift.lean b/SSA/Projects/InstCombine/tests/LLVM/gdivhshift.lean index bfac8b515..f04dd8926 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gdivhshift.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gdivhshift.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gdivhshift_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -38,7 +38,7 @@ theorem t7_proof : t7_before ⊑ t7_after := by intros try simp ---BEGIN t7 - apply t7_thm + all_goals (try extract_goal ; sorry) ---END t7 @@ -68,7 +68,7 @@ theorem t10_proof : t10_before ⊑ t10_after := by intros try simp ---BEGIN t10 - apply t10_thm + all_goals (try extract_goal ; sorry) ---END t10 @@ -100,7 +100,7 @@ theorem sdiv_mul_shl_nsw_proof : sdiv_mul_shl_nsw_before ⊑ sdiv_mul_shl_nsw_af intros try simp ---BEGIN sdiv_mul_shl_nsw - apply sdiv_mul_shl_nsw_thm + all_goals (try extract_goal ; sorry) ---END sdiv_mul_shl_nsw @@ -132,7 +132,7 @@ theorem sdiv_mul_shl_nsw_exact_commute1_proof : sdiv_mul_shl_nsw_exact_commute1_ intros try simp ---BEGIN sdiv_mul_shl_nsw_exact_commute1 - apply sdiv_mul_shl_nsw_exact_commute1_thm + all_goals (try extract_goal ; sorry) ---END sdiv_mul_shl_nsw_exact_commute1 @@ -162,7 +162,7 @@ theorem sdiv_shl_shl_nsw2_nuw_proof : sdiv_shl_shl_nsw2_nuw_before ⊑ sdiv_shl_ intros try simp ---BEGIN sdiv_shl_shl_nsw2_nuw - apply sdiv_shl_shl_nsw2_nuw_thm + all_goals (try extract_goal ; sorry) ---END sdiv_shl_shl_nsw2_nuw @@ -194,7 +194,7 @@ theorem sdiv_shl_pair_const_proof : sdiv_shl_pair_const_before ⊑ sdiv_shl_pair intros try simp ---BEGIN sdiv_shl_pair_const - apply sdiv_shl_pair_const_thm + all_goals (try extract_goal ; sorry) ---END sdiv_shl_pair_const @@ -226,7 +226,7 @@ theorem sdiv_shl_pair1_proof : sdiv_shl_pair1_before ⊑ sdiv_shl_pair1_after := intros try simp ---BEGIN sdiv_shl_pair1 - apply sdiv_shl_pair1_thm + all_goals (try extract_goal ; sorry) ---END sdiv_shl_pair1 @@ -258,7 +258,7 @@ theorem sdiv_shl_pair2_proof : sdiv_shl_pair2_before ⊑ sdiv_shl_pair2_after := intros try simp ---BEGIN sdiv_shl_pair2 - apply sdiv_shl_pair2_thm + all_goals (try extract_goal ; sorry) ---END sdiv_shl_pair2 @@ -290,7 +290,7 @@ theorem sdiv_shl_pair3_proof : sdiv_shl_pair3_before ⊑ sdiv_shl_pair3_after := intros try simp ---BEGIN sdiv_shl_pair3 - apply sdiv_shl_pair3_thm + all_goals (try extract_goal ; sorry) ---END sdiv_shl_pair3 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gdivhshift_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gdivhshift_proof.lean deleted file mode 100644 index 1ac184820..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gdivhshift_proof.lean +++ /dev/null @@ -1,57 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gdivhshift_proof -theorem t7_thm (x : BitVec 32) : - (if x = 0#32 ∨ x <<< 2 = intMin 32 ∧ x = 4294967295#32 then none else some ((x <<< 2).sdiv x)) ⊑ some 4#32 := sorry - -theorem t10_thm (x x_1 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if x_1 = 0#32 ∨ a = intMin 32 ∧ x_1 = 4294967295#32 then none else some (a.sdiv x_1)) ⊑ - if 32 ≤ x.toNat then none else some (1#32 <<< x.toNat) := sorry - -theorem sdiv_mul_shl_nsw_thm (x x_1 x_2 : BitVec 5) : - (Option.bind (if 5 ≤ x.toNat then none else some (x_2 <<< x.toNat)) fun a => - if a = 0#5 ∨ x_2 * x_1 = intMin 5 ∧ a = 31#5 then none else some ((x_2 * x_1).sdiv a)) ⊑ - Option.bind (if 5 ≤ x.toNat then none else some (1#5 <<< x.toNat)) fun a => - if a = 0#5 ∨ x_1 = intMin 5 ∧ a = 31#5 then none else some (x_1.sdiv a) := sorry - -theorem sdiv_mul_shl_nsw_exact_commute1_thm (x x_1 x_2 : BitVec 5) : - (Option.bind (if 5 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if a = 0#5 ∨ x_2 * x_1 = intMin 5 ∧ a = 31#5 then none else some ((x_2 * x_1).sdiv a)) ⊑ - Option.bind (if 5 ≤ x.toNat then none else some (1#5 <<< x.toNat)) fun a => - if a = 0#5 ∨ x_2 = intMin 5 ∧ a = 31#5 then none else some (x_2.sdiv a) := sorry - -theorem sdiv_shl_shl_nsw2_nuw_thm (x x_1 x_2 : BitVec 8) : - (Option.bind (if 8 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - Option.bind (if 8 ≤ x_1.toNat then none else some (x <<< x_1.toNat)) fun a_1 => - if a_1 = 0#8 ∨ a = intMin 8 ∧ a_1 = 255#8 then none else some (a.sdiv a_1)) ⊑ - if x = 0#8 ∨ x_2 = intMin 8 ∧ x = 255#8 then none else some (x_2.sdiv x) := sorry - -theorem sdiv_shl_pair_const_thm (x : BitVec 32) : - (if x <<< 1 = 0#32 ∨ x <<< 2 = intMin 32 ∧ x <<< 1 = 4294967295#32 then none else some ((x <<< 2).sdiv (x <<< 1))) ⊑ - some 2#32 := sorry - -theorem sdiv_shl_pair1_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - Option.bind (if 32 ≤ x.toNat then none else some (x_2 <<< x.toNat)) fun a_1 => - if a_1 = 0#32 ∨ a = intMin 32 ∧ a_1 = 4294967295#32 then none else some (a.sdiv a_1)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (1#32 <<< x_1.toNat)) fun a => - if 32 ≤ x.toNat then none else some (a >>> x.toNat) := sorry - -theorem sdiv_shl_pair2_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - Option.bind (if 32 ≤ x.toNat then none else some (x_2 <<< x.toNat)) fun a_1 => - if a_1 = 0#32 ∨ a = intMin 32 ∧ a_1 = 4294967295#32 then none else some (a.sdiv a_1)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (1#32 <<< x_1.toNat)) fun a => - if 32 ≤ x.toNat then none else some (a >>> x.toNat) := sorry - -theorem sdiv_shl_pair3_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - Option.bind (if 32 ≤ x.toNat then none else some (x_2 <<< x.toNat)) fun a_1 => - if a_1 = 0#32 ∨ a = intMin 32 ∧ a_1 = 4294967295#32 then none else some (a.sdiv a_1)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (1#32 <<< x_1.toNat)) fun a => - if 32 ≤ x.toNat then none else some (a >>> x.toNat) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gfoldhinchofhaddhofhnothxhandhyhtohsubhxhfromhy.lean b/SSA/Projects/InstCombine/tests/LLVM/gfoldhinchofhaddhofhnothxhandhyhtohsubhxhfromhy.lean index bd2c6ed71..7920ca76a 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gfoldhinchofhaddhofhnothxhandhyhtohsubhxhfromhy.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gfoldhinchofhaddhofhnothxhandhyhtohsubhxhfromhy.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gfoldhinchofhaddhofhnothxhandhyhtohsubhxhfromhy_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -40,7 +40,43 @@ theorem t0_proof : t0_before ⊑ t0_after := by intros try simp ---BEGIN t0 - apply t0_thm + all_goals (try extract_goal ; sorry) ---END t0 + +def n12_before := [llvm| +{ +^0(%arg0 : i32, %arg1 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 + %2 = llvm.xor %arg0, %0 : i32 + %3 = llvm.add %2, %arg1 : i32 + %4 = llvm.add %3, %1 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +def n12_after := [llvm| +{ +^0(%arg0 : i32, %arg1 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 + %2 = llvm.xor %arg0, %0 : i32 + %3 = llvm.add %arg1, %2 : i32 + %4 = llvm.add %3, %1 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem n12_proof : n12_before ⊑ n12_after := by + unfold n12_before n12_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN n12 + all_goals (try extract_goal ; sorry) + ---END n12 + + diff --git a/SSA/Projects/InstCombine/tests/LLVM/gfoldhinchofhaddhofhnothxhandhyhtohsubhxhfromhy_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gfoldhinchofhaddhofhnothxhandhyhtohsubhxhfromhy_proof.lean deleted file mode 100644 index 35d01b264..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gfoldhinchofhaddhofhnothxhandhyhtohsubhxhfromhy_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gfoldhinchofhaddhofhnothxhandhyhtohsubhxhfromhy_proof -theorem t0_thm (x x_1 : BitVec 32) : (x_1 ^^^ 4294967295#32) + x + 1#32 = x - x_1 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gfoldhsubhofhnothtohinchofhadd.lean b/SSA/Projects/InstCombine/tests/LLVM/gfoldhsubhofhnothtohinchofhadd.lean index 875549d8e..2dd5871f2 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gfoldhsubhofhnothtohinchofhadd.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gfoldhsubhofhnothtohinchofhadd.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gfoldhsubhofhnothtohinchofhadd_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -40,7 +40,7 @@ theorem p0_scalar_proof : p0_scalar_before ⊑ p0_scalar_after := by intros try simp ---BEGIN p0_scalar - apply p0_scalar_thm + all_goals (try extract_goal ; sorry) ---END p0_scalar diff --git a/SSA/Projects/InstCombine/tests/LLVM/gfoldhsubhofhnothtohinchofhadd_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gfoldhsubhofhnothtohinchofhadd_proof.lean deleted file mode 100644 index fd9e11c7e..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gfoldhsubhofhnothtohinchofhadd_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gfoldhsubhofhnothtohinchofhadd_proof -theorem p0_scalar_thm (x x_1 : BitVec 32) : x_1 - (x ^^^ 4294967295#32) = x + 1#32 + x_1 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gfreehinversion.lean b/SSA/Projects/InstCombine/tests/LLVM/gfreehinversion.lean index f801a3170..447b24d50 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gfreehinversion.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gfreehinversion.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gfreehinversion_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -43,7 +43,7 @@ theorem lshr_not_nneg2_proof : lshr_not_nneg2_before ⊑ lshr_not_nneg2_after := intros try simp ---BEGIN lshr_not_nneg2 - apply lshr_not_nneg2_thm + all_goals (try extract_goal ; sorry) ---END lshr_not_nneg2 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gfreehinversion_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gfreehinversion_proof.lean deleted file mode 100644 index e58425eb1..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gfreehinversion_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gfreehinversion_proof -theorem lshr_not_nneg2_thm (x : BitVec 8) : (x ^^^ 255#8) >>> 1 ^^^ 255#8 = x >>> 1 ||| 128#8 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/ghoisthnegationhouthofhbiashcalculation.lean b/SSA/Projects/InstCombine/tests/LLVM/ghoisthnegationhouthofhbiashcalculation.lean index a588d6d66..c85ad2b37 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/ghoisthnegationhouthofhbiashcalculation.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/ghoisthnegationhouthofhbiashcalculation.lean @@ -29,7 +29,7 @@ def t0_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 %2 = llvm.add %arg19, %0 : i8 - %3 = llvm.and %2, %arg18 : i8 + %3 = llvm.and %arg18, %2 : i8 %4 = llvm.sub %1, %3 : i8 "llvm.return"(%4) : (i8) -> () } @@ -63,7 +63,7 @@ def n7_after := [llvm| ^0(%arg5 : i8, %arg6 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.add %arg6, %0 : i8 - %2 = llvm.and %1, %arg5 : i8 + %2 = llvm.and %arg5, %1 : i8 "llvm.return"(%2) : (i8) -> () } ] @@ -80,37 +80,3 @@ theorem n7_proof : n7_before ⊑ n7_after := by ---END n7 - -def n9_before := [llvm| -{ -^0(%arg0 : i8, %arg1 : i8, %arg2 : i8): - %0 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 - %1 = llvm.sub %0, %arg2 : i8 - %2 = llvm.and %arg1, %1 : i8 - %3 = llvm.sub %2, %arg0 : i8 - "llvm.return"(%3) : (i8) -> () -} -] -def n9_after := [llvm| -{ -^0(%arg0 : i8, %arg1 : i8, %arg2 : i8): - %0 = "llvm.mlir.constant"() <{value = 0 : i8}> : () -> i8 - %1 = llvm.sub %0, %arg2 : i8 - %2 = llvm.and %1, %arg1 : i8 - %3 = llvm.sub %2, %arg0 : i8 - "llvm.return"(%3) : (i8) -> () -} -] -theorem n9_proof : n9_before ⊑ n9_after := by - unfold n9_before n9_after - simp_alive_peephole - simp_alive_undef - simp_alive_ops - simp_alive_case_bash - intros - try simp - ---BEGIN n9 - apply n9_thm - ---END n9 - - diff --git a/SSA/Projects/InstCombine/tests/LLVM/ghoisthnegationhouthofhbiashcalculation_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/ghoisthnegationhouthofhbiashcalculation_proof.lean index 46f17517c..05c1ce61a 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/ghoisthnegationhouthofhbiashcalculation_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/ghoisthnegationhouthofhbiashcalculation_proof.lean @@ -4,9 +4,7 @@ import SSA.Projects.InstCombine.LLVM.Semantics open BitVec section ghoisthnegationhouthofhbiashcalculation_proof -theorem t0_thm (x x_1 : BitVec 8) : (-x_1 &&& x) - x = -(x_1 + 255#8 &&& x) := sorry +theorem t0_thm (x x_1 : BitVec 8) : (-x_1 &&& x) - x = -(x &&& x_1 + 255#8) := sorry -theorem n7_thm (x x_1 : BitVec 8) : x_1 - (-x &&& x_1) = x + 255#8 &&& x_1 := sorry - -theorem n9_thm (x x_1 : BitVec 8) : x_1 &&& -x = -x &&& x_1 := sorry +theorem n7_thm (x x_1 : BitVec 8) : x_1 - (-x &&& x_1) = x_1 &&& x + 255#8 := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gicmphmul.lean b/SSA/Projects/InstCombine/tests/LLVM/gicmphmul.lean index 0e9bb02c5..f22351a08 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gicmphmul.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gicmphmul.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gicmphmul_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -15,12 +15,12 @@ section gicmphmul_statements def mul_of_pow2s_before := [llvm| { -^0(%arg43 : i32, %arg44 : i32): +^0(%arg79 : i32, %arg80 : i32): %0 = "llvm.mlir.constant"() <{value = 8 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 16 : i32}> : () -> i32 %2 = "llvm.mlir.constant"() <{value = 128 : i32}> : () -> i32 - %3 = llvm.and %arg43, %0 : i32 - %4 = llvm.and %arg44, %1 : i32 + %3 = llvm.and %arg79, %0 : i32 + %4 = llvm.and %arg80, %1 : i32 %5 = llvm.mul %3, %4 : i32 %6 = llvm.or %5, %2 : i32 "llvm.return"(%6) : (i32) -> () @@ -28,7 +28,7 @@ def mul_of_pow2s_before := [llvm| ] def mul_of_pow2s_after := [llvm| { -^0(%arg43 : i32, %arg44 : i32): +^0(%arg79 : i32, %arg80 : i32): %0 = "llvm.mlir.constant"() <{value = 128 : i32}> : () -> i32 "llvm.return"(%0) : (i32) -> () } @@ -42,7 +42,7 @@ theorem mul_of_pow2s_proof : mul_of_pow2s_before ⊑ mul_of_pow2s_after := by intros try simp ---BEGIN mul_of_pow2s - apply mul_of_pow2s_thm + all_goals (try extract_goal ; sorry) ---END mul_of_pow2s diff --git a/SSA/Projects/InstCombine/tests/LLVM/gicmphmul_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gicmphmul_proof.lean deleted file mode 100644 index 232e6e4e4..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gicmphmul_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gicmphmul_proof -theorem mul_of_pow2s_thm (x x_1 : BitVec 32) : (x_1 &&& 8#32) * (x &&& 16#32) ||| 128#32 = 128#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gicmphmulhand.lean b/SSA/Projects/InstCombine/tests/LLVM/gicmphmulhand.lean index 4139fb3b6..cae22db1e 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gicmphmulhand.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gicmphmulhand.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gicmphmulhand_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -42,7 +42,7 @@ theorem pr40493_neg3_proof : pr40493_neg3_before ⊑ pr40493_neg3_after := by intros try simp ---BEGIN pr40493_neg3 - apply pr40493_neg3_thm + all_goals (try extract_goal ; sorry) ---END pr40493_neg3 @@ -77,7 +77,7 @@ theorem pr51551_demand3bits_proof : pr51551_demand3bits_before ⊑ pr51551_deman intros try simp ---BEGIN pr51551_demand3bits - apply pr51551_demand3bits_thm + all_goals (try extract_goal ; sorry) ---END pr51551_demand3bits diff --git a/SSA/Projects/InstCombine/tests/LLVM/gicmphmulhand_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gicmphmulhand_proof.lean deleted file mode 100644 index bdcd0103e..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gicmphmulhand_proof.lean +++ /dev/null @@ -1,10 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gicmphmulhand_proof -theorem pr40493_neg3_thm (x : BitVec 32) : x * 12#32 &&& 4#32 = x <<< 2 &&& 4#32 := sorry - -theorem pr51551_demand3bits_thm (x x_1 : BitVec 32) : (x_1 &&& 4294967289#32 ||| 1#32) * x &&& 7#32 = x &&& 7#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/ginverthvariablehmaskhinhmaskedhmergehscalar.lean b/SSA/Projects/InstCombine/tests/LLVM/ginverthvariablehmaskhinhmaskedhmergehscalar.lean index 6d72f33c9..966dd8fcb 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/ginverthvariablehmaskhinhmaskedhmergehscalar.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/ginverthvariablehmaskhinhmaskedhmergehscalar.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.ginverthvariablehmaskhinhmaskedhmergehscalar_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -42,7 +42,7 @@ theorem scalar_proof : scalar_before ⊑ scalar_after := by intros try simp ---BEGIN scalar - apply scalar_thm + all_goals (try extract_goal ; sorry) ---END scalar @@ -74,7 +74,7 @@ theorem in_constant_varx_mone_invmask_proof : in_constant_varx_mone_invmask_befo intros try simp ---BEGIN in_constant_varx_mone_invmask - apply in_constant_varx_mone_invmask_thm + all_goals (try extract_goal ; sorry) ---END in_constant_varx_mone_invmask @@ -110,7 +110,7 @@ theorem in_constant_varx_6_invmask_proof : in_constant_varx_6_invmask_before ⊑ intros try simp ---BEGIN in_constant_varx_6_invmask - apply in_constant_varx_6_invmask_thm + all_goals (try extract_goal ; sorry) ---END in_constant_varx_6_invmask @@ -131,7 +131,7 @@ def in_constant_mone_vary_invmask_after := [llvm| ^0(%arg37 : i4, %arg38 : i4): %0 = "llvm.mlir.constant"() <{value = -1 : i4}> : () -> i4 %1 = llvm.xor %arg38, %0 : i4 - %2 = llvm.or %1, %arg37 : i4 + %2 = llvm.or %arg37, %1 : i4 "llvm.return"(%2) : (i4) -> () } ] @@ -144,7 +144,7 @@ theorem in_constant_mone_vary_invmask_proof : in_constant_mone_vary_invmask_befo intros try simp ---BEGIN in_constant_mone_vary_invmask - apply in_constant_mone_vary_invmask_thm + all_goals (try extract_goal ; sorry) ---END in_constant_mone_vary_invmask @@ -180,7 +180,7 @@ theorem in_constant_6_vary_invmask_proof : in_constant_6_vary_invmask_before ⊑ intros try simp ---BEGIN in_constant_6_vary_invmask - apply in_constant_6_vary_invmask_thm + all_goals (try extract_goal ; sorry) ---END in_constant_6_vary_invmask @@ -214,7 +214,7 @@ theorem c_1_0_0_proof : c_1_0_0_before ⊑ c_1_0_0_after := by intros try simp ---BEGIN c_1_0_0 - apply c_1_0_0_thm + all_goals (try extract_goal ; sorry) ---END c_1_0_0 @@ -248,7 +248,7 @@ theorem c_0_1_0_proof : c_0_1_0_before ⊑ c_0_1_0_after := by intros try simp ---BEGIN c_0_1_0 - apply c_0_1_0_thm + all_goals (try extract_goal ; sorry) ---END c_0_1_0 @@ -282,7 +282,7 @@ theorem c_1_1_0_proof : c_1_1_0_before ⊑ c_1_1_0_after := by intros try simp ---BEGIN c_1_1_0 - apply c_1_1_0_thm + all_goals (try extract_goal ; sorry) ---END c_1_1_0 @@ -318,7 +318,7 @@ theorem commutativity_constant_varx_6_invmask_proof : commutativity_constant_var intros try simp ---BEGIN commutativity_constant_varx_6_invmask - apply commutativity_constant_varx_6_invmask_thm + all_goals (try extract_goal ; sorry) ---END commutativity_constant_varx_6_invmask @@ -354,7 +354,7 @@ theorem commutativity_constant_6_vary_invmask_proof : commutativity_constant_6_v intros try simp ---BEGIN commutativity_constant_6_vary_invmask - apply commutativity_constant_6_vary_invmask_thm + all_goals (try extract_goal ; sorry) ---END commutativity_constant_6_vary_invmask diff --git a/SSA/Projects/InstCombine/tests/LLVM/ginverthvariablehmaskhinhmaskedhmergehscalar_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/ginverthvariablehmaskhinhmaskedhmergehscalar_proof.lean deleted file mode 100644 index 50c1c250e..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/ginverthvariablehmaskhinhmaskedhmergehscalar_proof.lean +++ /dev/null @@ -1,30 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section ginverthvariablehmaskhinhmaskedhmergehscalar_proof -theorem scalar_thm (x x_1 x_2 : BitVec 4) : - (x_2 ^^^ x_1) &&& (x ^^^ 15#4) ^^^ x_1 = (x_2 ^^^ x_1) &&& x ^^^ x_2 := sorry - -theorem in_constant_varx_mone_invmask_thm (x x_1 : BitVec 4) : (x_1 ^^^ 15#4) &&& (x ^^^ 15#4) ^^^ 15#4 = x_1 ||| x := sorry - -theorem in_constant_varx_6_invmask_thm (x x_1 : BitVec 4) : (x_1 ^^^ 6#4) &&& (x ^^^ 15#4) ^^^ 6#4 = (x_1 ^^^ 6#4) &&& x ^^^ x_1 := sorry - -theorem in_constant_mone_vary_invmask_thm (x x_1 : BitVec 4) : (15#4 ^^^ x_1) &&& (x ^^^ 15#4) ^^^ x_1 = x ^^^ 15#4 ||| x_1 := sorry - -theorem in_constant_6_vary_invmask_thm (x x_1 : BitVec 4) : (x_1 ^^^ 6#4) &&& (x ^^^ 15#4) ^^^ x_1 = (x_1 ^^^ 6#4) &&& x ^^^ 6#4 := sorry - -theorem c_1_0_0_thm (x x_1 x_2 : BitVec 4) : - (x_2 ^^^ x_1) &&& (x ^^^ 15#4) ^^^ x_2 = (x_2 ^^^ x_1) &&& x ^^^ x_1 := sorry - -theorem c_0_1_0_thm (x x_1 x_2 : BitVec 4) : - (x_2 ^^^ x_1) &&& (x ^^^ 15#4) ^^^ x_2 = (x_2 ^^^ x_1) &&& x ^^^ x_1 := sorry - -theorem c_1_1_0_thm (x x_1 x_2 : BitVec 4) : - (x_2 ^^^ x_1) &&& (x ^^^ 15#4) ^^^ x_1 = (x_2 ^^^ x_1) &&& x ^^^ x_2 := sorry - -theorem commutativity_constant_varx_6_invmask_thm (x x_1 : BitVec 4) : (x_1 ^^^ 15#4) &&& (x ^^^ 6#4) ^^^ 6#4 = (x ^^^ 6#4) &&& x_1 ^^^ x := sorry - -theorem commutativity_constant_6_vary_invmask_thm (x x_1 : BitVec 4) : (x_1 ^^^ 15#4) &&& (x ^^^ 6#4) ^^^ x = (x ^^^ 6#4) &&& x_1 ^^^ 6#4 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/glowhbithsplat.lean b/SSA/Projects/InstCombine/tests/LLVM/glowhbithsplat.lean index cbd01373d..bb83eadc1 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/glowhbithsplat.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/glowhbithsplat.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.glowhbithsplat_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -41,7 +41,7 @@ theorem t0_proof : t0_before ⊑ t0_after := by intros try simp ---BEGIN t0 - apply t0_thm + all_goals (try extract_goal ; sorry) ---END t0 @@ -74,7 +74,7 @@ theorem t1_otherbitwidth_proof : t1_otherbitwidth_before ⊑ t1_otherbitwidth_af intros try simp ---BEGIN t1_otherbitwidth - apply t1_otherbitwidth_thm + all_goals (try extract_goal ; sorry) ---END t1_otherbitwidth diff --git a/SSA/Projects/InstCombine/tests/LLVM/glowhbithsplat_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/glowhbithsplat_proof.lean deleted file mode 100644 index cd83a5cba..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/glowhbithsplat_proof.lean +++ /dev/null @@ -1,10 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section glowhbithsplat_proof -theorem t0_thm (x : BitVec 8) : (x <<< 7).sshiftRight 7 = -(x &&& 1#8) := sorry - -theorem t1_otherbitwidth_thm (x : BitVec 16) : (x <<< 15).sshiftRight 15 = -(x &&& 1#16) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/glshr.lean b/SSA/Projects/InstCombine/tests/LLVM/glshr.lean index 23821d195..bdbbd40d8 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/glshr.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/glshr.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.glshr_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -43,7 +43,7 @@ theorem lshr_exact_proof : lshr_exact_before ⊑ lshr_exact_after := by intros try simp ---BEGIN lshr_exact - apply lshr_exact_thm + all_goals (try extract_goal ; sorry) ---END lshr_exact @@ -78,7 +78,7 @@ theorem shl_add_proof : shl_add_before ⊑ shl_add_after := by intros try simp ---BEGIN shl_add - apply shl_add_thm + all_goals (try extract_goal ; sorry) ---END shl_add @@ -108,7 +108,7 @@ theorem mul_splat_fold_proof : mul_splat_fold_before ⊑ mul_splat_fold_after := intros try simp ---BEGIN mul_splat_fold - apply mul_splat_fold_thm + all_goals (try extract_goal ; sorry) ---END mul_splat_fold @@ -139,7 +139,7 @@ theorem shl_add_lshr_flag_preservation_proof : shl_add_lshr_flag_preservation_be intros try simp ---BEGIN shl_add_lshr_flag_preservation - apply shl_add_lshr_flag_preservation_thm + all_goals (try extract_goal ; sorry) ---END shl_add_lshr_flag_preservation @@ -170,7 +170,7 @@ theorem shl_add_lshr_proof : shl_add_lshr_before ⊑ shl_add_lshr_after := by intros try simp ---BEGIN shl_add_lshr - apply shl_add_lshr_thm + all_goals (try extract_goal ; sorry) ---END shl_add_lshr @@ -203,7 +203,7 @@ theorem shl_add_lshr_comm_proof : shl_add_lshr_comm_before ⊑ shl_add_lshr_comm intros try simp ---BEGIN shl_add_lshr_comm - apply shl_add_lshr_comm_thm + all_goals (try extract_goal ; sorry) ---END shl_add_lshr_comm @@ -234,7 +234,7 @@ theorem shl_sub_lshr_proof : shl_sub_lshr_before ⊑ shl_sub_lshr_after := by intros try simp ---BEGIN shl_sub_lshr - apply shl_sub_lshr_thm + all_goals (try extract_goal ; sorry) ---END shl_sub_lshr @@ -265,7 +265,7 @@ theorem shl_sub_lshr_reverse_proof : shl_sub_lshr_reverse_before ⊑ shl_sub_lsh intros try simp ---BEGIN shl_sub_lshr_reverse - apply shl_sub_lshr_reverse_thm + all_goals (try extract_goal ; sorry) ---END shl_sub_lshr_reverse @@ -296,7 +296,7 @@ theorem shl_sub_lshr_reverse_no_nsw_proof : shl_sub_lshr_reverse_no_nsw_before intros try simp ---BEGIN shl_sub_lshr_reverse_no_nsw - apply shl_sub_lshr_reverse_no_nsw_thm + all_goals (try extract_goal ; sorry) ---END shl_sub_lshr_reverse_no_nsw @@ -327,7 +327,7 @@ theorem shl_sub_lshr_reverse_nsw_on_op1_proof : shl_sub_lshr_reverse_nsw_on_op1_ intros try simp ---BEGIN shl_sub_lshr_reverse_nsw_on_op1 - apply shl_sub_lshr_reverse_nsw_on_op1_thm + all_goals (try extract_goal ; sorry) ---END shl_sub_lshr_reverse_nsw_on_op1 @@ -358,7 +358,7 @@ theorem shl_or_lshr_proof : shl_or_lshr_before ⊑ shl_or_lshr_after := by intros try simp ---BEGIN shl_or_lshr - apply shl_or_lshr_thm + all_goals (try extract_goal ; sorry) ---END shl_or_lshr @@ -389,7 +389,7 @@ theorem shl_or_disjoint_lshr_proof : shl_or_disjoint_lshr_before ⊑ shl_or_disj intros try simp ---BEGIN shl_or_disjoint_lshr - apply shl_or_disjoint_lshr_thm + all_goals (try extract_goal ; sorry) ---END shl_or_disjoint_lshr @@ -420,7 +420,7 @@ theorem shl_or_lshr_comm_proof : shl_or_lshr_comm_before ⊑ shl_or_lshr_comm_af intros try simp ---BEGIN shl_or_lshr_comm - apply shl_or_lshr_comm_thm + all_goals (try extract_goal ; sorry) ---END shl_or_lshr_comm @@ -451,7 +451,7 @@ theorem shl_or_disjoint_lshr_comm_proof : shl_or_disjoint_lshr_comm_before ⊑ s intros try simp ---BEGIN shl_or_disjoint_lshr_comm - apply shl_or_disjoint_lshr_comm_thm + all_goals (try extract_goal ; sorry) ---END shl_or_disjoint_lshr_comm @@ -482,7 +482,7 @@ theorem shl_xor_lshr_proof : shl_xor_lshr_before ⊑ shl_xor_lshr_after := by intros try simp ---BEGIN shl_xor_lshr - apply shl_xor_lshr_thm + all_goals (try extract_goal ; sorry) ---END shl_xor_lshr @@ -513,7 +513,7 @@ theorem shl_xor_lshr_comm_proof : shl_xor_lshr_comm_before ⊑ shl_xor_lshr_comm intros try simp ---BEGIN shl_xor_lshr_comm - apply shl_xor_lshr_comm_thm + all_goals (try extract_goal ; sorry) ---END shl_xor_lshr_comm @@ -544,7 +544,7 @@ theorem shl_and_lshr_proof : shl_and_lshr_before ⊑ shl_and_lshr_after := by intros try simp ---BEGIN shl_and_lshr - apply shl_and_lshr_thm + all_goals (try extract_goal ; sorry) ---END shl_and_lshr @@ -575,7 +575,7 @@ theorem shl_and_lshr_comm_proof : shl_and_lshr_comm_before ⊑ shl_and_lshr_comm intros try simp ---BEGIN shl_and_lshr_comm - apply shl_and_lshr_comm_thm + all_goals (try extract_goal ; sorry) ---END shl_and_lshr_comm @@ -606,7 +606,7 @@ theorem shl_lshr_and_exact_proof : shl_lshr_and_exact_before ⊑ shl_lshr_and_ex intros try simp ---BEGIN shl_lshr_and_exact - apply shl_lshr_and_exact_thm + all_goals (try extract_goal ; sorry) ---END shl_lshr_and_exact @@ -626,7 +626,7 @@ def mul_splat_fold_no_nuw_after := [llvm| ^0(%arg79 : i32): %0 = "llvm.mlir.constant"() <{value = 16 : i32}> : () -> i32 %1 = llvm.lshr %arg79, %0 : i32 - %2 = llvm.add %1, %arg79 : i32 + %2 = llvm.add %arg79, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -639,7 +639,7 @@ theorem mul_splat_fold_no_nuw_proof : mul_splat_fold_no_nuw_before ⊑ mul_splat intros try simp ---BEGIN mul_splat_fold_no_nuw - apply mul_splat_fold_no_nuw_thm + all_goals (try extract_goal ; sorry) ---END mul_splat_fold_no_nuw @@ -669,7 +669,7 @@ theorem mul_splat_fold_too_narrow_proof : mul_splat_fold_too_narrow_before ⊑ m intros try simp ---BEGIN mul_splat_fold_too_narrow - apply mul_splat_fold_too_narrow_thm + all_goals (try extract_goal ; sorry) ---END mul_splat_fold_too_narrow @@ -702,7 +702,7 @@ theorem negative_and_odd_proof : negative_and_odd_before ⊑ negative_and_odd_af intros try simp ---BEGIN negative_and_odd - apply negative_and_odd_thm + all_goals (try extract_goal ; sorry) ---END negative_and_odd diff --git a/SSA/Projects/InstCombine/tests/LLVM/glshr_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/glshr_proof.lean deleted file mode 100644 index 7922ee3e2..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/glshr_proof.lean +++ /dev/null @@ -1,98 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section glshr_proof -theorem lshr_exact_thm (x : BitVec 8) : (x <<< 2 + 4#8) >>> 2 = x + 1#8 &&& 63#8 := sorry - -theorem shl_add_thm (x x_1 : BitVec 8) : (x_1 <<< 2 + x) >>> 2 = x >>> 2 + x_1 &&& 63#8 := sorry - -theorem mul_splat_fold_thm (x : BitVec 32) : (x * 65537#32) >>> 16 = x := sorry - -theorem shl_add_lshr_flag_preservation_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - if 32 ≤ x_1.toNat then none else some ((a + x) >>> x_1.toNat)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a => some (a + x_2) := sorry - -theorem shl_add_lshr_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - if 32 ≤ x_1.toNat then none else some ((a + x) >>> x_1.toNat)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a => some (a + x_2) := sorry - -theorem shl_add_lshr_comm_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if 32 ≤ x.toNat then none else some ((x_2 * x_2 + a) >>> x.toNat)) ⊑ - Option.bind (if 32 ≤ x.toNat then none else some ((x_2 * x_2) >>> x.toNat)) fun a => some (a + x_1) := sorry - -theorem shl_sub_lshr_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - if 32 ≤ x_1.toNat then none else some ((a - x) >>> x_1.toNat)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a => some (x_2 - a) := sorry - -theorem shl_sub_lshr_reverse_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if 32 ≤ x.toNat then none else some ((x_2 - a) >>> x.toNat)) ⊑ - Option.bind (if 32 ≤ x.toNat then none else some (x_2 >>> x.toNat)) fun a => some (a - x_1) := sorry - -theorem shl_sub_lshr_reverse_no_nsw_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if 32 ≤ x.toNat then none else some ((x_2 - a) >>> x.toNat)) ⊑ - Option.bind (if 32 ≤ x.toNat then none else some (x_2 >>> x.toNat)) fun a => some (a - x_1) := sorry - -theorem shl_sub_lshr_reverse_nsw_on_op1_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if 32 ≤ x.toNat then none else some ((x_2 - a) >>> x.toNat)) ⊑ - Option.bind (if 32 ≤ x.toNat then none else some (x_2 >>> x.toNat)) fun a => some (a - x_1) := sorry - -theorem shl_or_lshr_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - if 32 ≤ x_1.toNat then none else some ((a ||| x) >>> x_1.toNat)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a => some (a ||| x_2) := sorry - -theorem shl_or_disjoint_lshr_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - if 32 ≤ x_1.toNat then none else some ((a ||| x) >>> x_1.toNat)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a => some (a ||| x_2) := sorry - -theorem shl_or_lshr_comm_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if 32 ≤ x.toNat then none else some ((x_2 ||| a) >>> x.toNat)) ⊑ - Option.bind (if 32 ≤ x.toNat then none else some (x_2 >>> x.toNat)) fun a => some (a ||| x_1) := sorry - -theorem shl_or_disjoint_lshr_comm_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if 32 ≤ x.toNat then none else some ((x_2 ||| a) >>> x.toNat)) ⊑ - Option.bind (if 32 ≤ x.toNat then none else some (x_2 >>> x.toNat)) fun a => some (a ||| x_1) := sorry - -theorem shl_xor_lshr_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - if 32 ≤ x_1.toNat then none else some ((a ^^^ x) >>> x_1.toNat)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a => some (a ^^^ x_2) := sorry - -theorem shl_xor_lshr_comm_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if 32 ≤ x.toNat then none else some ((x_2 ^^^ a) >>> x.toNat)) ⊑ - Option.bind (if 32 ≤ x.toNat then none else some (x_2 >>> x.toNat)) fun a => some (a ^^^ x_1) := sorry - -theorem shl_and_lshr_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - if 32 ≤ x_1.toNat then none else some ((a &&& x) >>> x_1.toNat)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a => some (a &&& x_2) := sorry - -theorem shl_and_lshr_comm_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x.toNat then none else some (x_1 <<< x.toNat)) fun a => - if 32 ≤ x.toNat then none else some ((x_2 &&& a) >>> x.toNat)) ⊑ - Option.bind (if 32 ≤ x.toNat then none else some (x_2 >>> x.toNat)) fun a => some (a &&& x_1) := sorry - -theorem shl_lshr_and_exact_thm (x x_1 x_2 : BitVec 32) : - (Option.bind (if 32 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => - if 32 ≤ x_1.toNat then none else some ((a &&& x) >>> x_1.toNat)) ⊑ - Option.bind (if 32 ≤ x_1.toNat then none else some (x >>> x_1.toNat)) fun a => some (a &&& x_2) := sorry - -theorem mul_splat_fold_no_nuw_thm (x : BitVec 32) : (x * 65537#32) >>> 16 = x >>> 16 + x := sorry - -theorem mul_splat_fold_too_narrow_thm (x : BitVec 2) : (x * 2#2) >>> 1 = x := sorry - -theorem negative_and_odd_thm (x : BitVec 32) : (x - x.sdiv 2#32 * 2#32) >>> 31 = x >>> 31 &&& x := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehadd.lean b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehadd.lean index 056e34591..8288b9f14 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehadd.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehadd.lean @@ -30,7 +30,7 @@ def p_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg60, %arg62 : i32 %2 = llvm.xor %arg62, %0 : i32 - %3 = llvm.and %2, %arg61 : i32 + %3 = llvm.and %arg61, %2 : i32 %4 = llvm.or %1, %3 : i32 "llvm.return"(%4) : (i32) -> () } @@ -138,7 +138,7 @@ def p_commutative0_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg34, %arg32 : i32 %2 = llvm.xor %arg34, %0 : i32 - %3 = llvm.and %2, %arg33 : i32 + %3 = llvm.and %arg33, %2 : i32 %4 = llvm.or %1, %3 : i32 "llvm.return"(%4) : (i32) -> () } @@ -174,7 +174,7 @@ def p_commutative2_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg27, %arg29 : i32 %2 = llvm.xor %arg29, %0 : i32 - %3 = llvm.and %2, %arg28 : i32 + %3 = llvm.and %arg28, %2 : i32 %4 = llvm.or %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -210,7 +210,7 @@ def p_commutative4_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg24, %arg22 : i32 %2 = llvm.xor %arg24, %0 : i32 - %3 = llvm.and %2, %arg23 : i32 + %3 = llvm.and %arg23, %2 : i32 %4 = llvm.or %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -264,3 +264,39 @@ theorem p_constmask_commutative_proof : p_constmask_commutative_before ⊑ p_con ---END p_constmask_commutative + +def n2_badmask_before := [llvm| +{ +^0(%arg4 : i32, %arg5 : i32, %arg6 : i32, %arg7 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg6, %arg4 : i32 + %2 = llvm.xor %arg7, %0 : i32 + %3 = llvm.and %2, %arg5 : i32 + %4 = llvm.add %1, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +def n2_badmask_after := [llvm| +{ +^0(%arg4 : i32, %arg5 : i32, %arg6 : i32, %arg7 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg6, %arg4 : i32 + %2 = llvm.xor %arg7, %0 : i32 + %3 = llvm.and %arg5, %2 : i32 + %4 = llvm.add %1, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem n2_badmask_proof : n2_badmask_before ⊑ n2_badmask_after := by + unfold n2_badmask_before n2_badmask_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN n2_badmask + apply n2_badmask_thm + ---END n2_badmask + + diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehadd_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehadd_proof.lean index ef98878ca..6d0ae3509 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehadd_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehadd_proof.lean @@ -5,7 +5,7 @@ open BitVec section gmaskedhmergehadd_proof theorem p_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1) + ((x_1 ^^^ 4294967295#32) &&& x) = x_2 &&& x_1 ||| (x_1 ^^^ 4294967295#32) &&& x := sorry + (x_2 &&& x_1) + ((x_1 ^^^ 4294967295#32) &&& x) = x_2 &&& x_1 ||| x &&& (x_1 ^^^ 4294967295#32) := sorry theorem p_constmask_thm (x x_1 : BitVec 32) : (x_1 &&& 65280#32) + (x &&& 4294902015#32) = x_1 &&& 65280#32 ||| x &&& 4294902015#32 := sorry @@ -14,14 +14,16 @@ theorem p_constmask2_thm (x x_1 : BitVec 32) : (x_1 &&& 61440#32) + (x &&& 4294902015#32) = x_1 &&& 61440#32 ||| x &&& 4294902015#32 := sorry theorem p_commutative0_thm (x x_1 x_2 : BitVec 32) : - (x_2 &&& x_1) + ((x_2 ^^^ 4294967295#32) &&& x) = x_2 &&& x_1 ||| (x_2 ^^^ 4294967295#32) &&& x := sorry + (x_2 &&& x_1) + ((x_2 ^^^ 4294967295#32) &&& x) = x_2 &&& x_1 ||| x &&& (x_2 ^^^ 4294967295#32) := sorry theorem p_commutative2_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ^^^ 4294967295#32) &&& x_1) + (x &&& x_2) = (x_2 ^^^ 4294967295#32) &&& x_1 ||| x &&& x_2 := sorry + ((x_2 ^^^ 4294967295#32) &&& x_1) + (x &&& x_2) = x_1 &&& (x_2 ^^^ 4294967295#32) ||| x &&& x_2 := sorry theorem p_commutative4_thm (x x_1 x_2 : BitVec 32) : - ((x_2 ^^^ 4294967295#32) &&& x_1) + (x_2 &&& x) = (x_2 ^^^ 4294967295#32) &&& x_1 ||| x_2 &&& x := sorry + ((x_2 ^^^ 4294967295#32) &&& x_1) + (x_2 &&& x) = x_1 &&& (x_2 ^^^ 4294967295#32) ||| x_2 &&& x := sorry theorem p_constmask_commutative_thm (x x_1 : BitVec 32) : (x_1 &&& 4294902015#32) + (x &&& 65280#32) = x_1 &&& 4294902015#32 ||| x &&& 65280#32 := sorry +theorem n2_badmask_thm (x x_1 : BitVec 32) : (x_1 ^^^ 4294967295#32) &&& x = x &&& (x_1 ^^^ 4294967295#32) := sorry + diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehandhofhors.lean b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehandhofhors.lean index d1c10cff3..8dd232eef 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehandhofhors.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehandhofhors.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gmaskedhmergehandhofhors_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -13,75 +13,111 @@ set_option linter.unreachableTactic false set_option linter.unusedTactic false section gmaskedhmergehandhofhors_statements -def p_commutative0_before := [llvm| +def p_before := [llvm| { -^0(%arg56 : i32, %arg57 : i32, %arg58 : i32): +^0(%arg73 : i32, %arg74 : i32, %arg75 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 - %1 = llvm.xor %arg58, %0 : i32 - %2 = llvm.or %arg56, %1 : i32 - %3 = llvm.or %arg57, %arg58 : i32 + %1 = llvm.xor %arg75, %0 : i32 + %2 = llvm.or %1, %arg73 : i32 + %3 = llvm.or %arg74, %arg75 : i32 %4 = llvm.and %2, %3 : i32 "llvm.return"(%4) : (i32) -> () } ] -def p_commutative0_after := [llvm| +def p_after := [llvm| { -^0(%arg56 : i32, %arg57 : i32, %arg58 : i32): +^0(%arg73 : i32, %arg74 : i32, %arg75 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 - %1 = llvm.xor %arg58, %0 : i32 - %2 = llvm.or %1, %arg56 : i32 - %3 = llvm.or %arg57, %arg58 : i32 + %1 = llvm.xor %arg75, %0 : i32 + %2 = llvm.or %arg73, %1 : i32 + %3 = llvm.or %arg74, %arg75 : i32 %4 = llvm.and %2, %3 : i32 "llvm.return"(%4) : (i32) -> () } ] -theorem p_commutative0_proof : p_commutative0_before ⊑ p_commutative0_after := by - unfold p_commutative0_before p_commutative0_after +theorem p_proof : p_before ⊑ p_after := by + unfold p_before p_after simp_alive_peephole simp_alive_undef simp_alive_ops simp_alive_case_bash intros try simp - ---BEGIN p_commutative0 - apply p_commutative0_thm - ---END p_commutative0 + ---BEGIN p + all_goals (try extract_goal ; sorry) + ---END p -def p_commutative4_before := [llvm| +def p_commutative2_before := [llvm| { -^0(%arg46 : i32, %arg47 : i32, %arg48 : i32): +^0(%arg51 : i32, %arg52 : i32, %arg53 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 - %1 = llvm.xor %arg48, %0 : i32 - %2 = llvm.or %arg46, %1 : i32 - %3 = llvm.or %arg47, %arg48 : i32 + %1 = llvm.xor %arg53, %0 : i32 + %2 = llvm.or %1, %arg51 : i32 + %3 = llvm.or %arg52, %arg53 : i32 %4 = llvm.and %3, %2 : i32 "llvm.return"(%4) : (i32) -> () } ] -def p_commutative4_after := [llvm| +def p_commutative2_after := [llvm| { -^0(%arg46 : i32, %arg47 : i32, %arg48 : i32): +^0(%arg51 : i32, %arg52 : i32, %arg53 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 - %1 = llvm.xor %arg48, %0 : i32 - %2 = llvm.or %1, %arg46 : i32 - %3 = llvm.or %arg47, %arg48 : i32 + %1 = llvm.xor %arg53, %0 : i32 + %2 = llvm.or %arg51, %1 : i32 + %3 = llvm.or %arg52, %arg53 : i32 %4 = llvm.and %3, %2 : i32 "llvm.return"(%4) : (i32) -> () } ] -theorem p_commutative4_proof : p_commutative4_before ⊑ p_commutative4_after := by - unfold p_commutative4_before p_commutative4_after +theorem p_commutative2_proof : p_commutative2_before ⊑ p_commutative2_after := by + unfold p_commutative2_before p_commutative2_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN p_commutative2 + all_goals (try extract_goal ; sorry) + ---END p_commutative2 + + + +def n2_badmask_before := [llvm| +{ +^0(%arg6 : i32, %arg7 : i32, %arg8 : i32, %arg9 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.xor %arg9, %0 : i32 + %2 = llvm.or %1, %arg6 : i32 + %3 = llvm.or %arg8, %arg7 : i32 + %4 = llvm.and %2, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +def n2_badmask_after := [llvm| +{ +^0(%arg6 : i32, %arg7 : i32, %arg8 : i32, %arg9 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.xor %arg9, %0 : i32 + %2 = llvm.or %arg6, %1 : i32 + %3 = llvm.or %arg8, %arg7 : i32 + %4 = llvm.and %2, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem n2_badmask_proof : n2_badmask_before ⊑ n2_badmask_after := by + unfold n2_badmask_before n2_badmask_after simp_alive_peephole simp_alive_undef simp_alive_ops simp_alive_case_bash intros try simp - ---BEGIN p_commutative4 - apply p_commutative4_thm - ---END p_commutative4 + ---BEGIN n2_badmask + all_goals (try extract_goal ; sorry) + ---END n2_badmask @@ -113,7 +149,7 @@ theorem n3_constmask_samemask_proof : n3_constmask_samemask_before ⊑ n3_constm intros try simp ---BEGIN n3_constmask_samemask - apply n3_constmask_samemask_thm + all_goals (try extract_goal ; sorry) ---END n3_constmask_samemask diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehandhofhors_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehandhofhors_proof.lean deleted file mode 100644 index 0c513f633..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehandhofhors_proof.lean +++ /dev/null @@ -1,15 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gmaskedhmergehandhofhors_proof -theorem p_commutative0_thm (x x_1 x_2 : BitVec 32) : - (x_2 ||| x_1 ^^^ 4294967295#32) &&& (x ||| x_1) = (x_1 ^^^ 4294967295#32 ||| x_2) &&& (x ||| x_1) := sorry - -theorem p_commutative4_thm (x x_1 x_2 : BitVec 32) : - (x_2 ||| x_1) &&& (x ||| x_1 ^^^ 4294967295#32) = (x_2 ||| x_1) &&& (x_1 ^^^ 4294967295#32 ||| x) := sorry - -theorem n3_constmask_samemask_thm (x x_1 : BitVec 32) : - (x_1 ||| 4294902015#32) &&& (x ||| 4294902015#32) = x_1 &&& x ||| 4294902015#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehor.lean b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehor.lean index 9ccb4d452..a52e387c0 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehor.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehor.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gmaskedhmergehor_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -13,6 +13,186 @@ set_option linter.unreachableTactic false set_option linter.unusedTactic false section gmaskedhmergehor_statements +def p_before := [llvm| +{ +^0(%arg60 : i32, %arg61 : i32, %arg62 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg60, %arg62 : i32 + %2 = llvm.xor %arg62, %0 : i32 + %3 = llvm.and %2, %arg61 : i32 + %4 = llvm.or %1, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +def p_after := [llvm| +{ +^0(%arg60 : i32, %arg61 : i32, %arg62 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg60, %arg62 : i32 + %2 = llvm.xor %arg62, %0 : i32 + %3 = llvm.and %arg61, %2 : i32 + %4 = llvm.or %1, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem p_proof : p_before ⊑ p_after := by + unfold p_before p_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN p + all_goals (try extract_goal ; sorry) + ---END p + + + +def p_commutative0_before := [llvm| +{ +^0(%arg32 : i32, %arg33 : i32, %arg34 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg34, %arg32 : i32 + %2 = llvm.xor %arg34, %0 : i32 + %3 = llvm.and %2, %arg33 : i32 + %4 = llvm.or %1, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +def p_commutative0_after := [llvm| +{ +^0(%arg32 : i32, %arg33 : i32, %arg34 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg34, %arg32 : i32 + %2 = llvm.xor %arg34, %0 : i32 + %3 = llvm.and %arg33, %2 : i32 + %4 = llvm.or %1, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem p_commutative0_proof : p_commutative0_before ⊑ p_commutative0_after := by + unfold p_commutative0_before p_commutative0_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN p_commutative0 + all_goals (try extract_goal ; sorry) + ---END p_commutative0 + + + +def p_commutative2_before := [llvm| +{ +^0(%arg27 : i32, %arg28 : i32, %arg29 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg27, %arg29 : i32 + %2 = llvm.xor %arg29, %0 : i32 + %3 = llvm.and %2, %arg28 : i32 + %4 = llvm.or %3, %1 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +def p_commutative2_after := [llvm| +{ +^0(%arg27 : i32, %arg28 : i32, %arg29 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg27, %arg29 : i32 + %2 = llvm.xor %arg29, %0 : i32 + %3 = llvm.and %arg28, %2 : i32 + %4 = llvm.or %3, %1 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem p_commutative2_proof : p_commutative2_before ⊑ p_commutative2_after := by + unfold p_commutative2_before p_commutative2_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN p_commutative2 + all_goals (try extract_goal ; sorry) + ---END p_commutative2 + + + +def p_commutative4_before := [llvm| +{ +^0(%arg22 : i32, %arg23 : i32, %arg24 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg24, %arg22 : i32 + %2 = llvm.xor %arg24, %0 : i32 + %3 = llvm.and %2, %arg23 : i32 + %4 = llvm.or %3, %1 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +def p_commutative4_after := [llvm| +{ +^0(%arg22 : i32, %arg23 : i32, %arg24 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg24, %arg22 : i32 + %2 = llvm.xor %arg24, %0 : i32 + %3 = llvm.and %arg23, %2 : i32 + %4 = llvm.or %3, %1 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem p_commutative4_proof : p_commutative4_before ⊑ p_commutative4_after := by + unfold p_commutative4_before p_commutative4_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN p_commutative4 + all_goals (try extract_goal ; sorry) + ---END p_commutative4 + + + +def n2_badmask_before := [llvm| +{ +^0(%arg4 : i32, %arg5 : i32, %arg6 : i32, %arg7 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg6, %arg4 : i32 + %2 = llvm.xor %arg7, %0 : i32 + %3 = llvm.and %2, %arg5 : i32 + %4 = llvm.or %1, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +def n2_badmask_after := [llvm| +{ +^0(%arg4 : i32, %arg5 : i32, %arg6 : i32, %arg7 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg6, %arg4 : i32 + %2 = llvm.xor %arg7, %0 : i32 + %3 = llvm.and %arg5, %2 : i32 + %4 = llvm.or %1, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem n2_badmask_proof : n2_badmask_before ⊑ n2_badmask_after := by + unfold n2_badmask_before n2_badmask_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN n2_badmask + all_goals (try extract_goal ; sorry) + ---END n2_badmask + + + def n3_constmask_samemask_before := [llvm| { ^0(%arg0 : i32, %arg1 : i32): @@ -41,7 +221,7 @@ theorem n3_constmask_samemask_proof : n3_constmask_samemask_before ⊑ n3_constm intros try simp ---BEGIN n3_constmask_samemask - apply n3_constmask_samemask_thm + all_goals (try extract_goal ; sorry) ---END n3_constmask_samemask diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehor_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehor_proof.lean deleted file mode 100644 index 037d7379b..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehor_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gmaskedhmergehor_proof -theorem n3_constmask_samemask_thm (x x_1 : BitVec 32) : x_1 &&& 65280#32 ||| x &&& 65280#32 = (x_1 ||| x) &&& 65280#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehxor.lean b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehxor.lean index e3b60e7b6..bcfa20cbc 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehxor.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehxor.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gmaskedhmergehxor_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -30,7 +30,7 @@ def p_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg60, %arg62 : i32 %2 = llvm.xor %arg62, %0 : i32 - %3 = llvm.and %2, %arg61 : i32 + %3 = llvm.and %arg61, %2 : i32 %4 = llvm.or %1, %3 : i32 "llvm.return"(%4) : (i32) -> () } @@ -44,7 +44,7 @@ theorem p_proof : p_before ⊑ p_after := by intros try simp ---BEGIN p - apply p_thm + all_goals (try extract_goal ; sorry) ---END p @@ -80,7 +80,7 @@ theorem p_constmask_proof : p_constmask_before ⊑ p_constmask_after := by intros try simp ---BEGIN p_constmask - apply p_constmask_thm + all_goals (try extract_goal ; sorry) ---END p_constmask @@ -116,7 +116,7 @@ theorem p_constmask2_proof : p_constmask2_before ⊑ p_constmask2_after := by intros try simp ---BEGIN p_constmask2 - apply p_constmask2_thm + all_goals (try extract_goal ; sorry) ---END p_constmask2 @@ -138,7 +138,7 @@ def p_commutative0_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg34, %arg32 : i32 %2 = llvm.xor %arg34, %0 : i32 - %3 = llvm.and %2, %arg33 : i32 + %3 = llvm.and %arg33, %2 : i32 %4 = llvm.or %1, %3 : i32 "llvm.return"(%4) : (i32) -> () } @@ -152,7 +152,7 @@ theorem p_commutative0_proof : p_commutative0_before ⊑ p_commutative0_after := intros try simp ---BEGIN p_commutative0 - apply p_commutative0_thm + all_goals (try extract_goal ; sorry) ---END p_commutative0 @@ -174,7 +174,7 @@ def p_commutative2_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg27, %arg29 : i32 %2 = llvm.xor %arg29, %0 : i32 - %3 = llvm.and %2, %arg28 : i32 + %3 = llvm.and %arg28, %2 : i32 %4 = llvm.or %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -188,7 +188,7 @@ theorem p_commutative2_proof : p_commutative2_before ⊑ p_commutative2_after := intros try simp ---BEGIN p_commutative2 - apply p_commutative2_thm + all_goals (try extract_goal ; sorry) ---END p_commutative2 @@ -210,7 +210,7 @@ def p_commutative4_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.and %arg24, %arg22 : i32 %2 = llvm.xor %arg24, %0 : i32 - %3 = llvm.and %2, %arg23 : i32 + %3 = llvm.and %arg23, %2 : i32 %4 = llvm.or %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -224,7 +224,7 @@ theorem p_commutative4_proof : p_commutative4_before ⊑ p_commutative4_after := intros try simp ---BEGIN p_commutative4 - apply p_commutative4_thm + all_goals (try extract_goal ; sorry) ---END p_commutative4 @@ -260,11 +260,47 @@ theorem p_constmask_commutative_proof : p_constmask_commutative_before ⊑ p_con intros try simp ---BEGIN p_constmask_commutative - apply p_constmask_commutative_thm + all_goals (try extract_goal ; sorry) ---END p_constmask_commutative +def n2_badmask_before := [llvm| +{ +^0(%arg4 : i32, %arg5 : i32, %arg6 : i32, %arg7 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg6, %arg4 : i32 + %2 = llvm.xor %arg7, %0 : i32 + %3 = llvm.and %2, %arg5 : i32 + %4 = llvm.xor %1, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +def n2_badmask_after := [llvm| +{ +^0(%arg4 : i32, %arg5 : i32, %arg6 : i32, %arg7 : i32): + %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %1 = llvm.and %arg6, %arg4 : i32 + %2 = llvm.xor %arg7, %0 : i32 + %3 = llvm.and %arg5, %2 : i32 + %4 = llvm.xor %1, %3 : i32 + "llvm.return"(%4) : (i32) -> () +} +] +theorem n2_badmask_proof : n2_badmask_before ⊑ n2_badmask_after := by + unfold n2_badmask_before n2_badmask_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN n2_badmask + all_goals (try extract_goal ; sorry) + ---END n2_badmask + + + def n3_constmask_samemask_before := [llvm| { ^0(%arg0 : i32, %arg1 : i32): @@ -293,7 +329,7 @@ theorem n3_constmask_samemask_proof : n3_constmask_samemask_before ⊑ n3_constm intros try simp ---BEGIN n3_constmask_samemask - apply n3_constmask_samemask_thm + all_goals (try extract_goal ; sorry) ---END n3_constmask_samemask diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehxor_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehxor_proof.lean deleted file mode 100644 index f073756ec..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gmaskedhmergehxor_proof.lean +++ /dev/null @@ -1,29 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gmaskedhmergehxor_proof -theorem p_thm (x x_1 x_2 : BitVec 32) : - x_2 &&& x_1 ^^^ (x_1 ^^^ 4294967295#32) &&& x = x_2 &&& x_1 ||| (x_1 ^^^ 4294967295#32) &&& x := sorry - -theorem p_constmask_thm (x x_1 : BitVec 32) : - x_1 &&& 65280#32 ^^^ x &&& 4294902015#32 = x_1 &&& 65280#32 ||| x &&& 4294902015#32 := sorry - -theorem p_constmask2_thm (x x_1 : BitVec 32) : - x_1 &&& 61440#32 ^^^ x &&& 4294902015#32 = x_1 &&& 61440#32 ||| x &&& 4294902015#32 := sorry - -theorem p_commutative0_thm (x x_1 x_2 : BitVec 32) : - x_2 &&& x_1 ^^^ (x_2 ^^^ 4294967295#32) &&& x = x_2 &&& x_1 ||| (x_2 ^^^ 4294967295#32) &&& x := sorry - -theorem p_commutative2_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 ^^^ x &&& x_2 = (x_2 ^^^ 4294967295#32) &&& x_1 ||| x &&& x_2 := sorry - -theorem p_commutative4_thm (x x_1 x_2 : BitVec 32) : - (x_2 ^^^ 4294967295#32) &&& x_1 ^^^ x_2 &&& x = (x_2 ^^^ 4294967295#32) &&& x_1 ||| x_2 &&& x := sorry - -theorem p_constmask_commutative_thm (x x_1 : BitVec 32) : - x_1 &&& 4294902015#32 ^^^ x &&& 65280#32 = x_1 &&& 4294902015#32 ||| x &&& 65280#32 := sorry - -theorem n3_constmask_samemask_thm (x x_1 : BitVec 32) : x_1 &&& 65280#32 ^^^ x &&& 65280#32 = (x_1 ^^^ x) &&& 65280#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmisch2002.lean b/SSA/Projects/InstCombine/tests/LLVM/gmisch2002.lean index ec6dbecfc..b36bf6e55 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gmisch2002.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gmisch2002.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gmisch2002_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmisch2002_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gmisch2002_proof.lean deleted file mode 100644 index 35cc7f004..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gmisch2002_proof.lean +++ /dev/null @@ -1,6 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gmisch2002_proof diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmul_fold.lean b/SSA/Projects/InstCombine/tests/LLVM/gmul_fold.lean index 9d4830765..23dbdd085 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gmul_fold.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gmul_fold.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gmul_fold_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -47,7 +47,7 @@ theorem mul8_low_A0_B0_proof : mul8_low_A0_B0_before ⊑ mul8_low_A0_B0_after := intros try simp ---BEGIN mul8_low_A0_B0 - apply mul8_low_A0_B0_thm + all_goals (try extract_goal ; sorry) ---END mul8_low_A0_B0 @@ -86,7 +86,7 @@ theorem mul8_low_proof : mul8_low_before ⊑ mul8_low_after := by intros try simp ---BEGIN mul8_low - apply mul8_low_thm + all_goals (try extract_goal ; sorry) ---END mul8_low @@ -125,7 +125,7 @@ theorem mul16_low_proof : mul16_low_before ⊑ mul16_low_after := by intros try simp ---BEGIN mul16_low - apply mul16_low_thm + all_goals (try extract_goal ; sorry) ---END mul16_low @@ -285,47 +285,3 @@ theorem mul130_low_proof : mul130_low_before ⊑ mul130_low_after := by ---END mul130_low - -def mul64_low_no_and_before := [llvm| -{ -^0(%arg6 : i64, %arg7 : i64): - %0 = "llvm.mlir.constant"() <{value = 32 : i64}> : () -> i64 - %1 = llvm.lshr %arg6, %0 : i64 - %2 = llvm.lshr %arg7, %0 : i64 - %3 = llvm.mul %2, %arg6 : i64 - %4 = llvm.mul %arg7, %1 : i64 - %5 = llvm.mul %arg7, %arg6 : i64 - %6 = llvm.add %3, %4 : i64 - %7 = llvm.shl %6, %0 : i64 - %8 = llvm.add %7, %5 : i64 - "llvm.return"(%8) : (i64) -> () -} -] -def mul64_low_no_and_after := [llvm| -{ -^0(%arg6 : i64, %arg7 : i64): - %0 = "llvm.mlir.constant"() <{value = 32 : i64}> : () -> i64 - %1 = llvm.lshr %arg6, %0 : i64 - %2 = llvm.lshr %arg7, %0 : i64 - %3 = llvm.mul %2, %arg6 : i64 - %4 = llvm.mul %1, %arg7 : i64 - %5 = llvm.mul %arg7, %arg6 : i64 - %6 = llvm.add %3, %4 : i64 - %7 = llvm.shl %6, %0 : i64 - %8 = llvm.add %7, %5 : i64 - "llvm.return"(%8) : (i64) -> () -} -] -theorem mul64_low_no_and_proof : mul64_low_no_and_before ⊑ mul64_low_no_and_after := by - unfold mul64_low_no_and_before mul64_low_no_and_after - simp_alive_peephole - simp_alive_undef - simp_alive_ops - simp_alive_case_bash - intros - try simp - ---BEGIN mul64_low_no_and - all_goals (try extract_goal ; sorry) - ---END mul64_low_no_and - - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmul_fold_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gmul_fold_proof.lean deleted file mode 100644 index 6c76c929b..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gmul_fold_proof.lean +++ /dev/null @@ -1,15 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gmul_fold_proof -theorem mul8_low_A0_B0_thm (x x_1 : BitVec 8) : - (x_1 >>> 4 * x + x >>> 4 * x_1) <<< 4 + (x_1 &&& 15#8) * (x &&& 15#8) = x * x_1 := sorry - -theorem mul8_low_thm (x x_1 : BitVec 8) : - (x_1 >>> 4 * (x &&& 15#8) + (x_1 &&& 15#8) * x >>> 4) <<< 4 + (x_1 &&& 15#8) * (x &&& 15#8) = x * x_1 := sorry - -theorem mul16_low_thm (x x_1 : BitVec 16) : - (x_1 >>> 8 * (x &&& 255#16) + (x_1 &&& 255#16) * x >>> 8) <<< 8 + (x_1 &&& 255#16) * (x &&& 255#16) = x * x_1 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmulhpow2.lean b/SSA/Projects/InstCombine/tests/LLVM/gmulhpow2.lean index 9c6a1fcf4..53557c529 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gmulhpow2.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gmulhpow2.lean @@ -13,38 +13,6 @@ set_option linter.unreachableTactic false set_option linter.unusedTactic false section gmulhpow2_statements -def shl_add_log_may_cause_poison_pr62175_fail_before := [llvm| -{ -^0(%arg4 : i8, %arg5 : i8): - %0 = "llvm.mlir.constant"() <{value = 4 : i8}> : () -> i8 - %1 = llvm.shl %0, %arg4 : i8 - %2 = llvm.mul %arg5, %1 : i8 - "llvm.return"(%2) : (i8) -> () -} -] -def shl_add_log_may_cause_poison_pr62175_fail_after := [llvm| -{ -^0(%arg4 : i8, %arg5 : i8): - %0 = "llvm.mlir.constant"() <{value = 4 : i8}> : () -> i8 - %1 = llvm.shl %0, %arg4 : i8 - %2 = llvm.mul %1, %arg5 : i8 - "llvm.return"(%2) : (i8) -> () -} -] -theorem shl_add_log_may_cause_poison_pr62175_fail_proof : shl_add_log_may_cause_poison_pr62175_fail_before ⊑ shl_add_log_may_cause_poison_pr62175_fail_after := by - unfold shl_add_log_may_cause_poison_pr62175_fail_before shl_add_log_may_cause_poison_pr62175_fail_after - simp_alive_peephole - simp_alive_undef - simp_alive_ops - simp_alive_case_bash - intros - try simp - ---BEGIN shl_add_log_may_cause_poison_pr62175_fail - apply shl_add_log_may_cause_poison_pr62175_fail_thm - ---END shl_add_log_may_cause_poison_pr62175_fail - - - def shl_add_log_may_cause_poison_pr62175_with_nuw_before := [llvm| { ^0(%arg2 : i8, %arg3 : i8): diff --git a/SSA/Projects/InstCombine/tests/LLVM/gmulhpow2_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gmulhpow2_proof.lean index fb9286bbb..818b9e62b 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gmulhpow2_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gmulhpow2_proof.lean @@ -4,10 +4,6 @@ import SSA.Projects.InstCombine.LLVM.Semantics open BitVec section gmulhpow2_proof -theorem shl_add_log_may_cause_poison_pr62175_fail_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (4#8 <<< x.toNat)) fun a => some (x_1 * a)) ⊑ - Option.bind (if 8 ≤ x.toNat then none else some (4#8 <<< x.toNat)) fun a => some (a * x_1) := sorry - theorem shl_add_log_may_cause_poison_pr62175_with_nuw_thm (x x_1 : BitVec 8) : (Option.bind (if 8 ≤ x.toNat then none else some (4#8 <<< x.toNat)) fun a => some (x_1 * a)) ⊑ if 8 ≤ (x.toNat + 2) % 256 then none else some (x_1 <<< ((x.toNat + 2) % 256)) := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gnot.lean b/SSA/Projects/InstCombine/tests/LLVM/gnot.lean index 9ec4204b9..090628c28 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gnot.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gnot.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gnot_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics diff --git a/SSA/Projects/InstCombine/tests/LLVM/gnot_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gnot_proof.lean deleted file mode 100644 index 454bed0d7..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gnot_proof.lean +++ /dev/null @@ -1,6 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gnot_proof diff --git a/SSA/Projects/InstCombine/tests/LLVM/gnothadd.lean b/SSA/Projects/InstCombine/tests/LLVM/gnothadd.lean index 3fbc4aea2..a41236120 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gnothadd.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gnothadd.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gnothadd_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -39,7 +39,7 @@ theorem basic_proof : basic_before ⊑ basic_after := by intros try simp ---BEGIN basic - apply basic_thm + all_goals (try extract_goal ; sorry) ---END basic @@ -70,7 +70,7 @@ theorem basic_com_add_proof : basic_com_add_before ⊑ basic_com_add_after := by intros try simp ---BEGIN basic_com_add - apply basic_com_add_thm + all_goals (try extract_goal ; sorry) ---END basic_com_add @@ -101,7 +101,7 @@ theorem basic_preserve_nsw_proof : basic_preserve_nsw_before ⊑ basic_preserve_ intros try simp ---BEGIN basic_preserve_nsw - apply basic_preserve_nsw_thm + all_goals (try extract_goal ; sorry) ---END basic_preserve_nsw @@ -132,7 +132,7 @@ theorem basic_preserve_nuw_proof : basic_preserve_nuw_before ⊑ basic_preserve_ intros try simp ---BEGIN basic_preserve_nuw - apply basic_preserve_nuw_thm + all_goals (try extract_goal ; sorry) ---END basic_preserve_nuw @@ -163,7 +163,7 @@ theorem basic_preserve_nuw_nsw_proof : basic_preserve_nuw_nsw_before ⊑ basic_p intros try simp ---BEGIN basic_preserve_nuw_nsw - apply basic_preserve_nuw_nsw_thm + all_goals (try extract_goal ; sorry) ---END basic_preserve_nuw_nsw diff --git a/SSA/Projects/InstCombine/tests/LLVM/gnothadd_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gnothadd_proof.lean deleted file mode 100644 index 903aef5c1..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gnothadd_proof.lean +++ /dev/null @@ -1,16 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gnothadd_proof -theorem basic_thm (x x_1 : BitVec 8) : (x_1 ^^^ 255#8) + x ^^^ 255#8 = x_1 - x := sorry - -theorem basic_com_add_thm (x x_1 : BitVec 8) : x_1 + (x ^^^ 255#8) ^^^ 255#8 = x - x_1 := sorry - -theorem basic_preserve_nsw_thm (x x_1 : BitVec 8) : (x_1 ^^^ 255#8) + x ^^^ 255#8 = x_1 - x := sorry - -theorem basic_preserve_nuw_thm (x x_1 : BitVec 8) : (x_1 ^^^ 255#8) + x ^^^ 255#8 = x_1 - x := sorry - -theorem basic_preserve_nuw_nsw_thm (x x_1 : BitVec 8) : (x_1 ^^^ 255#8) + x ^^^ 255#8 = x_1 - x := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gorhshiftedhmasks.lean b/SSA/Projects/InstCombine/tests/LLVM/gorhshiftedhmasks.lean index 8d9526a26..2d80b972c 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gorhshiftedhmasks.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gorhshiftedhmasks.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gorhshiftedhmasks_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -52,7 +52,7 @@ theorem or_and_shifts1_proof : or_and_shifts1_before ⊑ or_and_shifts1_after := intros try simp ---BEGIN or_and_shifts1 - apply or_and_shifts1_thm + all_goals (try extract_goal ; sorry) ---END or_and_shifts1 @@ -96,7 +96,7 @@ theorem or_and_shift_shift_and_proof : or_and_shift_shift_and_before ⊑ or_and_ intros try simp ---BEGIN or_and_shift_shift_and - apply or_and_shift_shift_and_thm + all_goals (try extract_goal ; sorry) ---END or_and_shift_shift_and @@ -147,7 +147,7 @@ theorem multiuse1_proof : multiuse1_before ⊑ multiuse1_after := by intros try simp ---BEGIN multiuse1 - apply multiuse1_thm + all_goals (try extract_goal ; sorry) ---END multiuse1 @@ -209,7 +209,7 @@ theorem multiuse2_proof : multiuse2_before ⊑ multiuse2_after := by intros try simp ---BEGIN multiuse2 - apply multiuse2_thm + all_goals (try extract_goal ; sorry) ---END multiuse2 @@ -263,7 +263,7 @@ theorem multiuse3_proof : multiuse3_before ⊑ multiuse3_after := by intros try simp ---BEGIN multiuse3 - apply multiuse3_thm + all_goals (try extract_goal ; sorry) ---END multiuse3 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gorhshiftedhmasks_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gorhshiftedhmasks_proof.lean deleted file mode 100644 index f18311ee3..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gorhshiftedhmasks_proof.lean +++ /dev/null @@ -1,25 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gorhshiftedhmasks_proof -theorem or_and_shifts1_thm (x : BitVec 32) : - x <<< 3 &&& 15#32 ||| x <<< 5 &&& 60#32 = x <<< 3 &&& 8#32 ||| x <<< 5 &&& 32#32 := sorry - -theorem or_and_shift_shift_and_thm (x : BitVec 32) : - (x &&& 7#32) <<< 3 ||| x <<< 2 &&& 28#32 = x <<< 3 &&& 56#32 ||| x <<< 2 &&& 28#32 := sorry - -theorem multiuse1_thm (x : BitVec 32) : - (x &&& 2#32) >>> 1 ||| (x &&& 4#32) >>> 1 ||| ((x &&& 2#32) <<< 6 ||| (x &&& 4#32) <<< 6) = - x >>> 1 &&& 1#32 ||| x >>> 1 &&& 2#32 ||| x <<< 6 &&& 384#32 := sorry - -theorem multiuse2_thm (x : BitVec 32) : - (x &&& 96#32) <<< 8 ||| ((x &&& 6#32) <<< 8 ||| (x &&& 24#32) <<< 8) ||| - ((x &&& 6#32) <<< 1 ||| ((x &&& 96#32) <<< 1 ||| (x &&& 24#32) <<< 1)) = - x <<< 8 &&& 32256#32 ||| (x <<< 1 &&& 12#32 ||| (x <<< 1 &&& 192#32 ||| x <<< 1 &&& 48#32)) := sorry - -theorem multiuse3_thm (x : BitVec 32) : - (x &&& 96#32) >>> 1 ||| x >>> 1 &&& 15#32 ||| ((x &&& 96#32) <<< 6 ||| x <<< 6 &&& 1920#32) = - x >>> 1 &&& 48#32 ||| x >>> 1 &&& 15#32 ||| x <<< 6 &&& 8064#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gorhxor.lean b/SSA/Projects/InstCombine/tests/LLVM/gorhxor.lean index 4a2d966d8..2986f0319 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gorhxor.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gorhxor.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gorhxor_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -28,7 +28,7 @@ def test1_after := [llvm| ^0(%arg232 : i32, %arg233 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg233, %0 : i32 - %2 = llvm.or %1, %arg232 : i32 + %2 = llvm.or %arg232, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -41,7 +41,7 @@ theorem test1_proof : test1_before ⊑ test1_after := by intros try simp ---BEGIN test1 - apply test1_thm + all_goals (try extract_goal ; sorry) ---END test1 @@ -61,7 +61,7 @@ def test2_after := [llvm| ^0(%arg230 : i32, %arg231 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg230, %0 : i32 - %2 = llvm.or %1, %arg231 : i32 + %2 = llvm.or %arg231, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -74,7 +74,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 @@ -94,7 +94,7 @@ def test3_after := [llvm| ^0(%arg228 : i32, %arg229 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg229, %0 : i32 - %2 = llvm.or %1, %arg228 : i32 + %2 = llvm.or %arg228, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -107,7 +107,7 @@ theorem test3_proof : test3_before ⊑ test3_after := by intros try simp ---BEGIN test3 - apply test3_thm + all_goals (try extract_goal ; sorry) ---END test3 @@ -127,7 +127,7 @@ def test4_after := [llvm| ^0(%arg226 : i32, %arg227 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg226, %0 : i32 - %2 = llvm.or %1, %arg227 : i32 + %2 = llvm.or %arg227, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -140,7 +140,7 @@ theorem test4_proof : test4_before ⊑ test4_after := by intros try simp ---BEGIN test4 - apply test4_thm + all_goals (try extract_goal ; sorry) ---END test4 @@ -173,7 +173,7 @@ theorem test5_proof : test5_before ⊑ test5_after := by intros try simp ---BEGIN test5 - apply test5_thm + all_goals (try extract_goal ; sorry) ---END test5 @@ -206,7 +206,7 @@ theorem test5_commuted_x_y_proof : test5_commuted_x_y_before ⊑ test5_commuted_ intros try simp ---BEGIN test5_commuted_x_y - apply test5_commuted_x_y_thm + all_goals (try extract_goal ; sorry) ---END test5_commuted_x_y @@ -235,7 +235,7 @@ theorem xor_common_op_commute0_proof : xor_common_op_commute0_before ⊑ xor_com intros try simp ---BEGIN xor_common_op_commute0 - apply xor_common_op_commute0_thm + all_goals (try extract_goal ; sorry) ---END xor_common_op_commute0 @@ -268,7 +268,7 @@ theorem xor_common_op_commute2_proof : xor_common_op_commute2_before ⊑ xor_com intros try simp ---BEGIN xor_common_op_commute2 - apply xor_common_op_commute2_thm + all_goals (try extract_goal ; sorry) ---END xor_common_op_commute2 @@ -303,7 +303,7 @@ theorem xor_common_op_commute3_proof : xor_common_op_commute3_before ⊑ xor_com intros try simp ---BEGIN xor_common_op_commute3 - apply xor_common_op_commute3_thm + all_goals (try extract_goal ; sorry) ---END xor_common_op_commute3 @@ -323,7 +323,7 @@ def test8_after := [llvm| ^0(%arg200 : i32, %arg201 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg200, %0 : i32 - %2 = llvm.or %1, %arg201 : i32 + %2 = llvm.or %arg201, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -336,7 +336,7 @@ theorem test8_proof : test8_before ⊑ test8_after := by intros try simp ---BEGIN test8 - apply test8_thm + all_goals (try extract_goal ; sorry) ---END test8 @@ -356,7 +356,7 @@ def test9_after := [llvm| ^0(%arg198 : i32, %arg199 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg199, %0 : i32 - %2 = llvm.or %1, %arg198 : i32 + %2 = llvm.or %arg198, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -369,7 +369,7 @@ theorem test9_proof : test9_before ⊑ test9_after := by intros try simp ---BEGIN test9 - apply test9_thm + all_goals (try extract_goal ; sorry) ---END test9 @@ -405,7 +405,7 @@ theorem test10_proof : test10_before ⊑ test10_after := by intros try simp ---BEGIN test10 - apply test10_thm + all_goals (try extract_goal ; sorry) ---END test10 @@ -441,7 +441,7 @@ theorem test10_commuted_proof : test10_commuted_before ⊑ test10_commuted_after intros try simp ---BEGIN test10_commuted - apply test10_commuted_thm + all_goals (try extract_goal ; sorry) ---END test10_commuted @@ -460,7 +460,7 @@ def test11_before := [llvm| def test11_after := [llvm| { ^0(%arg184 : i32, %arg185 : i32): - %0 = llvm.and %arg184, %arg185 : i32 + %0 = llvm.and %arg185, %arg184 : i32 "llvm.return"(%0) : (i32) -> () } ] @@ -473,7 +473,7 @@ theorem test11_proof : test11_before ⊑ test11_after := by intros try simp ---BEGIN test11 - apply test11_thm + all_goals (try extract_goal ; sorry) ---END test11 @@ -492,7 +492,7 @@ def test12_before := [llvm| def test12_after := [llvm| { ^0(%arg182 : i32, %arg183 : i32): - %0 = llvm.and %arg182, %arg183 : i32 + %0 = llvm.and %arg183, %arg182 : i32 "llvm.return"(%0) : (i32) -> () } ] @@ -505,7 +505,7 @@ theorem test12_proof : test12_before ⊑ test12_after := by intros try simp ---BEGIN test12 - apply test12_thm + all_goals (try extract_goal ; sorry) ---END test12 @@ -524,7 +524,7 @@ def test12_commuted_before := [llvm| def test12_commuted_after := [llvm| { ^0(%arg180 : i32, %arg181 : i32): - %0 = llvm.and %arg180, %arg181 : i32 + %0 = llvm.and %arg181, %arg180 : i32 "llvm.return"(%0) : (i32) -> () } ] @@ -537,7 +537,7 @@ theorem test12_commuted_proof : test12_commuted_before ⊑ test12_commuted_after intros try simp ---BEGIN test12_commuted - apply test12_commuted_thm + all_goals (try extract_goal ; sorry) ---END test12_commuted @@ -554,7 +554,7 @@ def test13_before := [llvm| def test13_after := [llvm| { ^0(%arg178 : i32, %arg179 : i32): - %0 = llvm.and %arg179, %arg178 : i32 + %0 = llvm.and %arg178, %arg179 : i32 "llvm.return"(%0) : (i32) -> () } ] @@ -567,7 +567,7 @@ theorem test13_proof : test13_before ⊑ test13_after := by intros try simp ---BEGIN test13 - apply test13_thm + all_goals (try extract_goal ; sorry) ---END test13 @@ -600,7 +600,7 @@ theorem test14_proof : test14_before ⊑ test14_after := by intros try simp ---BEGIN test14 - apply test14_thm + all_goals (try extract_goal ; sorry) ---END test14 @@ -633,7 +633,7 @@ theorem test14_commuted_proof : test14_commuted_before ⊑ test14_commuted_after intros try simp ---BEGIN test14_commuted - apply test14_commuted_thm + all_goals (try extract_goal ; sorry) ---END test14_commuted @@ -666,7 +666,7 @@ theorem test15_proof : test15_before ⊑ test15_after := by intros try simp ---BEGIN test15 - apply test15_thm + all_goals (try extract_goal ; sorry) ---END test15 @@ -699,7 +699,7 @@ theorem test15_commuted_proof : test15_commuted_before ⊑ test15_commuted_after intros try simp ---BEGIN test15_commuted - apply test15_commuted_thm + all_goals (try extract_goal ; sorry) ---END test15_commuted @@ -734,7 +734,7 @@ theorem or_and_xor_not_constant_commute0_proof : or_and_xor_not_constant_commute intros try simp ---BEGIN or_and_xor_not_constant_commute0 - apply or_and_xor_not_constant_commute0_thm + all_goals (try extract_goal ; sorry) ---END or_and_xor_not_constant_commute0 @@ -769,7 +769,7 @@ theorem or_and_xor_not_constant_commute1_proof : or_and_xor_not_constant_commute intros try simp ---BEGIN or_and_xor_not_constant_commute1 - apply or_and_xor_not_constant_commute1_thm + all_goals (try extract_goal ; sorry) ---END or_and_xor_not_constant_commute1 @@ -805,7 +805,7 @@ theorem not_or_xor_proof : not_or_xor_before ⊑ not_or_xor_after := by intros try simp ---BEGIN not_or_xor - apply not_or_xor_thm + all_goals (try extract_goal ; sorry) ---END not_or_xor @@ -839,7 +839,7 @@ theorem xor_or_proof : xor_or_before ⊑ xor_or_after := by intros try simp ---BEGIN xor_or - apply xor_or_thm + all_goals (try extract_goal ; sorry) ---END xor_or @@ -873,7 +873,7 @@ theorem xor_or2_proof : xor_or2_before ⊑ xor_or2_after := by intros try simp ---BEGIN xor_or2 - apply xor_or2_thm + all_goals (try extract_goal ; sorry) ---END xor_or2 @@ -909,7 +909,7 @@ theorem xor_or_xor_proof : xor_or_xor_before ⊑ xor_or_xor_after := by intros try simp ---BEGIN xor_or_xor - apply xor_or_xor_thm + all_goals (try extract_goal ; sorry) ---END xor_or_xor @@ -945,7 +945,7 @@ theorem or_xor_or_proof : or_xor_or_before ⊑ or_xor_or_after := by intros try simp ---BEGIN or_xor_or - apply or_xor_or_thm + all_goals (try extract_goal ; sorry) ---END or_xor_or @@ -983,7 +983,7 @@ theorem test17_proof : test17_before ⊑ test17_after := by intros try simp ---BEGIN test17 - apply test17_thm + all_goals (try extract_goal ; sorry) ---END test17 @@ -1021,7 +1021,7 @@ theorem test18_proof : test18_before ⊑ test18_after := by intros try simp ---BEGIN test18 - apply test18_thm + all_goals (try extract_goal ; sorry) ---END test18 @@ -1056,7 +1056,7 @@ theorem test19_proof : test19_before ⊑ test19_after := by intros try simp ---BEGIN test19 - apply test19_thm + all_goals (try extract_goal ; sorry) ---END test19 @@ -1091,7 +1091,7 @@ theorem test20_proof : test20_before ⊑ test20_after := by intros try simp ---BEGIN test20 - apply test20_thm + all_goals (try extract_goal ; sorry) ---END test20 @@ -1126,7 +1126,7 @@ theorem test21_proof : test21_before ⊑ test21_after := by intros try simp ---BEGIN test21 - apply test21_thm + all_goals (try extract_goal ; sorry) ---END test21 @@ -1161,7 +1161,7 @@ theorem test22_proof : test22_before ⊑ test22_after := by intros try simp ---BEGIN test22 - apply test22_thm + all_goals (try extract_goal ; sorry) ---END test22 @@ -1196,7 +1196,7 @@ theorem test23_proof : test23_before ⊑ test23_after := by intros try simp ---BEGIN test23 - apply test23_thm + all_goals (try extract_goal ; sorry) ---END test23 @@ -1230,7 +1230,7 @@ theorem PR45977_f1_proof : PR45977_f1_before ⊑ PR45977_f1_after := by intros try simp ---BEGIN PR45977_f1 - apply PR45977_f1_thm + all_goals (try extract_goal ; sorry) ---END PR45977_f1 @@ -1263,7 +1263,7 @@ theorem PR45977_f2_proof : PR45977_f2_before ⊑ PR45977_f2_after := by intros try simp ---BEGIN PR45977_f2 - apply PR45977_f2_thm + all_goals (try extract_goal ; sorry) ---END PR45977_f2 @@ -1294,7 +1294,7 @@ theorem or_xor_common_op_commute0_proof : or_xor_common_op_commute0_before ⊑ o intros try simp ---BEGIN or_xor_common_op_commute0 - apply or_xor_common_op_commute0_thm + all_goals (try extract_goal ; sorry) ---END or_xor_common_op_commute0 @@ -1325,7 +1325,7 @@ theorem or_xor_common_op_commute5_proof : or_xor_common_op_commute5_before ⊑ o intros try simp ---BEGIN or_xor_common_op_commute5 - apply or_xor_common_op_commute5_thm + all_goals (try extract_goal ; sorry) ---END or_xor_common_op_commute5 @@ -1356,7 +1356,7 @@ theorem or_xor_common_op_commute6_proof : or_xor_common_op_commute6_before ⊑ o intros try simp ---BEGIN or_xor_common_op_commute6 - apply or_xor_common_op_commute6_thm + all_goals (try extract_goal ; sorry) ---END or_xor_common_op_commute6 @@ -1387,7 +1387,7 @@ theorem or_xor_common_op_commute7_proof : or_xor_common_op_commute7_before ⊑ o intros try simp ---BEGIN or_xor_common_op_commute7 - apply or_xor_common_op_commute7_thm + all_goals (try extract_goal ; sorry) ---END or_xor_common_op_commute7 @@ -1409,7 +1409,7 @@ def or_not_xor_common_op_commute0_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i4}> : () -> i4 %1 = llvm.and %arg107, %arg108 : i4 %2 = llvm.xor %1, %0 : i4 - %3 = llvm.or %2, %arg109 : i4 + %3 = llvm.or %arg109, %2 : i4 "llvm.return"(%3) : (i4) -> () } ] @@ -1422,7 +1422,7 @@ theorem or_not_xor_common_op_commute0_proof : or_not_xor_common_op_commute0_befo intros try simp ---BEGIN or_not_xor_common_op_commute0 - apply or_not_xor_common_op_commute0_thm + all_goals (try extract_goal ; sorry) ---END or_not_xor_common_op_commute0 @@ -1461,7 +1461,7 @@ theorem or_not_xor_common_op_commute2_proof : or_not_xor_common_op_commute2_befo intros try simp ---BEGIN or_not_xor_common_op_commute2 - apply or_not_xor_common_op_commute2_thm + all_goals (try extract_goal ; sorry) ---END or_not_xor_common_op_commute2 @@ -1500,7 +1500,7 @@ theorem or_not_xor_common_op_commute3_proof : or_not_xor_common_op_commute3_befo intros try simp ---BEGIN or_not_xor_common_op_commute3 - apply or_not_xor_common_op_commute3_thm + all_goals (try extract_goal ; sorry) ---END or_not_xor_common_op_commute3 @@ -1522,7 +1522,7 @@ def or_not_xor_common_op_commute5_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.and %arg93, %arg92 : i8 %2 = llvm.xor %1, %0 : i8 - %3 = llvm.or %2, %arg94 : i8 + %3 = llvm.or %arg94, %2 : i8 "llvm.return"(%3) : (i8) -> () } ] @@ -1535,7 +1535,7 @@ theorem or_not_xor_common_op_commute5_proof : or_not_xor_common_op_commute5_befo intros try simp ---BEGIN or_not_xor_common_op_commute5 - apply or_not_xor_common_op_commute5_thm + all_goals (try extract_goal ; sorry) ---END or_not_xor_common_op_commute5 @@ -1574,7 +1574,7 @@ theorem or_not_xor_common_op_commute6_proof : or_not_xor_common_op_commute6_befo intros try simp ---BEGIN or_not_xor_common_op_commute6 - apply or_not_xor_common_op_commute6_thm + all_goals (try extract_goal ; sorry) ---END or_not_xor_common_op_commute6 @@ -1613,7 +1613,7 @@ theorem or_not_xor_common_op_commute7_proof : or_not_xor_common_op_commute7_befo intros try simp ---BEGIN or_not_xor_common_op_commute7 - apply or_not_xor_common_op_commute7_thm + all_goals (try extract_goal ; sorry) ---END or_not_xor_common_op_commute7 @@ -1648,7 +1648,7 @@ theorem or_nand_xor_common_op_commute0_proof : or_nand_xor_common_op_commute0_be intros try simp ---BEGIN or_nand_xor_common_op_commute0 - apply or_nand_xor_common_op_commute0_thm + all_goals (try extract_goal ; sorry) ---END or_nand_xor_common_op_commute0 @@ -1680,7 +1680,7 @@ theorem PR75692_1_proof : PR75692_1_before ⊑ PR75692_1_after := by intros try simp ---BEGIN PR75692_1 - apply PR75692_1_thm + all_goals (try extract_goal ; sorry) ---END PR75692_1 @@ -1700,7 +1700,7 @@ def or_xor_not_after := [llvm| ^0(%arg56 : i32, %arg57 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg56, %0 : i32 - %2 = llvm.or %1, %arg57 : i32 + %2 = llvm.or %arg57, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -1713,7 +1713,7 @@ theorem or_xor_not_proof : or_xor_not_before ⊑ or_xor_not_after := by intros try simp ---BEGIN or_xor_not - apply or_xor_not_thm + all_goals (try extract_goal ; sorry) ---END or_xor_not @@ -1748,7 +1748,7 @@ theorem or_xor_and_commuted1_proof : or_xor_and_commuted1_before ⊑ or_xor_and_ intros try simp ---BEGIN or_xor_and_commuted1 - apply or_xor_and_commuted1_thm + all_goals (try extract_goal ; sorry) ---END or_xor_and_commuted1 @@ -1785,7 +1785,7 @@ theorem or_xor_and_commuted2_proof : or_xor_and_commuted2_before ⊑ or_xor_and_ intros try simp ---BEGIN or_xor_and_commuted2 - apply or_xor_and_commuted2_thm + all_goals (try extract_goal ; sorry) ---END or_xor_and_commuted2 @@ -1825,7 +1825,7 @@ theorem or_xor_tree_0000_proof : or_xor_tree_0000_before ⊑ or_xor_tree_0000_af intros try simp ---BEGIN or_xor_tree_0000 - apply or_xor_tree_0000_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_0000 @@ -1865,7 +1865,7 @@ theorem or_xor_tree_0001_proof : or_xor_tree_0001_before ⊑ or_xor_tree_0001_af intros try simp ---BEGIN or_xor_tree_0001 - apply or_xor_tree_0001_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_0001 @@ -1905,7 +1905,7 @@ theorem or_xor_tree_0010_proof : or_xor_tree_0010_before ⊑ or_xor_tree_0010_af intros try simp ---BEGIN or_xor_tree_0010 - apply or_xor_tree_0010_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_0010 @@ -1945,7 +1945,7 @@ theorem or_xor_tree_0011_proof : or_xor_tree_0011_before ⊑ or_xor_tree_0011_af intros try simp ---BEGIN or_xor_tree_0011 - apply or_xor_tree_0011_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_0011 @@ -1985,7 +1985,7 @@ theorem or_xor_tree_0100_proof : or_xor_tree_0100_before ⊑ or_xor_tree_0100_af intros try simp ---BEGIN or_xor_tree_0100 - apply or_xor_tree_0100_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_0100 @@ -2025,7 +2025,7 @@ theorem or_xor_tree_0101_proof : or_xor_tree_0101_before ⊑ or_xor_tree_0101_af intros try simp ---BEGIN or_xor_tree_0101 - apply or_xor_tree_0101_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_0101 @@ -2065,7 +2065,7 @@ theorem or_xor_tree_0110_proof : or_xor_tree_0110_before ⊑ or_xor_tree_0110_af intros try simp ---BEGIN or_xor_tree_0110 - apply or_xor_tree_0110_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_0110 @@ -2105,7 +2105,7 @@ theorem or_xor_tree_0111_proof : or_xor_tree_0111_before ⊑ or_xor_tree_0111_af intros try simp ---BEGIN or_xor_tree_0111 - apply or_xor_tree_0111_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_0111 @@ -2145,7 +2145,7 @@ theorem or_xor_tree_1000_proof : or_xor_tree_1000_before ⊑ or_xor_tree_1000_af intros try simp ---BEGIN or_xor_tree_1000 - apply or_xor_tree_1000_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_1000 @@ -2185,7 +2185,7 @@ theorem or_xor_tree_1001_proof : or_xor_tree_1001_before ⊑ or_xor_tree_1001_af intros try simp ---BEGIN or_xor_tree_1001 - apply or_xor_tree_1001_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_1001 @@ -2225,7 +2225,7 @@ theorem or_xor_tree_1010_proof : or_xor_tree_1010_before ⊑ or_xor_tree_1010_af intros try simp ---BEGIN or_xor_tree_1010 - apply or_xor_tree_1010_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_1010 @@ -2265,7 +2265,7 @@ theorem or_xor_tree_1011_proof : or_xor_tree_1011_before ⊑ or_xor_tree_1011_af intros try simp ---BEGIN or_xor_tree_1011 - apply or_xor_tree_1011_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_1011 @@ -2305,7 +2305,7 @@ theorem or_xor_tree_1100_proof : or_xor_tree_1100_before ⊑ or_xor_tree_1100_af intros try simp ---BEGIN or_xor_tree_1100 - apply or_xor_tree_1100_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_1100 @@ -2345,7 +2345,7 @@ theorem or_xor_tree_1101_proof : or_xor_tree_1101_before ⊑ or_xor_tree_1101_af intros try simp ---BEGIN or_xor_tree_1101 - apply or_xor_tree_1101_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_1101 @@ -2385,7 +2385,7 @@ theorem or_xor_tree_1110_proof : or_xor_tree_1110_before ⊑ or_xor_tree_1110_af intros try simp ---BEGIN or_xor_tree_1110 - apply or_xor_tree_1110_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_1110 @@ -2425,7 +2425,7 @@ theorem or_xor_tree_1111_proof : or_xor_tree_1111_before ⊑ or_xor_tree_1111_af intros try simp ---BEGIN or_xor_tree_1111 - apply or_xor_tree_1111_thm + all_goals (try extract_goal ; sorry) ---END or_xor_tree_1111 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gorhxor_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gorhxor_proof.lean deleted file mode 100644 index 28f7edce7..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gorhxor_proof.lean +++ /dev/null @@ -1,197 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gorhxor_proof -theorem test1_thm (x x_1 : BitVec 32) : x_1 ||| (x_1 ||| x) ^^^ 4294967295#32 = x ^^^ 4294967295#32 ||| x_1 := sorry - -theorem test2_thm (x x_1 : BitVec 32) : x_1 ||| (x ||| x_1) ^^^ 4294967295#32 = x ^^^ 4294967295#32 ||| x_1 := sorry - -theorem test3_thm (x x_1 : BitVec 32) : x_1 ||| x_1 ^^^ x ^^^ 4294967295#32 = x ^^^ 4294967295#32 ||| x_1 := sorry - -theorem test4_thm (x x_1 : BitVec 32) : x_1 ||| x ^^^ x_1 ^^^ 4294967295#32 = x ^^^ 4294967295#32 ||| x_1 := sorry - -theorem test5_thm (x x_1 : BitVec 32) : x_1 ^^^ x ||| x_1 ^^^ 4294967295#32 = x_1 &&& x ^^^ 4294967295#32 := sorry - -theorem test5_commuted_x_y_thm (x x_1 : BitVec 64) : - x_1 ^^^ x ||| x ^^^ 18446744073709551615#64 = x_1 &&& x ^^^ 18446744073709551615#64 := sorry - -theorem xor_common_op_commute0_thm (x x_1 : BitVec 8) : x_1 ^^^ x ||| x_1 = x ||| x_1 := sorry - -theorem xor_common_op_commute2_thm (x x_1 : BitVec 8) : x_1 ^^^ 5#8 ||| x_1 ^^^ 5#8 ^^^ x = x_1 ^^^ 5#8 ||| x := sorry - -theorem xor_common_op_commute3_thm (x x_1 : BitVec 8) : x_1 ^^^ 5#8 ||| x * x ^^^ (x_1 ^^^ 5#8) = x_1 ^^^ 5#8 ||| x * x := sorry - -theorem test8_thm (x x_1 : BitVec 32) : x_1 ||| x ^^^ (x_1 ^^^ 4294967295#32) = x ^^^ 4294967295#32 ||| x_1 := sorry - -theorem test9_thm (x x_1 : BitVec 32) : x_1 ||| x_1 ^^^ 4294967295#32 ^^^ x = x ^^^ 4294967295#32 ||| x_1 := sorry - -theorem test10_thm (x x_1 : BitVec 32) : - x_1 ^^^ x ||| x ^^^ 4294967295#32 ^^^ x_1 = x_1 ^^^ x ||| x ^^^ x_1 ^^^ 4294967295#32 := sorry - -theorem test10_commuted_thm (x x_1 : BitVec 32) : - x_1 ^^^ 4294967295#32 ^^^ x ||| x ^^^ x_1 = x ^^^ x_1 ||| x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem test11_thm (x x_1 : BitVec 32) : (x_1 ||| x) &&& (x_1 ^^^ 4294967295#32 ^^^ x) = x_1 &&& x := sorry - -theorem test12_thm (x x_1 : BitVec 32) : (x_1 ^^^ 4294967295#32 ^^^ x) &&& (x_1 ||| x) = x_1 &&& x := sorry - -theorem test12_commuted_thm (x x_1 : BitVec 32) : (x_1 ^^^ 4294967295#32 ^^^ x) &&& (x ||| x_1) = x_1 &&& x := sorry - -theorem test13_thm (x x_1 : BitVec 32) : (x_1 ||| x) ^^^ (x_1 ^^^ x) = x_1 &&& x := sorry - -theorem test14_thm (x x_1 : BitVec 32) : - (x_1 ||| x ^^^ 4294967295#32) ^^^ (x_1 ^^^ 4294967295#32 ||| x) = x_1 ^^^ x := sorry - -theorem test14_commuted_thm (x x_1 : BitVec 32) : - (x_1 ^^^ 4294967295#32 ||| x) ^^^ (x ^^^ 4294967295#32 ||| x_1) = x ^^^ x_1 := sorry - -theorem test15_thm (x x_1 : BitVec 32) : - x_1 &&& (x ^^^ 4294967295#32) ^^^ (x_1 ^^^ 4294967295#32) &&& x = x_1 ^^^ x := sorry - -theorem test15_commuted_thm (x x_1 : BitVec 32) : - (x_1 ^^^ 4294967295#32) &&& x ^^^ (x ^^^ 4294967295#32) &&& x_1 = x ^^^ x_1 := sorry - -theorem or_and_xor_not_constant_commute0_thm (x x_1 : BitVec 32) : (x_1 ^^^ x) &&& 1#32 ||| x &&& 4294967294#32 = x_1 &&& 1#32 ^^^ x := sorry - -theorem or_and_xor_not_constant_commute1_thm (x x_1 : BitVec 9) : (x_1 ^^^ x) &&& 42#9 ||| x_1 &&& 469#9 = x &&& 42#9 ^^^ x_1 := sorry - -theorem not_or_xor_thm (x : BitVec 8) : (x ^^^ 255#8 ||| 7#8) ^^^ 12#8 = x &&& 248#8 ^^^ 243#8 := sorry - -theorem xor_or_thm (x : BitVec 8) : x ^^^ 32#8 ||| 7#8 = x &&& 248#8 ^^^ 39#8 := sorry - -theorem xor_or2_thm (x : BitVec 8) : x ^^^ 33#8 ||| 7#8 = x &&& 248#8 ^^^ 39#8 := sorry - -theorem xor_or_xor_thm (x : BitVec 8) : (x ^^^ 33#8 ||| 7#8) ^^^ 12#8 = x &&& 248#8 ^^^ 43#8 := sorry - -theorem or_xor_or_thm (x : BitVec 8) : (x ||| 33#8) ^^^ 12#8 ||| 7#8 = x &&& 216#8 ^^^ 47#8 := sorry - -theorem test17_thm (x x_1 : BitVec 8) : - (x_1 ^^^ x ||| x ^^^ 33#8 ^^^ x_1) * (x ^^^ 33#8 ^^^ x_1) = - (x_1 ^^^ x ||| x ^^^ x_1 ^^^ 33#8) * (x ^^^ x_1 ^^^ 33#8) := sorry - -theorem test18_thm (x x_1 : BitVec 8) : - (x_1 ^^^ 33#8 ^^^ x ||| x ^^^ x_1) * (x_1 ^^^ 33#8 ^^^ x) = - (x_1 ^^^ x ^^^ 33#8 ||| x ^^^ x_1) * (x_1 ^^^ x ^^^ 33#8) := sorry - -theorem test19_thm (x x_1 : BitVec 32) : - (x_1 ||| x) ^^^ (x_1 ^^^ 4294967295#32 ||| x ^^^ 4294967295#32) = x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem test20_thm (x x_1 : BitVec 32) : - (x_1 ||| x) ^^^ (x ^^^ 4294967295#32 ||| x_1 ^^^ 4294967295#32) = x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem test21_thm (x x_1 : BitVec 32) : - (x_1 ^^^ 4294967295#32 ||| x ^^^ 4294967295#32) ^^^ (x_1 ||| x) = x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem test22_thm (x x_1 : BitVec 32) : - (x_1 ^^^ 4294967295#32 ||| x ^^^ 4294967295#32) ^^^ (x ||| x_1) = x ^^^ x_1 ^^^ 4294967295#32 := sorry - -theorem test23_thm (x : BitVec 8) : ((x ||| 254#8) ^^^ 13#8 ||| 1#8) ^^^ 12#8 = 255#8 := sorry - -theorem PR45977_f1_thm (x x_1 : BitVec 32) : - (x_1 ||| x) ^^^ 4294967295#32 ||| (x_1 ^^^ 4294967295#32) &&& x = x_1 ^^^ 4294967295#32 := sorry - -theorem PR45977_f2_thm (x x_1 : BitVec 32) : (x_1 ||| x) ^^^ (x_1 ||| x ^^^ 4294967295#32) = x_1 ^^^ 4294967295#32 := sorry - -theorem or_xor_common_op_commute0_thm (x x_1 x_2 : BitVec 8) : x_2 ||| x_1 ||| x_2 ^^^ x = x_2 ||| x_1 ||| x := sorry - -theorem or_xor_common_op_commute5_thm (x x_1 x_2 : BitVec 8) : x_2 ^^^ x_1 ||| (x ||| x_2) = x ||| x_2 ||| x_1 := sorry - -theorem or_xor_common_op_commute6_thm (x x_1 x_2 : BitVec 8) : x_2 ^^^ x_1 ||| (x_1 ||| x) = x_1 ||| x ||| x_2 := sorry - -theorem or_xor_common_op_commute7_thm (x x_1 x_2 : BitVec 8) : x_2 ^^^ x_1 ||| (x ||| x_1) = x ||| x_1 ||| x_2 := sorry - -theorem or_not_xor_common_op_commute0_thm (x x_1 x_2 : BitVec 4) : x_2 ^^^ 15#4 ||| x_1 ||| x_2 ^^^ x = x_2 &&& x ^^^ 15#4 ||| x_1 := sorry - -theorem or_not_xor_common_op_commute2_thm (x x_1 x_2 : BitVec 8) : - x_2 ^^^ x_1 ||| (-x ||| x_2 ^^^ 255#8) = x_2 &&& x_1 ^^^ 255#8 ||| -x := sorry - -theorem or_not_xor_common_op_commute3_thm (x x_1 x_2 : BitVec 8) : - -x_2 ||| x_1 ^^^ 255#8 ||| x_1 ^^^ x = x_1 &&& x ^^^ 255#8 ||| -x_2 := sorry - -theorem or_not_xor_common_op_commute5_thm (x x_1 x_2 : BitVec 8) : - x_2 ^^^ x_1 ||| (x_1 ^^^ 255#8 ||| x) = x_2 &&& x_1 ^^^ 255#8 ||| x := sorry - -theorem or_not_xor_common_op_commute6_thm (x x_1 x_2 : BitVec 8) : - x_2 ^^^ x_1 ||| (-x ||| x_1 ^^^ 255#8) = x_2 &&& x_1 ^^^ 255#8 ||| -x := sorry - -theorem or_not_xor_common_op_commute7_thm (x x_1 x_2 : BitVec 8) : - -x_2 ||| x_1 ^^^ 255#8 ||| x ^^^ x_1 = x &&& x_1 ^^^ 255#8 ||| -x_2 := sorry - -theorem or_nand_xor_common_op_commute0_thm (x x_1 x_2 : BitVec 4) : x_2 &&& x_1 ^^^ 15#4 ||| x_2 ^^^ x = x_2 &&& x_1 &&& x ^^^ 15#4 := sorry - -theorem PR75692_1_thm (x : BitVec 32) : x ^^^ 4#32 ||| x ^^^ 4294967291#32 = 4294967295#32 := sorry - -theorem or_xor_not_thm (x x_1 : BitVec 32) : x_1 ^^^ (x ^^^ 4294967295#32) ||| x = x_1 ^^^ 4294967295#32 ||| x := sorry - -theorem or_xor_and_commuted1_thm (x x_1 : BitVec 32) : - x_1 * x_1 ||| x_1 * x_1 ^^^ 4294967295#32 ^^^ x = x_1 * x_1 ||| x ^^^ 4294967295#32 := sorry - -theorem or_xor_and_commuted2_thm (x x_1 : BitVec 32) : - x_1 * x_1 ^^^ (x * x ^^^ 4294967295#32) ||| x * x = x * x ||| x_1 * x_1 ^^^ 4294967295#32 := sorry - -theorem or_xor_tree_0000_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x_1 * 42#32 ^^^ x * 42#32 ^^^ x_2 * 42#32 = - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 := sorry - -theorem or_xor_tree_0001_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x_2 * 42#32 ^^^ x * 42#32 ^^^ x_1 * 42#32 = - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 := sorry - -theorem or_xor_tree_0010_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 ^^^ x_1 * 42#32 ^^^ x_2 * 42#32 = - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 := sorry - -theorem or_xor_tree_0011_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 ^^^ x_2 * 42#32 ^^^ x_1 * 42#32 = - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 := sorry - -theorem or_xor_tree_0100_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x_2 * 42#32 ^^^ (x_1 * 42#32 ^^^ x * 42#32) = - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 := sorry - -theorem or_xor_tree_0101_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x_1 * 42#32 ^^^ (x_2 * 42#32 ^^^ x * 42#32) = - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 := sorry - -theorem or_xor_tree_0110_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x_2 * 42#32 ^^^ (x * 42#32 ^^^ x_1 * 42#32) = - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 := sorry - -theorem or_xor_tree_0111_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x_1 * 42#32 ^^^ (x * 42#32 ^^^ x_2 * 42#32) = - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 := sorry - -theorem or_xor_tree_1000_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ^^^ x * 42#32 ||| x * 42#32 ^^^ x_2 * 42#32 = - x * 42#32 ^^^ x_2 * 42#32 ||| x_1 * 42#32 := sorry - -theorem or_xor_tree_1001_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ^^^ x * 42#32 ||| x_2 * 42#32 ^^^ x * 42#32 = - x_2 * 42#32 ^^^ x * 42#32 ||| x_1 * 42#32 := sorry - -theorem or_xor_tree_1010_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ^^^ x * 42#32 ||| x * 42#32 ^^^ x_1 * 42#32 = - x * 42#32 ^^^ x_1 * 42#32 ||| x_2 * 42#32 := sorry - -theorem or_xor_tree_1011_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ x_1 * 42#32 ^^^ x * 42#32 ||| x_1 * 42#32 ^^^ x * 42#32 = - x_1 * 42#32 ^^^ x * 42#32 ||| x_2 * 42#32 := sorry - -theorem or_xor_tree_1100_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ (x_1 * 42#32 ^^^ x * 42#32) ||| x_2 * 42#32 ^^^ x_1 * 42#32 = - x_2 * 42#32 ^^^ x_1 * 42#32 ||| x * 42#32 := sorry - -theorem or_xor_tree_1101_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ (x_1 * 42#32 ^^^ x * 42#32) ||| x_1 * 42#32 ^^^ x_2 * 42#32 = - x_1 * 42#32 ^^^ x_2 * 42#32 ||| x * 42#32 := sorry - -theorem or_xor_tree_1110_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ (x_1 * 42#32 ^^^ x * 42#32) ||| x_2 * 42#32 ^^^ x * 42#32 = - x_2 * 42#32 ^^^ x * 42#32 ||| x_1 * 42#32 := sorry - -theorem or_xor_tree_1111_thm (x x_1 x_2 : BitVec 32) : - x_2 * 42#32 ^^^ (x_1 * 42#32 ^^^ x * 42#32) ||| x * 42#32 ^^^ x_2 * 42#32 = - x * 42#32 ^^^ x_2 * 42#32 ||| x_1 * 42#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gpr14365.lean b/SSA/Projects/InstCombine/tests/LLVM/gpr14365.lean index e41228427..5ef291f52 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gpr14365.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gpr14365.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gpr14365_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -43,7 +43,7 @@ theorem test0_proof : test0_before ⊑ test0_after := by intros try simp ---BEGIN test0 - apply test0_thm + all_goals (try extract_goal ; sorry) ---END test0 @@ -82,7 +82,7 @@ theorem test1_proof : test1_before ⊑ test1_after := by intros try simp ---BEGIN test1 - apply test1_thm + all_goals (try extract_goal ; sorry) ---END test1 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gpr14365_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gpr14365_proof.lean deleted file mode 100644 index 0dab48d61..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gpr14365_proof.lean +++ /dev/null @@ -1,12 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gpr14365_proof -theorem test0_thm (x : BitVec 32) : - x + ((x &&& 1431655765#32 ^^^ 4294967295#32) + 1#32) = x &&& 2863311530#32 := sorry - -theorem test1_thm (x : BitVec 32) : - x + ((x.sshiftRight 1 &&& 1431655765#32 ^^^ 4294967295#32) + 1#32) = x - (x >>> 1 &&& 1431655765#32) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gpr53357.lean b/SSA/Projects/InstCombine/tests/LLVM/gpr53357.lean index 72183d092..ac6059ba6 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gpr53357.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gpr53357.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gpr53357_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -42,7 +42,7 @@ theorem src_proof : src_before ⊑ src_after := by intros try simp ---BEGIN src - apply src_thm + all_goals (try extract_goal ; sorry) ---END src @@ -76,7 +76,7 @@ theorem src2_proof : src2_before ⊑ src2_after := by intros try simp ---BEGIN src2 - apply src2_thm + all_goals (try extract_goal ; sorry) ---END src2 @@ -111,7 +111,7 @@ theorem src3_proof : src3_before ⊑ src3_after := by intros try simp ---BEGIN src3 - apply src3_thm + all_goals (try extract_goal ; sorry) ---END src3 @@ -145,7 +145,7 @@ theorem src4_proof : src4_before ⊑ src4_after := by intros try simp ---BEGIN src4 - apply src4_thm + all_goals (try extract_goal ; sorry) ---END src4 @@ -179,7 +179,7 @@ theorem src5_proof : src5_before ⊑ src5_after := by intros try simp ---BEGIN src5 - apply src5_thm + all_goals (try extract_goal ; sorry) ---END src5 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gpr53357_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gpr53357_proof.lean deleted file mode 100644 index 1a87b0195..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gpr53357_proof.lean +++ /dev/null @@ -1,21 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gpr53357_proof -theorem src_thm (x x_1 : BitVec 32) : - (x_1 &&& x) + ((x_1 ||| x) ^^^ 4294967295#32) = x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem src2_thm (x x_1 : BitVec 32) : - (x_1 &&& x) + ((x ||| x_1) ^^^ 4294967295#32) = x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem src3_thm (x x_1 : BitVec 32) : - (x_1 &&& x) + ((x ^^^ 4294967295#32) &&& (x_1 ^^^ 4294967295#32)) = x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem src4_thm (x x_1 : BitVec 32) : - (x_1 &&& x) + ((x ||| x_1) ^^^ 4294967295#32) = x_1 ^^^ x ^^^ 4294967295#32 := sorry - -theorem src5_thm (x x_1 : BitVec 32) : - ((x_1 ||| x) ^^^ 4294967295#32) + (x_1 &&& x) = x_1 ^^^ x ^^^ 4294967295#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gpreservedhanalyses.lean b/SSA/Projects/InstCombine/tests/LLVM/gpreservedhanalyses.lean index dd6e072fa..d810ed6bb 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gpreservedhanalyses.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gpreservedhanalyses.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gpreservedhanalyses_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -38,7 +38,7 @@ theorem test_proof : test_before ⊑ test_after := by intros try simp ---BEGIN test - apply test_thm + all_goals (try extract_goal ; sorry) ---END test diff --git a/SSA/Projects/InstCombine/tests/LLVM/gpreservedhanalyses_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gpreservedhanalyses_proof.lean deleted file mode 100644 index ae25e2d0c..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gpreservedhanalyses_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gpreservedhanalyses_proof -theorem test_thm (x : BitVec 32) : x + 5#32 + 4294967291#32 = x := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gpullhbinophthroughhshift.lean b/SSA/Projects/InstCombine/tests/LLVM/gpullhbinophthroughhshift.lean index 05ce83979..e2f4a9e87 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gpullhbinophthroughhshift.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gpullhbinophthroughhshift.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gpullhbinophthroughhshift_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics diff --git a/SSA/Projects/InstCombine/tests/LLVM/gpullhbinophthroughhshift_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gpullhbinophthroughhshift_proof.lean deleted file mode 100644 index adab34e1e..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gpullhbinophthroughhshift_proof.lean +++ /dev/null @@ -1,6 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gpullhbinophthroughhshift_proof diff --git a/SSA/Projects/InstCombine/tests/LLVM/greassociatehnuw.lean b/SSA/Projects/InstCombine/tests/LLVM/greassociatehnuw.lean index f67b0c25e..b3d8a4654 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/greassociatehnuw.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/greassociatehnuw.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.greassociatehnuw_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -40,7 +40,7 @@ theorem reassoc_add_nuw_proof : reassoc_add_nuw_before ⊑ reassoc_add_nuw_after intros try simp ---BEGIN reassoc_add_nuw - apply reassoc_add_nuw_thm + all_goals (try extract_goal ; sorry) ---END reassoc_add_nuw @@ -72,7 +72,7 @@ theorem reassoc_sub_nuw_proof : reassoc_sub_nuw_before ⊑ reassoc_sub_nuw_after intros try simp ---BEGIN reassoc_sub_nuw - apply reassoc_sub_nuw_thm + all_goals (try extract_goal ; sorry) ---END reassoc_sub_nuw @@ -104,7 +104,7 @@ theorem reassoc_mul_nuw_proof : reassoc_mul_nuw_before ⊑ reassoc_mul_nuw_after intros try simp ---BEGIN reassoc_mul_nuw - apply reassoc_mul_nuw_thm + all_goals (try extract_goal ; sorry) ---END reassoc_mul_nuw @@ -136,7 +136,7 @@ theorem no_reassoc_add_nuw_none_proof : no_reassoc_add_nuw_none_before ⊑ no_re intros try simp ---BEGIN no_reassoc_add_nuw_none - apply no_reassoc_add_nuw_none_thm + all_goals (try extract_goal ; sorry) ---END no_reassoc_add_nuw_none @@ -168,7 +168,7 @@ theorem no_reassoc_add_none_nuw_proof : no_reassoc_add_none_nuw_before ⊑ no_re intros try simp ---BEGIN no_reassoc_add_none_nuw - apply no_reassoc_add_none_nuw_thm + all_goals (try extract_goal ; sorry) ---END no_reassoc_add_none_nuw @@ -202,7 +202,7 @@ theorem reassoc_x2_add_nuw_proof : reassoc_x2_add_nuw_before ⊑ reassoc_x2_add_ intros try simp ---BEGIN reassoc_x2_add_nuw - apply reassoc_x2_add_nuw_thm + all_goals (try extract_goal ; sorry) ---END reassoc_x2_add_nuw @@ -236,7 +236,7 @@ theorem reassoc_x2_mul_nuw_proof : reassoc_x2_mul_nuw_before ⊑ reassoc_x2_mul_ intros try simp ---BEGIN reassoc_x2_mul_nuw - apply reassoc_x2_mul_nuw_thm + all_goals (try extract_goal ; sorry) ---END reassoc_x2_mul_nuw @@ -270,7 +270,7 @@ theorem reassoc_x2_sub_nuw_proof : reassoc_x2_sub_nuw_before ⊑ reassoc_x2_sub_ intros try simp ---BEGIN reassoc_x2_sub_nuw - apply reassoc_x2_sub_nuw_thm + all_goals (try extract_goal ; sorry) ---END reassoc_x2_sub_nuw @@ -301,7 +301,7 @@ theorem tryFactorization_add_nuw_mul_nuw_proof : tryFactorization_add_nuw_mul_nu intros try simp ---BEGIN tryFactorization_add_nuw_mul_nuw - apply tryFactorization_add_nuw_mul_nuw_thm + all_goals (try extract_goal ; sorry) ---END tryFactorization_add_nuw_mul_nuw @@ -332,7 +332,7 @@ theorem tryFactorization_add_nuw_mul_nuw_int_max_proof : tryFactorization_add_nu intros try simp ---BEGIN tryFactorization_add_nuw_mul_nuw_int_max - apply tryFactorization_add_nuw_mul_nuw_int_max_thm + all_goals (try extract_goal ; sorry) ---END tryFactorization_add_nuw_mul_nuw_int_max @@ -363,7 +363,7 @@ theorem tryFactorization_add_mul_nuw_proof : tryFactorization_add_mul_nuw_before intros try simp ---BEGIN tryFactorization_add_mul_nuw - apply tryFactorization_add_mul_nuw_thm + all_goals (try extract_goal ; sorry) ---END tryFactorization_add_mul_nuw @@ -394,7 +394,7 @@ theorem tryFactorization_add_nuw_mul_proof : tryFactorization_add_nuw_mul_before intros try simp ---BEGIN tryFactorization_add_nuw_mul - apply tryFactorization_add_nuw_mul_thm + all_goals (try extract_goal ; sorry) ---END tryFactorization_add_nuw_mul @@ -412,7 +412,7 @@ def tryFactorization_add_nuw_mul_nuw_mul_nuw_var_after := [llvm| { ^0(%arg9 : i32, %arg10 : i32, %arg11 : i32): %0 = llvm.add %arg10, %arg11 : i32 - %1 = llvm.mul %0, %arg9 : i32 + %1 = llvm.mul %arg9, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -425,7 +425,7 @@ theorem tryFactorization_add_nuw_mul_nuw_mul_nuw_var_proof : tryFactorization_ad intros try simp ---BEGIN tryFactorization_add_nuw_mul_nuw_mul_nuw_var - apply tryFactorization_add_nuw_mul_nuw_mul_nuw_var_thm + all_goals (try extract_goal ; sorry) ---END tryFactorization_add_nuw_mul_nuw_mul_nuw_var @@ -443,7 +443,7 @@ def tryFactorization_add_nuw_mul_mul_nuw_var_after := [llvm| { ^0(%arg6 : i32, %arg7 : i32, %arg8 : i32): %0 = llvm.add %arg7, %arg8 : i32 - %1 = llvm.mul %0, %arg6 : i32 + %1 = llvm.mul %arg6, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -456,7 +456,7 @@ theorem tryFactorization_add_nuw_mul_mul_nuw_var_proof : tryFactorization_add_nu intros try simp ---BEGIN tryFactorization_add_nuw_mul_mul_nuw_var - apply tryFactorization_add_nuw_mul_mul_nuw_var_thm + all_goals (try extract_goal ; sorry) ---END tryFactorization_add_nuw_mul_mul_nuw_var @@ -474,7 +474,7 @@ def tryFactorization_add_nuw_mul_nuw_mul_var_after := [llvm| { ^0(%arg3 : i32, %arg4 : i32, %arg5 : i32): %0 = llvm.add %arg4, %arg5 : i32 - %1 = llvm.mul %0, %arg3 : i32 + %1 = llvm.mul %arg3, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -487,7 +487,7 @@ theorem tryFactorization_add_nuw_mul_nuw_mul_var_proof : tryFactorization_add_nu intros try simp ---BEGIN tryFactorization_add_nuw_mul_nuw_mul_var - apply tryFactorization_add_nuw_mul_nuw_mul_var_thm + all_goals (try extract_goal ; sorry) ---END tryFactorization_add_nuw_mul_nuw_mul_var @@ -505,7 +505,7 @@ def tryFactorization_add_mul_nuw_mul_var_after := [llvm| { ^0(%arg0 : i32, %arg1 : i32, %arg2 : i32): %0 = llvm.add %arg1, %arg2 : i32 - %1 = llvm.mul %0, %arg0 : i32 + %1 = llvm.mul %arg0, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -518,7 +518,7 @@ theorem tryFactorization_add_mul_nuw_mul_var_proof : tryFactorization_add_mul_nu intros try simp ---BEGIN tryFactorization_add_mul_nuw_mul_var - apply tryFactorization_add_mul_nuw_mul_var_thm + all_goals (try extract_goal ; sorry) ---END tryFactorization_add_mul_nuw_mul_var diff --git a/SSA/Projects/InstCombine/tests/LLVM/greassociatehnuw_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/greassociatehnuw_proof.lean deleted file mode 100644 index 3f9be0f6f..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/greassociatehnuw_proof.lean +++ /dev/null @@ -1,38 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section greassociatehnuw_proof -theorem reassoc_add_nuw_thm (x : BitVec 32) : x + 4#32 + 64#32 = x + 68#32 := sorry - -theorem reassoc_sub_nuw_thm (x : BitVec 32) : x - 4#32 - 64#32 = x + 4294967228#32 := sorry - -theorem reassoc_mul_nuw_thm (x : BitVec 32) : x * 4#32 * 65#32 = x * 260#32 := sorry - -theorem no_reassoc_add_nuw_none_thm (x : BitVec 32) : x + 4#32 + 64#32 = x + 68#32 := sorry - -theorem no_reassoc_add_none_nuw_thm (x : BitVec 32) : x + 4#32 + 64#32 = x + 68#32 := sorry - -theorem reassoc_x2_add_nuw_thm (x x_1 : BitVec 32) : x_1 + 4#32 + (x + 8#32) = x_1 + x + 12#32 := sorry - -theorem reassoc_x2_mul_nuw_thm (x x_1 : BitVec 32) : x_1 * 5#32 * (x * 9#32) = x_1 * x * 45#32 := sorry - -theorem reassoc_x2_sub_nuw_thm (x x_1 : BitVec 32) : x_1 - 4#32 - (x - 8#32) = x_1 - x + 4#32 := sorry - -theorem tryFactorization_add_nuw_mul_nuw_thm (x : BitVec 32) : x * 3#32 + x = x <<< 2 := sorry - -theorem tryFactorization_add_nuw_mul_nuw_int_max_thm (x : BitVec 32) : x * 2147483647#32 + x = x <<< 31 := sorry - -theorem tryFactorization_add_mul_nuw_thm (x : BitVec 32) : x * 3#32 + x = x <<< 2 := sorry - -theorem tryFactorization_add_nuw_mul_thm (x : BitVec 32) : x * 3#32 + x = x <<< 2 := sorry - -theorem tryFactorization_add_nuw_mul_nuw_mul_nuw_var_thm (x x_1 x_2 : BitVec 32) : x_2 * x_1 + x_2 * x = (x_1 + x) * x_2 := sorry - -theorem tryFactorization_add_nuw_mul_mul_nuw_var_thm (x x_1 x_2 : BitVec 32) : x_2 * x_1 + x_2 * x = (x_1 + x) * x_2 := sorry - -theorem tryFactorization_add_nuw_mul_nuw_mul_var_thm (x x_1 x_2 : BitVec 32) : x_2 * x_1 + x_2 * x = (x_1 + x) * x_2 := sorry - -theorem tryFactorization_add_mul_nuw_mul_var_thm (x x_1 x_2 : BitVec 32) : x_2 * x_1 + x_2 * x = (x_1 + x) * x_2 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/grem.lean b/SSA/Projects/InstCombine/tests/LLVM/grem.lean index f0eeb6a29..b136bd2d1 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/grem.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/grem.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.grem_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -12,18 +12,18 @@ set_option linter.deprecated false set_option linter.unreachableTactic false set_option linter.unusedTactic false section grem_statements - + def test1_before := [llvm| { -^0(%arg92 : i32): +^0(%arg104 : i32): %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %1 = llvm.srem %arg92, %0 : i32 + %1 = llvm.srem %arg104, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] def test1_after := [llvm| { -^0(%arg92 : i32): +^0(%arg104 : i32): %0 = "llvm.mlir.constant"() <{value = 0 : i32}> : () -> i32 "llvm.return"(%0) : (i32) -> () } @@ -37,24 +37,24 @@ theorem test1_proof : test1_before ⊑ test1_after := by intros try simp ---BEGIN test1 - apply test1_thm + all_goals (try extract_goal ; sorry) ---END test1 def test3_before := [llvm| { -^0(%arg91 : i32): +^0(%arg103 : i32): %0 = "llvm.mlir.constant"() <{value = 8 : i32}> : () -> i32 - %1 = llvm.urem %arg91, %0 : i32 + %1 = llvm.urem %arg103, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] def test3_after := [llvm| { -^0(%arg91 : i32): +^0(%arg103 : i32): %0 = "llvm.mlir.constant"() <{value = 7 : i32}> : () -> i32 - %1 = llvm.and %arg91, %0 : i32 + %1 = llvm.and %arg103, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -67,24 +67,24 @@ theorem test3_proof : test3_before ⊑ test3_after := by intros try simp ---BEGIN test3 - apply test3_thm + all_goals (try extract_goal ; sorry) ---END test3 def test7_before := [llvm| { -^0(%arg81 : i32): +^0(%arg93 : i32): %0 = "llvm.mlir.constant"() <{value = 8 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 4 : i32}> : () -> i32 - %2 = llvm.mul %arg81, %0 : i32 + %2 = llvm.mul %arg93, %0 : i32 %3 = llvm.srem %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def test7_after := [llvm| { -^0(%arg81 : i32): +^0(%arg93 : i32): %0 = "llvm.mlir.constant"() <{value = 0 : i32}> : () -> i32 "llvm.return"(%0) : (i32) -> () } @@ -98,24 +98,24 @@ theorem test7_proof : test7_before ⊑ test7_after := by intros try simp ---BEGIN test7 - apply test7_thm + all_goals (try extract_goal ; sorry) ---END test7 def test8_before := [llvm| { -^0(%arg80 : i32): +^0(%arg92 : i32): %0 = "llvm.mlir.constant"() <{value = 4 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 8 : i32}> : () -> i32 - %2 = llvm.shl %arg80, %0 : i32 + %2 = llvm.shl %arg92, %0 : i32 %3 = llvm.srem %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def test8_after := [llvm| { -^0(%arg80 : i32): +^0(%arg92 : i32): %0 = "llvm.mlir.constant"() <{value = 0 : i32}> : () -> i32 "llvm.return"(%0) : (i32) -> () } @@ -129,24 +129,24 @@ theorem test8_proof : test8_before ⊑ test8_after := by intros try simp ---BEGIN test8 - apply test8_thm + all_goals (try extract_goal ; sorry) ---END test8 def test9_before := [llvm| { -^0(%arg79 : i32): +^0(%arg91 : i32): %0 = "llvm.mlir.constant"() <{value = 64 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 32 : i32}> : () -> i32 - %2 = llvm.mul %arg79, %0 : i32 + %2 = llvm.mul %arg91, %0 : i32 %3 = llvm.urem %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def test9_after := [llvm| { -^0(%arg79 : i32): +^0(%arg91 : i32): %0 = "llvm.mlir.constant"() <{value = 0 : i32}> : () -> i32 "llvm.return"(%0) : (i32) -> () } @@ -160,18 +160,18 @@ theorem test9_proof : test9_before ⊑ test9_after := by intros try simp ---BEGIN test9 - apply test9_thm + all_goals (try extract_goal ; sorry) ---END test9 def test11_before := [llvm| { -^0(%arg77 : i32): +^0(%arg89 : i32): %0 = "llvm.mlir.constant"() <{value = -2 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 %2 = "llvm.mlir.constant"() <{value = 4 : i32}> : () -> i32 - %3 = llvm.and %arg77, %0 : i32 + %3 = llvm.and %arg89, %0 : i32 %4 = llvm.mul %3, %1 : i32 %5 = llvm.urem %4, %2 : i32 "llvm.return"(%5) : (i32) -> () @@ -179,7 +179,7 @@ def test11_before := [llvm| ] def test11_after := [llvm| { -^0(%arg77 : i32): +^0(%arg89 : i32): %0 = "llvm.mlir.constant"() <{value = 0 : i32}> : () -> i32 "llvm.return"(%0) : (i32) -> () } @@ -193,24 +193,24 @@ theorem test11_proof : test11_before ⊑ test11_after := by intros try simp ---BEGIN test11 - apply test11_thm + all_goals (try extract_goal ; sorry) ---END test11 def test12_before := [llvm| { -^0(%arg76 : i32): +^0(%arg88 : i32): %0 = "llvm.mlir.constant"() <{value = -4 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %2 = llvm.and %arg76, %0 : i32 + %2 = llvm.and %arg88, %0 : i32 %3 = llvm.srem %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def test12_after := [llvm| { -^0(%arg76 : i32): +^0(%arg88 : i32): %0 = "llvm.mlir.constant"() <{value = 0 : i32}> : () -> i32 "llvm.return"(%0) : (i32) -> () } @@ -224,21 +224,21 @@ theorem test12_proof : test12_before ⊑ test12_after := by intros try simp ---BEGIN test12 - apply test12_thm + all_goals (try extract_goal ; sorry) ---END test12 def test13_before := [llvm| { -^0(%arg75 : i32): - %0 = llvm.srem %arg75, %arg75 : i32 +^0(%arg87 : i32): + %0 = llvm.srem %arg87, %arg87 : i32 "llvm.return"(%0) : (i32) -> () } ] def test13_after := [llvm| { -^0(%arg75 : i32): +^0(%arg87 : i32): %0 = "llvm.mlir.constant"() <{value = 0 : i32}> : () -> i32 "llvm.return"(%0) : (i32) -> () } @@ -252,33 +252,33 @@ theorem test13_proof : test13_before ⊑ test13_after := by intros try simp ---BEGIN test13 - apply test13_thm + all_goals (try extract_goal ; sorry) ---END test13 def test16_before := [llvm| { -^0(%arg69 : i32, %arg70 : i32): +^0(%arg81 : i32, %arg82 : i32): %0 = "llvm.mlir.constant"() <{value = 11 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 4 : i32}> : () -> i32 - %2 = llvm.lshr %arg70, %0 : i32 + %2 = llvm.lshr %arg82, %0 : i32 %3 = llvm.and %2, %1 : i32 %4 = llvm.add %3, %1 : i32 - %5 = llvm.urem %arg69, %4 : i32 + %5 = llvm.urem %arg81, %4 : i32 "llvm.return"(%5) : (i32) -> () } ] def test16_after := [llvm| { -^0(%arg69 : i32, %arg70 : i32): +^0(%arg81 : i32, %arg82 : i32): %0 = "llvm.mlir.constant"() <{value = 11 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 4 : i32}> : () -> i32 %2 = "llvm.mlir.constant"() <{value = 3 : i32}> : () -> i32 - %3 = llvm.lshr %arg70, %0 : i32 + %3 = llvm.lshr %arg82, %0 : i32 %4 = llvm.and %3, %1 : i32 %5 = llvm.or %4, %2 : i32 - %6 = llvm.and %5, %arg69 : i32 + %6 = llvm.and %arg81, %5 : i32 "llvm.return"(%6) : (i32) -> () } ] @@ -291,25 +291,185 @@ theorem test16_proof : test16_before ⊑ test16_after := by intros try simp ---BEGIN test16 - apply test16_thm + all_goals (try extract_goal ; sorry) ---END test16 +def test19_before := [llvm| +{ +^0(%arg76 : i32, %arg77 : i32): + %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 + %1 = llvm.shl %0, %arg76 : i32 + %2 = llvm.shl %0, %arg77 : i32 + %3 = llvm.and %1, %2 : i32 + %4 = llvm.add %3, %1 : i32 + %5 = llvm.urem %arg77, %4 : i32 + "llvm.return"(%5) : (i32) -> () +} +] +def test19_after := [llvm| +{ +^0(%arg76 : i32, %arg77 : i32): + %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 + %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %2 = llvm.shl %0, %arg76 : i32 + %3 = llvm.shl %0, %arg77 : i32 + %4 = llvm.and %2, %3 : i32 + %5 = llvm.add %4, %2 : i32 + %6 = llvm.add %5, %1 : i32 + %7 = llvm.and %arg77, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +theorem test19_proof : test19_before ⊑ test19_after := by + unfold test19_before test19_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN test19 + all_goals (try extract_goal ; sorry) + ---END test19 + + + +def test19_commutative0_before := [llvm| +{ +^0(%arg74 : i32, %arg75 : i32): + %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 + %1 = llvm.shl %0, %arg74 : i32 + %2 = llvm.shl %0, %arg75 : i32 + %3 = llvm.and %2, %1 : i32 + %4 = llvm.add %3, %1 : i32 + %5 = llvm.urem %arg75, %4 : i32 + "llvm.return"(%5) : (i32) -> () +} +] +def test19_commutative0_after := [llvm| +{ +^0(%arg74 : i32, %arg75 : i32): + %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 + %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %2 = llvm.shl %0, %arg74 : i32 + %3 = llvm.shl %0, %arg75 : i32 + %4 = llvm.and %3, %2 : i32 + %5 = llvm.add %4, %2 : i32 + %6 = llvm.add %5, %1 : i32 + %7 = llvm.and %arg75, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +theorem test19_commutative0_proof : test19_commutative0_before ⊑ test19_commutative0_after := by + unfold test19_commutative0_before test19_commutative0_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN test19_commutative0 + all_goals (try extract_goal ; sorry) + ---END test19_commutative0 + + + +def test19_commutative1_before := [llvm| +{ +^0(%arg72 : i32, %arg73 : i32): + %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 + %1 = llvm.shl %0, %arg72 : i32 + %2 = llvm.shl %0, %arg73 : i32 + %3 = llvm.and %1, %2 : i32 + %4 = llvm.add %1, %3 : i32 + %5 = llvm.urem %arg73, %4 : i32 + "llvm.return"(%5) : (i32) -> () +} +] +def test19_commutative1_after := [llvm| +{ +^0(%arg72 : i32, %arg73 : i32): + %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 + %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %2 = llvm.shl %0, %arg72 : i32 + %3 = llvm.shl %0, %arg73 : i32 + %4 = llvm.and %2, %3 : i32 + %5 = llvm.add %2, %4 : i32 + %6 = llvm.add %5, %1 : i32 + %7 = llvm.and %arg73, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +theorem test19_commutative1_proof : test19_commutative1_before ⊑ test19_commutative1_after := by + unfold test19_commutative1_before test19_commutative1_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN test19_commutative1 + all_goals (try extract_goal ; sorry) + ---END test19_commutative1 + + + +def test19_commutative2_before := [llvm| +{ +^0(%arg70 : i32, %arg71 : i32): + %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 + %1 = llvm.shl %0, %arg70 : i32 + %2 = llvm.shl %0, %arg71 : i32 + %3 = llvm.and %2, %1 : i32 + %4 = llvm.add %1, %3 : i32 + %5 = llvm.urem %arg71, %4 : i32 + "llvm.return"(%5) : (i32) -> () +} +] +def test19_commutative2_after := [llvm| +{ +^0(%arg70 : i32, %arg71 : i32): + %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 + %1 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 + %2 = llvm.shl %0, %arg70 : i32 + %3 = llvm.shl %0, %arg71 : i32 + %4 = llvm.and %3, %2 : i32 + %5 = llvm.add %2, %4 : i32 + %6 = llvm.add %5, %1 : i32 + %7 = llvm.and %arg71, %6 : i32 + "llvm.return"(%7) : (i32) -> () +} +] +theorem test19_commutative2_proof : test19_commutative2_before ⊑ test19_commutative2_after := by + unfold test19_commutative2_before test19_commutative2_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN test19_commutative2 + all_goals (try extract_goal ; sorry) + ---END test19_commutative2 + + + def test22_before := [llvm| { -^0(%arg43 : i32): +^0(%arg55 : i32): %0 = "llvm.mlir.constant"() <{value = 2147483647 : i32}> : () -> i32 - %1 = llvm.and %arg43, %0 : i32 + %1 = llvm.and %arg55, %0 : i32 %2 = llvm.srem %1, %0 : i32 "llvm.return"(%2) : (i32) -> () } ] def test22_after := [llvm| { -^0(%arg43 : i32): +^0(%arg55 : i32): %0 = "llvm.mlir.constant"() <{value = 2147483647 : i32}> : () -> i32 - %1 = llvm.and %arg43, %0 : i32 + %1 = llvm.and %arg55, %0 : i32 %2 = llvm.urem %1, %0 : i32 "llvm.return"(%2) : (i32) -> () } @@ -323,5 +483,7 @@ theorem test22_proof : test22_before ⊑ test22_after := by intros try simp ---BEGIN test22 - apply test22_thm + all_goals (try extract_goal ; sorry) ---END test22 + + diff --git a/SSA/Projects/InstCombine/tests/LLVM/grem_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/grem_proof.lean deleted file mode 100644 index c6da1fbde..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/grem_proof.lean +++ /dev/null @@ -1,33 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section grem_proof -theorem test1_thm (x : BitVec 32) : x - x.sdiv 1#32 = 0#32 := sorry - -theorem test3_thm (x : BitVec 32) : BitVec.ofNat 32 (x.toNat % 8) = x &&& 7#32 := sorry - -theorem test7_thm (x : BitVec 32) : x * 8#32 - (x * 8#32).sdiv 4#32 * 4#32 = 0#32 := sorry - -theorem test8_thm (x : BitVec 32) : x <<< 4 - (x <<< 4).sdiv 8#32 * 8#32 = 0#32 := sorry - -theorem test9_thm (x : BitVec 32) : BitVec.ofNat 32 (x.toNat * 64 % 4294967296 % 32) = 0#32 := sorry - -theorem test11_thm (x : BitVec 32) : BitVec.ofNat 32 ((x.toNat &&& 4294967294) * 2 % 4294967296 % 4) = 0#32 := sorry - -theorem test12_thm (x : BitVec 32) : (x &&& 4294967292#32) - (x &&& 4294967292#32).sdiv 2#32 * 2#32 = 0#32 := sorry - -theorem test13_thm (x : BitVec 32) : - Option.map (fun div => x - div * x) (if x = 0#32 ∨ x = intMin 32 ∧ x = 4294967295#32 then none else some (x.sdiv x)) ⊑ - some 0#32 := sorry - -theorem test16_thm (x x_1 : BitVec 32) : - (if ((x.toNat >>> 11 &&& 4) + 4) % 4294967296 = 0 then none - else some (BitVec.ofNat 32 (x_1.toNat % (((x.toNat >>> 11 &&& 4) + 4) % 4294967296)))) ⊑ - some ((x >>> 11 &&& 4#32 ||| 3#32) &&& x_1) := sorry - -theorem test22_thm (x : BitVec 32) : - (x &&& 2147483647#32) - (x &&& 2147483647#32).sdiv 2147483647#32 * 2147483647#32 = - BitVec.ofNat 32 ((x.toNat &&& 2147483647) % 2147483647) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsdivhexacthbyhpowerhofhtwo.lean b/SSA/Projects/InstCombine/tests/LLVM/gsdivhexacthbyhpowerhofhtwo.lean index 84d58bc58..5d52db768 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gsdivhexacthbyhpowerhofhtwo.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gsdivhexacthbyhpowerhofhtwo.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gsdivhexacthbyhpowerhofhtwo_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -38,7 +38,7 @@ theorem t0_proof : t0_before ⊑ t0_after := by intros try simp ---BEGIN t0 - apply t0_thm + all_goals (try extract_goal ; sorry) ---END t0 @@ -68,7 +68,7 @@ theorem shl1_nsw_proof : shl1_nsw_before ⊑ shl1_nsw_after := by intros try simp ---BEGIN shl1_nsw - apply shl1_nsw_thm + all_goals (try extract_goal ; sorry) ---END shl1_nsw @@ -102,7 +102,7 @@ theorem prove_exact_with_high_mask_proof : prove_exact_with_high_mask_before ⊑ intros try simp ---BEGIN prove_exact_with_high_mask - apply prove_exact_with_high_mask_thm + all_goals (try extract_goal ; sorry) ---END prove_exact_with_high_mask @@ -134,7 +134,7 @@ theorem prove_exact_with_high_mask_limit_proof : prove_exact_with_high_mask_limi intros try simp ---BEGIN prove_exact_with_high_mask_limit - apply prove_exact_with_high_mask_limit_thm + all_goals (try extract_goal ; sorry) ---END prove_exact_with_high_mask_limit diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsdivhexacthbyhpowerhofhtwo_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gsdivhexacthbyhpowerhofhtwo_proof.lean deleted file mode 100644 index 19fae9ca2..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gsdivhexacthbyhpowerhofhtwo_proof.lean +++ /dev/null @@ -1,17 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gsdivhexacthbyhpowerhofhtwo_proof -theorem t0_thm (x : BitVec 8) : x.sdiv 32#8 = x.sshiftRight 5 := sorry - -theorem shl1_nsw_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (1#8 <<< x.toNat)) fun a => - if a = 0#8 ∨ x_1 = intMin 8 ∧ a = 255#8 then none else some (x_1.sdiv a)) ⊑ - if 8 ≤ x.toNat then none else some (x_1.sshiftRight x.toNat) := sorry - -theorem prove_exact_with_high_mask_thm (x : BitVec 8) : (x &&& 248#8).sdiv 4#8 = x.sshiftRight 2 &&& 254#8 := sorry - -theorem prove_exact_with_high_mask_limit_thm (x : BitVec 8) : (x &&& 248#8).sdiv 8#8 = x.sshiftRight 3 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshifthadd.lean b/SSA/Projects/InstCombine/tests/LLVM/gshifthadd.lean index 53894228a..1d1b5c958 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gshifthadd.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gshifthadd.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gshifthadd_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -41,7 +41,7 @@ theorem ashr_C1_add_A_C2_i32_proof : ashr_C1_add_A_C2_i32_before ⊑ ashr_C1_add intros try simp ---BEGIN ashr_C1_add_A_C2_i32 - apply ashr_C1_add_A_C2_i32_thm + all_goals (try extract_goal ; sorry) ---END ashr_C1_add_A_C2_i32 @@ -77,7 +77,7 @@ theorem lshr_C1_add_A_C2_i32_proof : lshr_C1_add_A_C2_i32_before ⊑ lshr_C1_add intros try simp ---BEGIN lshr_C1_add_A_C2_i32 - apply lshr_C1_add_A_C2_i32_thm + all_goals (try extract_goal ; sorry) ---END lshr_C1_add_A_C2_i32 @@ -109,7 +109,7 @@ theorem shl_add_nuw_proof : shl_add_nuw_before ⊑ shl_add_nuw_after := by intros try simp ---BEGIN shl_add_nuw - apply shl_add_nuw_thm + all_goals (try extract_goal ; sorry) ---END shl_add_nuw @@ -140,7 +140,7 @@ theorem shl_nuw_add_nuw_proof : shl_nuw_add_nuw_before ⊑ shl_nuw_add_nuw_after intros try simp ---BEGIN shl_nuw_add_nuw - apply shl_nuw_add_nuw_thm + all_goals (try extract_goal ; sorry) ---END shl_nuw_add_nuw @@ -172,7 +172,7 @@ theorem shl_nsw_add_nuw_proof : shl_nsw_add_nuw_before ⊑ shl_nsw_add_nuw_after intros try simp ---BEGIN shl_nsw_add_nuw - apply shl_nsw_add_nuw_thm + all_goals (try extract_goal ; sorry) ---END shl_nsw_add_nuw @@ -204,7 +204,7 @@ theorem lshr_exact_add_nuw_proof : lshr_exact_add_nuw_before ⊑ lshr_exact_add_ intros try simp ---BEGIN lshr_exact_add_nuw - apply lshr_exact_add_nuw_thm + all_goals (try extract_goal ; sorry) ---END lshr_exact_add_nuw diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshifthadd_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gshifthadd_proof.lean deleted file mode 100644 index 3ca9cceac..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gshifthadd_proof.lean +++ /dev/null @@ -1,32 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gshifthadd_proof -theorem ashr_C1_add_A_C2_i32_thm (x : BitVec 32) : - (if 32 ≤ ((x.toNat &&& 65535) + 5) % 4294967296 then none - else some ((6#32).sshiftRight (((x.toNat &&& 65535) + 5) % 4294967296))) ⊑ - some 0#32 := sorry - -theorem lshr_C1_add_A_C2_i32_thm (x : BitVec 32) : - (if 32 ≤ ((x.toNat &&& 65535) + 5) % 4294967296 then none - else some (6#32 <<< (((x.toNat &&& 65535) + 5) % 4294967296))) ⊑ - if 32 ≤ x.toNat &&& 65535 then none else some (192#32 <<< (x.toNat &&& 65535)) := sorry - -theorem shl_add_nuw_thm (x : BitVec 32) : - (if 32 ≤ (x.toNat + 5) % 4294967296 then none else some (6#32 <<< ((x.toNat + 5) % 4294967296))) ⊑ - if 32 ≤ x.toNat then none else some (192#32 <<< x.toNat) := sorry - -theorem shl_nuw_add_nuw_thm (x : BitVec 32) : - (if 32 ≤ (x.toNat + 1) % 4294967296 then none else some (1#32 <<< ((x.toNat + 1) % 4294967296))) ⊑ - if 32 ≤ x.toNat then none else some (2#32 <<< x.toNat) := sorry - -theorem shl_nsw_add_nuw_thm (x : BitVec 32) : - (if 32 ≤ (x.toNat + 1) % 4294967296 then none else some (4294967295#32 <<< ((x.toNat + 1) % 4294967296))) ⊑ - if 32 ≤ x.toNat then none else some (4294967294#32 <<< x.toNat) := sorry - -theorem lshr_exact_add_nuw_thm (x : BitVec 32) : - (if 32 ≤ (x.toNat + 1) % 4294967296 then none else some (4#32 >>> ((x.toNat + 1) % 4294967296))) ⊑ - if 32 ≤ x.toNat then none else some (2#32 >>> x.toNat) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshifthamounthreassociation.lean b/SSA/Projects/InstCombine/tests/LLVM/gshifthamounthreassociation.lean index 0bc344971..0f51ae3fe 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gshifthamounthreassociation.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gshifthamounthreassociation.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gshifthamounthreassociation_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshifthamounthreassociation_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gshifthamounthreassociation_proof.lean deleted file mode 100644 index 17d5a2b1a..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gshifthamounthreassociation_proof.lean +++ /dev/null @@ -1,6 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gshifthamounthreassociation_proof diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshifthlogic.lean b/SSA/Projects/InstCombine/tests/LLVM/gshifthlogic.lean index f50c670f4..278fb1081 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gshifthlogic.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gshifthlogic.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gshifthlogic_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -44,7 +44,7 @@ theorem shl_and_proof : shl_and_before ⊑ shl_and_after := by intros try simp ---BEGIN shl_and - apply shl_and_thm + all_goals (try extract_goal ; sorry) ---END shl_and @@ -84,7 +84,7 @@ theorem shl_or_proof : shl_or_before ⊑ shl_or_after := by intros try simp ---BEGIN shl_or - apply shl_or_thm + all_goals (try extract_goal ; sorry) ---END shl_or @@ -120,7 +120,7 @@ theorem shl_xor_proof : shl_xor_before ⊑ shl_xor_after := by intros try simp ---BEGIN shl_xor - apply shl_xor_thm + all_goals (try extract_goal ; sorry) ---END shl_xor @@ -160,7 +160,7 @@ theorem lshr_and_proof : lshr_and_before ⊑ lshr_and_after := by intros try simp ---BEGIN lshr_and - apply lshr_and_thm + all_goals (try extract_goal ; sorry) ---END lshr_and @@ -200,83 +200,11 @@ theorem ashr_xor_proof : ashr_xor_before ⊑ ashr_xor_after := by intros try simp ---BEGIN ashr_xor - apply ashr_xor_thm + all_goals (try extract_goal ; sorry) ---END ashr_xor -def shr_mismatch_xor_before := [llvm| -{ -^0(%arg44 : i32, %arg45 : i32): - %0 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 - %1 = "llvm.mlir.constant"() <{value = 7 : i32}> : () -> i32 - %2 = llvm.ashr %arg44, %0 : i32 - %3 = llvm.xor %arg45, %2 : i32 - %4 = llvm.lshr %3, %1 : i32 - "llvm.return"(%4) : (i32) -> () -} -] -def shr_mismatch_xor_after := [llvm| -{ -^0(%arg44 : i32, %arg45 : i32): - %0 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 - %1 = "llvm.mlir.constant"() <{value = 7 : i32}> : () -> i32 - %2 = llvm.ashr %arg44, %0 : i32 - %3 = llvm.xor %2, %arg45 : i32 - %4 = llvm.lshr %3, %1 : i32 - "llvm.return"(%4) : (i32) -> () -} -] -theorem shr_mismatch_xor_proof : shr_mismatch_xor_before ⊑ shr_mismatch_xor_after := by - unfold shr_mismatch_xor_before shr_mismatch_xor_after - simp_alive_peephole - simp_alive_undef - simp_alive_ops - simp_alive_case_bash - intros - try simp - ---BEGIN shr_mismatch_xor - apply shr_mismatch_xor_thm - ---END shr_mismatch_xor - - - -def ashr_overshift_xor_before := [llvm| -{ -^0(%arg42 : i32, %arg43 : i32): - %0 = "llvm.mlir.constant"() <{value = 15 : i32}> : () -> i32 - %1 = "llvm.mlir.constant"() <{value = 17 : i32}> : () -> i32 - %2 = llvm.ashr %arg42, %0 : i32 - %3 = llvm.xor %arg43, %2 : i32 - %4 = llvm.ashr %3, %1 : i32 - "llvm.return"(%4) : (i32) -> () -} -] -def ashr_overshift_xor_after := [llvm| -{ -^0(%arg42 : i32, %arg43 : i32): - %0 = "llvm.mlir.constant"() <{value = 15 : i32}> : () -> i32 - %1 = "llvm.mlir.constant"() <{value = 17 : i32}> : () -> i32 - %2 = llvm.ashr %arg42, %0 : i32 - %3 = llvm.xor %2, %arg43 : i32 - %4 = llvm.ashr %3, %1 : i32 - "llvm.return"(%4) : (i32) -> () -} -] -theorem ashr_overshift_xor_proof : ashr_overshift_xor_before ⊑ ashr_overshift_xor_after := by - unfold ashr_overshift_xor_before ashr_overshift_xor_after - simp_alive_peephole - simp_alive_undef - simp_alive_ops - simp_alive_case_bash - intros - try simp - ---BEGIN ashr_overshift_xor - apply ashr_overshift_xor_thm - ---END ashr_overshift_xor - - - def lshr_mul_before := [llvm| { ^0(%arg35 : i64): @@ -304,7 +232,7 @@ theorem lshr_mul_proof : lshr_mul_before ⊑ lshr_mul_after := by intros try simp ---BEGIN lshr_mul - apply lshr_mul_thm + all_goals (try extract_goal ; sorry) ---END lshr_mul @@ -336,7 +264,7 @@ theorem lshr_mul_nuw_nsw_proof : lshr_mul_nuw_nsw_before ⊑ lshr_mul_nuw_nsw_af intros try simp ---BEGIN lshr_mul_nuw_nsw - apply lshr_mul_nuw_nsw_thm + all_goals (try extract_goal ; sorry) ---END lshr_mul_nuw_nsw @@ -372,7 +300,7 @@ theorem shl_add_proof : shl_add_before ⊑ shl_add_after := by intros try simp ---BEGIN shl_add - apply shl_add_thm + all_goals (try extract_goal ; sorry) ---END shl_add @@ -408,7 +336,7 @@ theorem shl_sub_proof : shl_sub_before ⊑ shl_sub_after := by intros try simp ---BEGIN shl_sub - apply shl_sub_thm + all_goals (try extract_goal ; sorry) ---END shl_sub @@ -444,7 +372,7 @@ theorem shl_sub_no_commute_proof : shl_sub_no_commute_before ⊑ shl_sub_no_comm intros try simp ---BEGIN shl_sub_no_commute - apply shl_sub_no_commute_thm + all_goals (try extract_goal ; sorry) ---END shl_sub_no_commute diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshifthlogic_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gshifthlogic_proof.lean deleted file mode 100644 index d619f8881..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gshifthlogic_proof.lean +++ /dev/null @@ -1,35 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gshifthlogic_proof -theorem shl_and_thm (x x_1 : BitVec 8) : (x_1 <<< 3 &&& x) <<< 2 = x_1 <<< 5 &&& x <<< 2 := sorry - -theorem shl_or_thm (x x_1 : BitVec 16) : - (x_1 - x_1.sdiv 42#16 * 42#16 ||| x <<< 5) <<< 7 = x <<< 12 ||| (x_1 - x_1.sdiv 42#16 * 42#16) <<< 7 := sorry - -theorem shl_xor_thm (x x_1 : BitVec 32) : (x_1 <<< 5 ^^^ x) <<< 7 = x_1 <<< 12 ^^^ x <<< 7 := sorry - -theorem lshr_and_thm (x x_1 : BitVec 64) : - (x_1 - x_1.sdiv 42#64 * 42#64 &&& x >>> 5) >>> 7 = x >>> 12 &&& (x_1 - x_1.sdiv 42#64 * 42#64) >>> 7 := sorry - -theorem ashr_xor_thm (x x_1 : BitVec 32) : - (x_1 - x_1.sdiv 42#32 * 42#32 ^^^ x.sshiftRight 5).sshiftRight 7 = - x.sshiftRight 12 ^^^ (x_1 - x_1.sdiv 42#32 * 42#32).sshiftRight 7 := sorry - -theorem shr_mismatch_xor_thm (x x_1 : BitVec 32) : (x_1 ^^^ x.sshiftRight 5) >>> 7 = (x.sshiftRight 5 ^^^ x_1) >>> 7 := sorry - -theorem ashr_overshift_xor_thm (x x_1 : BitVec 32) : - (x_1 ^^^ x.sshiftRight 15).sshiftRight 17 = (x.sshiftRight 15 ^^^ x_1).sshiftRight 17 := sorry - -theorem lshr_mul_thm (x : BitVec 64) : (x * 52#64) >>> 2 = x * 13#64 := sorry - -theorem lshr_mul_nuw_nsw_thm (x : BitVec 64) : (x * 52#64) >>> 2 = x * 13#64 := sorry - -theorem shl_add_thm (x x_1 : BitVec 8) : (x_1 <<< 3 + x) <<< 2 = x_1 <<< 5 + x <<< 2 := sorry - -theorem shl_sub_thm (x x_1 : BitVec 8) : (x_1 <<< 3 - x) <<< 2 = x_1 <<< 5 - x <<< 2 := sorry - -theorem shl_sub_no_commute_thm (x x_1 : BitVec 8) : (x_1 - x <<< 3) <<< 2 = x_1 <<< 2 - x <<< 5 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshifthshift.lean b/SSA/Projects/InstCombine/tests/LLVM/gshifthshift.lean index 22df2439a..3a574ab04 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gshifthshift.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gshifthshift.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gshifthshift_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -39,7 +39,7 @@ theorem shl_shl_proof : shl_shl_before ⊑ shl_shl_after := by intros try simp ---BEGIN shl_shl - apply shl_shl_thm + all_goals (try extract_goal ; sorry) ---END shl_shl @@ -70,7 +70,7 @@ theorem lshr_lshr_proof : lshr_lshr_before ⊑ lshr_lshr_after := by intros try simp ---BEGIN lshr_lshr - apply lshr_lshr_thm + all_goals (try extract_goal ; sorry) ---END lshr_lshr @@ -106,7 +106,7 @@ theorem shl_lshr_demand1_proof : shl_lshr_demand1_before ⊑ shl_lshr_demand1_af intros try simp ---BEGIN shl_lshr_demand1 - apply shl_lshr_demand1_thm + all_goals (try extract_goal ; sorry) ---END shl_lshr_demand1 @@ -142,7 +142,7 @@ theorem shl_lshr_demand6_proof : shl_lshr_demand6_before ⊑ shl_lshr_demand6_af intros try simp ---BEGIN shl_lshr_demand6 - apply shl_lshr_demand6_thm + all_goals (try extract_goal ; sorry) ---END shl_lshr_demand6 @@ -178,7 +178,7 @@ theorem lshr_shl_demand1_proof : lshr_shl_demand1_before ⊑ lshr_shl_demand1_af intros try simp ---BEGIN lshr_shl_demand1 - apply lshr_shl_demand1_thm + all_goals (try extract_goal ; sorry) ---END lshr_shl_demand1 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshifthshift_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gshifthshift_proof.lean deleted file mode 100644 index e519dac94..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gshifthshift_proof.lean +++ /dev/null @@ -1,22 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gshifthshift_proof -theorem shl_shl_thm (x : BitVec 32) : x <<< 34 = 0#32 := sorry - -theorem lshr_lshr_thm (x : BitVec 232) : x >>> 232 = 0#232 := sorry - -theorem shl_lshr_demand1_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (40#8 <<< x.toNat)) fun a => some (a >>> 3 ||| 224#8)) ⊑ - Option.bind (if 8 ≤ x.toNat then none else some (5#8 <<< x.toNat)) fun a => some (a ||| 224#8) := sorry - -theorem shl_lshr_demand6_thm (x : BitVec 16) : - (Option.bind (if 16 ≤ x.toNat then none else some (32912#16 <<< x.toNat)) fun a => some (a >>> 4 &&& 4094#16)) ⊑ - Option.bind (if 16 ≤ x.toNat then none else some (2057#16 <<< x.toNat)) fun a => some (a &&& 4094#16) := sorry - -theorem lshr_shl_demand1_thm (x : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (28#8 >>> x.toNat)) fun a => some (a <<< 3 ||| 7#8)) ⊑ - Option.bind (if 8 ≤ x.toNat then none else some (224#8 >>> x.toNat)) fun a => some (a ||| 7#8) := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshifthsra.lean b/SSA/Projects/InstCombine/tests/LLVM/gshifthsra.lean index c5e44d712..82565262d 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gshifthsra.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gshifthsra.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gshifthsra_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -40,7 +40,7 @@ theorem ashr_ashr_proof : ashr_ashr_before ⊑ ashr_ashr_after := by intros try simp ---BEGIN ashr_ashr - apply ashr_ashr_thm + all_goals (try extract_goal ; sorry) ---END ashr_ashr @@ -72,7 +72,7 @@ theorem ashr_overshift_proof : ashr_overshift_before ⊑ ashr_overshift_after := intros try simp ---BEGIN ashr_overshift - apply ashr_overshift_thm + all_goals (try extract_goal ; sorry) ---END ashr_overshift diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshifthsra_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gshifthsra_proof.lean deleted file mode 100644 index 88d580529..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gshifthsra_proof.lean +++ /dev/null @@ -1,10 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gshifthsra_proof -theorem ashr_ashr_thm (x : BitVec 32) : (x.sshiftRight 5).sshiftRight 7 = x.sshiftRight 12 := sorry - -theorem ashr_overshift_thm (x : BitVec 32) : (x.sshiftRight 15).sshiftRight 17 = x.sshiftRight 31 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshlhbo.lean b/SSA/Projects/InstCombine/tests/LLVM/gshlhbo.lean index eb855f379..de4232826 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gshlhbo.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gshlhbo.lean @@ -33,7 +33,7 @@ def lshr_add_after := [llvm| %2 = "llvm.mlir.constant"() <{value = -32 : i8}> : () -> i8 %3 = llvm.srem %arg81, %0 : i8 %4 = llvm.shl %3, %1 : i8 - %5 = llvm.add %4, %arg82 : i8 + %5 = llvm.add %arg82, %4 : i8 %6 = llvm.and %5, %2 : i8 "llvm.return"(%6) : (i8) -> () } @@ -71,7 +71,7 @@ def lshr_and_after := [llvm| %1 = "llvm.mlir.constant"() <{value = 6 : i8}> : () -> i8 %2 = llvm.srem %arg73, %0 : i8 %3 = llvm.shl %2, %1 : i8 - %4 = llvm.and %3, %arg74 : i8 + %4 = llvm.and %arg74, %3 : i8 "llvm.return"(%4) : (i8) -> () } ] @@ -110,7 +110,7 @@ def lshr_or_after := [llvm| %3 = llvm.srem %arg69, %0 : i8 %4 = llvm.shl %3, %1 : i8 %5 = llvm.and %arg70, %2 : i8 - %6 = llvm.or %4, %5 : i8 + %6 = llvm.or %5, %4 : i8 "llvm.return"(%6) : (i8) -> () } ] @@ -149,7 +149,7 @@ def lshr_xor_after := [llvm| %3 = llvm.srem %arg65, %0 : i8 %4 = llvm.shl %3, %1 : i8 %5 = llvm.and %arg66, %2 : i8 - %6 = llvm.xor %4, %5 : i8 + %6 = llvm.xor %5, %4 : i8 "llvm.return"(%6) : (i8) -> () } ] diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshlhbo_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gshlhbo_proof.lean index 4ae5e29a2..668d54955 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gshlhbo_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gshlhbo_proof.lean @@ -5,19 +5,20 @@ open BitVec section gshlhbo_proof theorem lshr_add_thm (x x_1 : BitVec 8) : - (x_1 >>> 5 + (x - x.sdiv 42#8 * 42#8)) <<< 5 = (x - x.sdiv 42#8 * 42#8) <<< 5 + x_1 &&& 224#8 := sorry + (x_1 &&& 224#8) + (x - x.sdiv 42#8 * 42#8) <<< 5 = x_1 + (x - x.sdiv 42#8 * 42#8) <<< 5 &&& 224#8 := sorry theorem lshr_and_thm (x x_1 : BitVec 8) : - (x_1 >>> 6 &&& x - x.sdiv 42#8 * 42#8) <<< 6 = (x - x.sdiv 42#8 * 42#8) <<< 6 &&& x_1 := sorry + (x_1 >>> 6 &&& x - x.sdiv 42#8 * 42#8) <<< 6 = x_1 &&& (x - x.sdiv 42#8 * 42#8) <<< 6 := sorry theorem lshr_or_thm (x x_1 : BitVec 8) : - (x_1 - x_1.sdiv 42#8 * 42#8 ||| x >>> 4) <<< 4 = (x_1 - x_1.sdiv 42#8 * 42#8) <<< 4 ||| x &&& 240#8 := sorry + (x_1 - x_1.sdiv 42#8 * 42#8 ||| x >>> 4) <<< 4 = x &&& 240#8 ||| (x_1 - x_1.sdiv 42#8 * 42#8) <<< 4 := sorry theorem lshr_xor_thm (x x_1 : BitVec 8) : - (x_1 >>> 3 ^^^ x - x.sdiv 42#8 * 42#8) <<< 3 = (x - x.sdiv 42#8 * 42#8) <<< 3 ^^^ x_1 &&& 248#8 := sorry + (x_1 >>> 3 ^^^ x - x.sdiv 42#8 * 42#8) <<< 3 = x_1 &&& 248#8 ^^^ (x - x.sdiv 42#8 * 42#8) <<< 3 := sorry theorem lshr_and_add_thm (x x_1 : BitVec 8) : - (x_1 - x_1.sdiv 42#8 * 42#8 + (x >>> 3 &&& 12#8)) <<< 3 = (x &&& 96#8) + (x_1 - x_1.sdiv 42#8 * 42#8) <<< 3 := sorry + (x_1 - x_1.sdiv 42#8 * 42#8) <<< 3 + (x >>> 3 &&& 12#8) <<< 3 = + (x &&& 96#8) + (x_1 - x_1.sdiv 42#8 * 42#8) <<< 3 := sorry theorem lshr_and_and_thm (x x_1 : BitVec 8) : (x_1 >>> 2 &&& 13#8 &&& x - x.sdiv 42#8 * 42#8) <<< 2 = x_1 &&& 52#8 &&& (x - x.sdiv 42#8 * 42#8) <<< 2 := sorry @@ -35,7 +36,7 @@ theorem ashr_and_or_disjoint_thm (x x_1 : BitVec 8) : theorem lshr_and_xor_thm (x x_1 : BitVec 8) : (x_1 >>> 2 &&& 13#8 ^^^ x - x.sdiv 42#8 * 42#8) <<< 2 = x_1 &&& 52#8 ^^^ (x - x.sdiv 42#8 * 42#8) <<< 2 := sorry -theorem lshr_add_and_shl_thm (x x_1 : BitVec 32) : (x_1 + (x >>> 5 &&& 127#32)) <<< 5 = (x &&& 4064#32) + x_1 <<< 5 := sorry +theorem lshr_add_and_shl_thm (x x_1 : BitVec 32) : x_1 <<< 5 + (x >>> 5 &&& 127#32) <<< 5 = (x &&& 4064#32) + x_1 <<< 5 := sorry -theorem shl_add_and_lshr_thm (x x_1 : BitVec 32) : ((x_1 >>> 4 &&& 8#32) + x) <<< 4 = (x_1 &&& 128#32) + x <<< 4 := sorry +theorem shl_add_and_lshr_thm (x : BitVec 32) : (x >>> 4 &&& 8#32) <<< 4 = x &&& 128#32 := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshlhfactor_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gshlhfactor_proof.lean index 6abbe0a58..507f144a1 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gshlhfactor_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gshlhfactor_proof.lean @@ -7,32 +7,32 @@ section gshlhfactor_proof theorem add_shl_same_amount_thm (x x_1 x_2 : BitVec 6) : (Option.bind (if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => Option.bind (if 6 ≤ x_1.toNat then none else some (x <<< x_1.toNat)) fun a_1 => some (a + a_1)) ⊑ - if 6 ≤ x_1.toNat then none else some ((x_2 + x) <<< x_1.toNat) := sorry + if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat + x <<< x_1.toNat) := sorry theorem add_shl_same_amount_nuw_thm (x x_1 x_2 : BitVec 64) : (Option.bind (if 64 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => Option.bind (if 64 ≤ x_1.toNat then none else some (x <<< x_1.toNat)) fun a_1 => some (a + a_1)) ⊑ - if 64 ≤ x_1.toNat then none else some ((x_2 + x) <<< x_1.toNat) := sorry + if 64 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat + x <<< x_1.toNat) := sorry theorem add_shl_same_amount_partial_nsw1_thm (x x_1 x_2 : BitVec 6) : (Option.bind (if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => Option.bind (if 6 ≤ x_1.toNat then none else some (x <<< x_1.toNat)) fun a_1 => some (a + a_1)) ⊑ - if 6 ≤ x_1.toNat then none else some ((x_2 + x) <<< x_1.toNat) := sorry + if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat + x <<< x_1.toNat) := sorry theorem add_shl_same_amount_partial_nsw2_thm (x x_1 x_2 : BitVec 6) : (Option.bind (if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => Option.bind (if 6 ≤ x_1.toNat then none else some (x <<< x_1.toNat)) fun a_1 => some (a + a_1)) ⊑ - if 6 ≤ x_1.toNat then none else some ((x_2 + x) <<< x_1.toNat) := sorry + if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat + x <<< x_1.toNat) := sorry theorem add_shl_same_amount_partial_nuw1_thm (x x_1 x_2 : BitVec 6) : (Option.bind (if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => Option.bind (if 6 ≤ x_1.toNat then none else some (x <<< x_1.toNat)) fun a_1 => some (a + a_1)) ⊑ - if 6 ≤ x_1.toNat then none else some ((x_2 + x) <<< x_1.toNat) := sorry + if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat + x <<< x_1.toNat) := sorry theorem add_shl_same_amount_partial_nuw2_thm (x x_1 x_2 : BitVec 6) : (Option.bind (if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => Option.bind (if 6 ≤ x_1.toNat then none else some (x <<< x_1.toNat)) fun a_1 => some (a + a_1)) ⊑ - if 6 ≤ x_1.toNat then none else some ((x_2 + x) <<< x_1.toNat) := sorry + if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat + x <<< x_1.toNat) := sorry theorem sub_shl_same_amount_thm (x x_1 x_2 : BitVec 6) : (Option.bind (if 6 ≤ x_1.toNat then none else some (x_2 <<< x_1.toNat)) fun a => diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshlhsub.lean b/SSA/Projects/InstCombine/tests/LLVM/gshlhsub.lean index 4ba6f1399..c11cc9f6a 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gshlhsub.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gshlhsub.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gshlhsub_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics diff --git a/SSA/Projects/InstCombine/tests/LLVM/gshlhsub_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gshlhsub_proof.lean deleted file mode 100644 index 2030b7392..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gshlhsub_proof.lean +++ /dev/null @@ -1,6 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gshlhsub_proof diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsignext.lean b/SSA/Projects/InstCombine/tests/LLVM/gsignext.lean index 060047d77..bd0ee15cb 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gsignext.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gsignext.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gsignext_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -43,7 +43,7 @@ theorem sextinreg_proof : sextinreg_before ⊑ sextinreg_after := by intros try simp ---BEGIN sextinreg - apply sextinreg_thm + all_goals (try extract_goal ; sorry) ---END sextinreg @@ -78,7 +78,7 @@ theorem sextinreg_alt_proof : sextinreg_alt_before ⊑ sextinreg_alt_after := by intros try simp ---BEGIN sextinreg_alt - apply sextinreg_alt_thm + all_goals (try extract_goal ; sorry) ---END sextinreg_alt @@ -113,7 +113,7 @@ theorem sextinreg2_proof : sextinreg2_before ⊑ sextinreg2_after := by intros try simp ---BEGIN sextinreg2 - apply sextinreg2_thm + all_goals (try extract_goal ; sorry) ---END sextinreg2 @@ -147,7 +147,7 @@ theorem ashr_proof : ashr_before ⊑ ashr_after := by intros try simp ---BEGIN ashr - apply ashr_thm + all_goals (try extract_goal ; sorry) ---END ashr diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsignext_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gsignext_proof.lean deleted file mode 100644 index 13792d627..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gsignext_proof.lean +++ /dev/null @@ -1,14 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gsignext_proof -theorem sextinreg_thm (x : BitVec 32) : (x &&& 65535#32 ^^^ 4294934528#32) + 32768#32 = (x <<< 16).sshiftRight 16 := sorry - -theorem sextinreg_alt_thm (x : BitVec 32) : (x &&& 65535#32 ^^^ 32768#32) + 4294934528#32 = (x <<< 16).sshiftRight 16 := sorry - -theorem sextinreg2_thm (x : BitVec 32) : (x &&& 255#32 ^^^ 128#32) + 4294967168#32 = (x <<< 24).sshiftRight 24 := sorry - -theorem ashr_thm (x : BitVec 32) : (x >>> 5 ^^^ 67108864#32) + 4227858432#32 = x.sshiftRight 5 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsubhfromhsub.lean b/SSA/Projects/InstCombine/tests/LLVM/gsubhfromhsub.lean index efc6f6c9b..195bad448 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gsubhfromhsub.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gsubhfromhsub.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gsubhfromhsub_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -38,7 +38,7 @@ theorem t0_proof : t0_before ⊑ t0_after := by intros try simp ---BEGIN t0 - apply t0_thm + all_goals (try extract_goal ; sorry) ---END t0 @@ -68,7 +68,7 @@ theorem t1_flags_proof : t1_flags_before ⊑ t1_flags_after := by intros try simp ---BEGIN t1_flags - apply t1_flags_thm + all_goals (try extract_goal ; sorry) ---END t1_flags @@ -98,7 +98,7 @@ theorem t1_flags_nuw_only_proof : t1_flags_nuw_only_before ⊑ t1_flags_nuw_only intros try simp ---BEGIN t1_flags_nuw_only - apply t1_flags_nuw_only_thm + all_goals (try extract_goal ; sorry) ---END t1_flags_nuw_only @@ -128,7 +128,7 @@ theorem t1_flags_sub_nsw_sub_proof : t1_flags_sub_nsw_sub_before ⊑ t1_flags_su intros try simp ---BEGIN t1_flags_sub_nsw_sub - apply t1_flags_sub_nsw_sub_thm + all_goals (try extract_goal ; sorry) ---END t1_flags_sub_nsw_sub @@ -158,7 +158,7 @@ theorem t1_flags_nuw_first_proof : t1_flags_nuw_first_before ⊑ t1_flags_nuw_fi intros try simp ---BEGIN t1_flags_nuw_first - apply t1_flags_nuw_first_thm + all_goals (try extract_goal ; sorry) ---END t1_flags_nuw_first @@ -188,7 +188,7 @@ theorem t1_flags_nuw_second_proof : t1_flags_nuw_second_before ⊑ t1_flags_nuw_ intros try simp ---BEGIN t1_flags_nuw_second - apply t1_flags_nuw_second_thm + all_goals (try extract_goal ; sorry) ---END t1_flags_nuw_second @@ -218,7 +218,7 @@ theorem t1_flags_nuw_nsw_first_proof : t1_flags_nuw_nsw_first_before ⊑ t1_flag intros try simp ---BEGIN t1_flags_nuw_nsw_first - apply t1_flags_nuw_nsw_first_thm + all_goals (try extract_goal ; sorry) ---END t1_flags_nuw_nsw_first @@ -248,7 +248,7 @@ theorem t1_flags_nuw_nsw_second_proof : t1_flags_nuw_nsw_second_before ⊑ t1_fl intros try simp ---BEGIN t1_flags_nuw_nsw_second - apply t1_flags_nuw_nsw_second_thm + all_goals (try extract_goal ; sorry) ---END t1_flags_nuw_nsw_second @@ -280,7 +280,7 @@ theorem t3_c0_proof : t3_c0_before ⊑ t3_c0_after := by intros try simp ---BEGIN t3_c0 - apply t3_c0_thm + all_goals (try extract_goal ; sorry) ---END t3_c0 @@ -312,7 +312,7 @@ theorem t4_c1_proof : t4_c1_before ⊑ t4_c1_after := by intros try simp ---BEGIN t4_c1 - apply t4_c1_thm + all_goals (try extract_goal ; sorry) ---END t4_c1 @@ -344,7 +344,7 @@ theorem t5_c2_proof : t5_c2_before ⊑ t5_c2_after := by intros try simp ---BEGIN t5_c2 - apply t5_c2_thm + all_goals (try extract_goal ; sorry) ---END t5_c2 @@ -376,7 +376,7 @@ theorem t9_c0_c2_proof : t9_c0_c2_before ⊑ t9_c0_c2_after := by intros try simp ---BEGIN t9_c0_c2 - apply t9_c0_c2_thm + all_goals (try extract_goal ; sorry) ---END t9_c0_c2 @@ -408,7 +408,7 @@ theorem t10_c1_c2_proof : t10_c1_c2_before ⊑ t10_c1_c2_after := by intros try simp ---BEGIN t10_c1_c2 - apply t10_c1_c2_thm + all_goals (try extract_goal ; sorry) ---END t10_c1_c2 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsubhfromhsub_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gsubhfromhsub_proof.lean deleted file mode 100644 index 0030e1475..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gsubhfromhsub_proof.lean +++ /dev/null @@ -1,32 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gsubhfromhsub_proof -theorem t0_thm (x x_1 x_2 : BitVec 8) : x_2 - x_1 - x = x_2 - (x_1 + x) := sorry - -theorem t1_flags_thm (x x_1 x_2 : BitVec 8) : x_2 - x_1 - x = x_2 - (x_1 + x) := sorry - -theorem t1_flags_nuw_only_thm (x x_1 x_2 : BitVec 8) : x_2 - x_1 - x = x_2 - (x_1 + x) := sorry - -theorem t1_flags_sub_nsw_sub_thm (x x_1 x_2 : BitVec 8) : x_2 - x_1 - x = x_2 - (x_1 + x) := sorry - -theorem t1_flags_nuw_first_thm (x x_1 x_2 : BitVec 8) : x_2 - x_1 - x = x_2 - (x_1 + x) := sorry - -theorem t1_flags_nuw_second_thm (x x_1 x_2 : BitVec 8) : x_2 - x_1 - x = x_2 - (x_1 + x) := sorry - -theorem t1_flags_nuw_nsw_first_thm (x x_1 x_2 : BitVec 8) : x_2 - x_1 - x = x_2 - (x_1 + x) := sorry - -theorem t1_flags_nuw_nsw_second_thm (x x_1 x_2 : BitVec 8) : x_2 - x_1 - x = x_2 - (x_1 + x) := sorry - -theorem t3_c0_thm (x x_1 : BitVec 8) : 42#8 - x_1 - x = 42#8 - (x_1 + x) := sorry - -theorem t4_c1_thm (x : BitVec 8) : x - 42#8 = x + 214#8 := sorry - -theorem t5_c2_thm (x x_1 : BitVec 8) : x_1 - x - 42#8 = x_1 - x + 214#8 := sorry - -theorem t9_c0_c2_thm (x : BitVec 8) : 42#8 - x - 24#8 = 18#8 - x := sorry - -theorem t10_c1_c2_thm (x : BitVec 8) : x - 42#8 - 24#8 = x + 190#8 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsubhnot.lean b/SSA/Projects/InstCombine/tests/LLVM/gsubhnot.lean index 65523e255..9e119b50a 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gsubhnot.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gsubhnot.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gsubhnot_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -27,7 +27,7 @@ def sub_not_after := [llvm| ^0(%arg22 : i8, %arg23 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg22, %0 : i8 - %2 = llvm.add %1, %arg23 : i8 + %2 = llvm.add %arg23, %1 : i8 "llvm.return"(%2) : (i8) -> () } ] @@ -40,7 +40,7 @@ theorem sub_not_proof : sub_not_before ⊑ sub_not_after := by intros try simp ---BEGIN sub_not - apply sub_not_thm + all_goals (try extract_goal ; sorry) ---END sub_not @@ -59,7 +59,7 @@ def dec_sub_after := [llvm| ^0(%arg16 : i8, %arg17 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg17, %0 : i8 - %2 = llvm.add %1, %arg16 : i8 + %2 = llvm.add %arg16, %1 : i8 "llvm.return"(%2) : (i8) -> () } ] @@ -72,7 +72,7 @@ theorem dec_sub_proof : dec_sub_before ⊑ dec_sub_after := by intros try simp ---BEGIN dec_sub - apply dec_sub_thm + all_goals (try extract_goal ; sorry) ---END dec_sub @@ -91,7 +91,7 @@ def sub_inc_after := [llvm| ^0(%arg10 : i8, %arg11 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg10, %0 : i8 - %2 = llvm.add %1, %arg11 : i8 + %2 = llvm.add %arg11, %1 : i8 "llvm.return"(%2) : (i8) -> () } ] @@ -104,7 +104,7 @@ theorem sub_inc_proof : sub_inc_before ⊑ sub_inc_after := by intros try simp ---BEGIN sub_inc - apply sub_inc_thm + all_goals (try extract_goal ; sorry) ---END sub_inc @@ -123,7 +123,7 @@ def sub_dec_after := [llvm| ^0(%arg4 : i8, %arg5 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg5, %0 : i8 - %2 = llvm.add %1, %arg4 : i8 + %2 = llvm.add %arg4, %1 : i8 "llvm.return"(%2) : (i8) -> () } ] @@ -136,7 +136,7 @@ theorem sub_dec_proof : sub_dec_before ⊑ sub_dec_after := by intros try simp ---BEGIN sub_dec - apply sub_dec_thm + all_goals (try extract_goal ; sorry) ---END sub_dec diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsubhnot_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gsubhnot_proof.lean deleted file mode 100644 index 152ec6d4b..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gsubhnot_proof.lean +++ /dev/null @@ -1,14 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gsubhnot_proof -theorem sub_not_thm (x x_1 : BitVec 8) : x_1 - x ^^^ 255#8 = (x_1 ^^^ 255#8) + x := sorry - -theorem dec_sub_thm (x x_1 : BitVec 8) : x_1 - x + 255#8 = (x ^^^ 255#8) + x_1 := sorry - -theorem sub_inc_thm (x x_1 : BitVec 8) : x_1 - (x + 1#8) = (x ^^^ 255#8) + x_1 := sorry - -theorem sub_dec_thm (x x_1 : BitVec 8) : x_1 + 255#8 - x = (x ^^^ 255#8) + x_1 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatible.lean b/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatible.lean index 56e583096..97a58b7c1 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatible.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatible.lean @@ -448,7 +448,7 @@ def negation_of_increment_via_or_with_no_common_bits_set_after := [llvm| %1 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %2 = llvm.shl %arg78, %0 : i8 %3 = llvm.xor %2, %1 : i8 - %4 = llvm.add %3, %arg77 : i8 + %4 = llvm.add %arg77, %3 : i8 "llvm.return"(%4) : (i8) -> () } ] @@ -480,7 +480,7 @@ def negation_of_increment_via_or_disjoint_after := [llvm| ^0(%arg71 : i8, %arg72 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = llvm.xor %arg72, %0 : i8 - %2 = llvm.add %1, %arg71 : i8 + %2 = llvm.add %arg71, %1 : i8 "llvm.return"(%2) : (i8) -> () } ] diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatible_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatible_proof.lean index 57940860f..97d016741 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatible_proof.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatible_proof.lean @@ -24,7 +24,7 @@ theorem negate_xor_thm (x : BitVec 4) : -(x ^^^ 5#4) = (x ^^^ 10#4) + 1#4 := sor theorem negate_shl_xor_thm (x x_1 : BitVec 4) : (Option.bind (if 4 ≤ x.toNat then none else some ((x_1 ^^^ 5#4) <<< x.toNat)) fun a => some (-a)) ⊑ - if 4 ≤ x.toNat then none else some (((x_1 ^^^ 10#4) + 1#4) <<< x.toNat) := sorry + if 4 ≤ x.toNat then none else some ((x_1 ^^^ 10#4) <<< x.toNat + 1#4 <<< x.toNat) := sorry theorem negate_sdiv_thm (x x_1 : BitVec 8) : x_1 - x.sdiv 42#8 = x.sdiv 214#8 + x_1 := sorry @@ -32,9 +32,9 @@ theorem negate_ashr_thm (x x_1 : BitVec 8) : x_1 - x.sshiftRight 7 = x >>> 7 + x theorem negate_lshr_thm (x x_1 : BitVec 8) : x_1 - x >>> 7 = x.sshiftRight 7 + x_1 := sorry -theorem negation_of_increment_via_or_with_no_common_bits_set_thm (x x_1 : BitVec 8) : x_1 - (x <<< 1 ||| 1#8) = (x <<< 1 ^^^ 255#8) + x_1 := sorry +theorem negation_of_increment_via_or_with_no_common_bits_set_thm (x x_1 : BitVec 8) : x_1 - (x <<< 1 ||| 1#8) = x_1 + (x <<< 1 ^^^ 255#8) := sorry -theorem negation_of_increment_via_or_disjoint_thm (x x_1 : BitVec 8) : x_1 - (x ||| 1#8) = (x ^^^ 255#8) + x_1 := sorry +theorem negation_of_increment_via_or_disjoint_thm (x x_1 : BitVec 8) : x_1 - (x ||| 1#8) = x_1 + (x ^^^ 255#8) := sorry theorem negate_add_with_single_negatible_operand_thm (x : BitVec 8) : 214#8 + -x = 214#8 - x := sorry diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatiblehinseltpoison.lean b/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatiblehinseltpoison.lean index 7fc024cd6..e5f331439 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatiblehinseltpoison.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatiblehinseltpoison.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gsubhofhnegatiblehinseltpoison_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -38,7 +38,7 @@ theorem t0_proof : t0_before ⊑ t0_after := by intros try simp ---BEGIN t0 - apply t0_thm + all_goals (try extract_goal ; sorry) ---END t0 @@ -70,7 +70,7 @@ theorem t2_proof : t2_before ⊑ t2_after := by intros try simp ---BEGIN t2 - apply t2_thm + all_goals (try extract_goal ; sorry) ---END t2 @@ -132,7 +132,7 @@ theorem neg_of_sub_from_constant_proof : neg_of_sub_from_constant_before ⊑ neg intros try simp ---BEGIN neg_of_sub_from_constant - apply neg_of_sub_from_constant_thm + all_goals (try extract_goal ; sorry) ---END neg_of_sub_from_constant @@ -164,7 +164,7 @@ theorem sub_from_constant_of_sub_from_constant_proof : sub_from_constant_of_sub_ intros try simp ---BEGIN sub_from_constant_of_sub_from_constant - apply sub_from_constant_of_sub_from_constant_thm + all_goals (try extract_goal ; sorry) ---END sub_from_constant_of_sub_from_constant @@ -196,7 +196,7 @@ theorem sub_from_variable_of_sub_from_constant_proof : sub_from_variable_of_sub_ intros try simp ---BEGIN sub_from_variable_of_sub_from_constant - apply sub_from_variable_of_sub_from_constant_thm + all_goals (try extract_goal ; sorry) ---END sub_from_variable_of_sub_from_constant @@ -228,7 +228,7 @@ theorem neg_of_add_with_constant_proof : neg_of_add_with_constant_before ⊑ neg intros try simp ---BEGIN neg_of_add_with_constant - apply neg_of_add_with_constant_thm + all_goals (try extract_goal ; sorry) ---END neg_of_add_with_constant @@ -260,7 +260,7 @@ theorem sub_from_constant_of_add_with_constant_proof : sub_from_constant_of_add_ intros try simp ---BEGIN sub_from_constant_of_add_with_constant - apply sub_from_constant_of_add_with_constant_thm + all_goals (try extract_goal ; sorry) ---END sub_from_constant_of_add_with_constant @@ -294,7 +294,7 @@ theorem negate_xor_proof : negate_xor_before ⊑ negate_xor_after := by intros try simp ---BEGIN negate_xor - apply negate_xor_thm + all_goals (try extract_goal ; sorry) ---END negate_xor @@ -330,7 +330,7 @@ theorem negate_shl_xor_proof : negate_shl_xor_before ⊑ negate_shl_xor_after := intros try simp ---BEGIN negate_shl_xor - apply negate_shl_xor_thm + all_goals (try extract_goal ; sorry) ---END negate_shl_xor @@ -362,7 +362,7 @@ theorem negate_sdiv_proof : negate_sdiv_before ⊑ negate_sdiv_after := by intros try simp ---BEGIN negate_sdiv - apply negate_sdiv_thm + all_goals (try extract_goal ; sorry) ---END negate_sdiv @@ -394,7 +394,7 @@ theorem negate_ashr_proof : negate_ashr_before ⊑ negate_ashr_after := by intros try simp ---BEGIN negate_ashr - apply negate_ashr_thm + all_goals (try extract_goal ; sorry) ---END negate_ashr @@ -426,7 +426,7 @@ theorem negate_lshr_proof : negate_lshr_before ⊑ negate_lshr_after := by intros try simp ---BEGIN negate_lshr - apply negate_lshr_thm + all_goals (try extract_goal ; sorry) ---END negate_lshr @@ -448,7 +448,7 @@ def negation_of_increment_via_or_with_no_common_bits_set_after := [llvm| %1 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %2 = llvm.shl %arg72, %0 : i8 %3 = llvm.xor %2, %1 : i8 - %4 = llvm.add %3, %arg71 : i8 + %4 = llvm.add %arg71, %3 : i8 "llvm.return"(%4) : (i8) -> () } ] @@ -461,7 +461,7 @@ theorem negation_of_increment_via_or_with_no_common_bits_set_proof : negation_of intros try simp ---BEGIN negation_of_increment_via_or_with_no_common_bits_set - apply negation_of_increment_via_or_with_no_common_bits_set_thm + all_goals (try extract_goal ; sorry) ---END negation_of_increment_via_or_with_no_common_bits_set @@ -493,7 +493,7 @@ theorem negate_add_with_single_negatible_operand_proof : negate_add_with_single_ intros try simp ---BEGIN negate_add_with_single_negatible_operand - apply negate_add_with_single_negatible_operand_thm + all_goals (try extract_goal ; sorry) ---END negate_add_with_single_negatible_operand @@ -527,7 +527,7 @@ theorem negate_add_with_single_negatible_operand_depth2_proof : negate_add_with_ intros try simp ---BEGIN negate_add_with_single_negatible_operand_depth2 - apply negate_add_with_single_negatible_operand_depth2_thm + all_goals (try extract_goal ; sorry) ---END negate_add_with_single_negatible_operand_depth2 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatiblehinseltpoison_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatiblehinseltpoison_proof.lean deleted file mode 100644 index 394e69a9f..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gsubhofhnegatiblehinseltpoison_proof.lean +++ /dev/null @@ -1,40 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gsubhofhnegatiblehinseltpoison_proof -theorem t0_thm (x : BitVec 8) : x - 214#8 = x + 42#8 := sorry - -theorem t2_thm (x x_1 : BitVec 8) : - (Option.bind (if 8 ≤ x.toNat then none else some (214#8 <<< x.toNat)) fun a => some (x_1 - a)) ⊑ - Option.bind (if 8 ≤ x.toNat then none else some (42#8 <<< x.toNat)) fun a => some (a + x_1) := sorry - -theorem neg_of_sub_from_constant_thm (x : BitVec 8) : x - 42#8 = x + 214#8 := sorry - -theorem sub_from_constant_of_sub_from_constant_thm (x : BitVec 8) : 11#8 - (42#8 - x) = x + 225#8 := sorry - -theorem sub_from_variable_of_sub_from_constant_thm (x x_1 : BitVec 8) : x_1 - (42#8 - x) = x + 214#8 + x_1 := sorry - -theorem neg_of_add_with_constant_thm (x : BitVec 8) : 214#8 + -x = 214#8 - x := sorry - -theorem sub_from_constant_of_add_with_constant_thm (x : BitVec 8) : 11#8 - (x + 42#8) = 225#8 - x := sorry - -theorem negate_xor_thm (x : BitVec 4) : -(x ^^^ 5#4) = (x ^^^ 10#4) + 1#4 := sorry - -theorem negate_shl_xor_thm (x x_1 : BitVec 4) : - (Option.bind (if 4 ≤ x.toNat then none else some ((x_1 ^^^ 5#4) <<< x.toNat)) fun a => some (-a)) ⊑ - if 4 ≤ x.toNat then none else some (((x_1 ^^^ 10#4) + 1#4) <<< x.toNat) := sorry - -theorem negate_sdiv_thm (x x_1 : BitVec 8) : x_1 - x.sdiv 42#8 = x.sdiv 214#8 + x_1 := sorry - -theorem negate_ashr_thm (x x_1 : BitVec 8) : x_1 - x.sshiftRight 7 = x >>> 7 + x_1 := sorry - -theorem negate_lshr_thm (x x_1 : BitVec 8) : x_1 - x >>> 7 = x.sshiftRight 7 + x_1 := sorry - -theorem negation_of_increment_via_or_with_no_common_bits_set_thm (x x_1 : BitVec 8) : x_1 - (x <<< 1 ||| 1#8) = (x <<< 1 ^^^ 255#8) + x_1 := sorry - -theorem negate_add_with_single_negatible_operand_thm (x : BitVec 8) : 214#8 + -x = 214#8 - x := sorry - -theorem negate_add_with_single_negatible_operand_depth2_thm (x x_1 : BitVec 8) : -((x_1 + 21#8) * x) = (235#8 - x_1) * x := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gxor.lean b/SSA/Projects/InstCombine/tests/LLVM/gxor.lean index 21737e23a..2b665b083 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gxor.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gxor.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gxor_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -12,19 +12,19 @@ set_option linter.deprecated false set_option linter.unreachableTactic false set_option linter.unusedTactic false section gxor_statements - + def test0_before := [llvm| { -^0(%arg180 : i1): - %0 = "llvm.mlir.constant"() <{value = 0 : i1}> : () -> i1 - %1 = llvm.xor %arg180, %0 : i1 +^0(%arg210 : i1): + %0 = "llvm.mlir.constant"() <{value = false}> : () -> i1 + %1 = llvm.xor %arg210, %0 : i1 "llvm.return"(%1) : (i1) -> () } ] def test0_after := [llvm| { -^0(%arg180 : i1): - "llvm.return"(%arg180) : (i1) -> () +^0(%arg210 : i1): + "llvm.return"(%arg210) : (i1) -> () } ] theorem test0_proof : test0_before ⊑ test0_after := by @@ -43,16 +43,16 @@ theorem test0_proof : test0_before ⊑ test0_after := by def test1_before := [llvm| { -^0(%arg179 : i32): +^0(%arg209 : i32): %0 = "llvm.mlir.constant"() <{value = 0 : i32}> : () -> i32 - %1 = llvm.xor %arg179, %0 : i32 + %1 = llvm.xor %arg209, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] def test1_after := [llvm| { -^0(%arg179 : i32): - "llvm.return"(%arg179) : (i32) -> () +^0(%arg209 : i32): + "llvm.return"(%arg209) : (i32) -> () } ] theorem test1_proof : test1_before ⊑ test1_after := by @@ -64,22 +64,22 @@ theorem test1_proof : test1_before ⊑ test1_after := by intros try simp ---BEGIN test1 - apply test1_thm + all_goals (try extract_goal ; sorry) ---END test1 def test2_before := [llvm| { -^0(%arg178 : i1): - %0 = llvm.xor %arg178, %arg178 : i1 +^0(%arg208 : i1): + %0 = llvm.xor %arg208, %arg208 : i1 "llvm.return"(%0) : (i1) -> () } ] def test2_after := [llvm| { -^0(%arg178 : i1): - %0 = "llvm.mlir.constant"() <{value = 0 : i1}> : () -> i1 +^0(%arg208 : i1): + %0 = "llvm.mlir.constant"() <{value = false}> : () -> i1 "llvm.return"(%0) : (i1) -> () } ] @@ -99,14 +99,14 @@ theorem test2_proof : test2_before ⊑ test2_after := by def test3_before := [llvm| { -^0(%arg177 : i32): - %0 = llvm.xor %arg177, %arg177 : i32 +^0(%arg207 : i32): + %0 = llvm.xor %arg207, %arg207 : i32 "llvm.return"(%0) : (i32) -> () } ] def test3_after := [llvm| { -^0(%arg177 : i32): +^0(%arg207 : i32): %0 = "llvm.mlir.constant"() <{value = 0 : i32}> : () -> i32 "llvm.return"(%0) : (i32) -> () } @@ -120,23 +120,23 @@ theorem test3_proof : test3_before ⊑ test3_after := by intros try simp ---BEGIN test3 - apply test3_thm + all_goals (try extract_goal ; sorry) ---END test3 def test4_before := [llvm| { -^0(%arg176 : i32): +^0(%arg206 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 - %1 = llvm.xor %0, %arg176 : i32 - %2 = llvm.xor %arg176, %1 : i32 + %1 = llvm.xor %0, %arg206 : i32 + %2 = llvm.xor %arg206, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] def test4_after := [llvm| { -^0(%arg176 : i32): +^0(%arg206 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 "llvm.return"(%0) : (i32) -> () } @@ -150,25 +150,25 @@ theorem test4_proof : test4_before ⊑ test4_after := by intros try simp ---BEGIN test4 - apply test4_thm + all_goals (try extract_goal ; sorry) ---END test4 def test5_before := [llvm| { -^0(%arg175 : i32): +^0(%arg205 : i32): %0 = "llvm.mlir.constant"() <{value = 123 : i32}> : () -> i32 - %1 = llvm.or %arg175, %0 : i32 + %1 = llvm.or %arg205, %0 : i32 %2 = llvm.xor %1, %0 : i32 "llvm.return"(%2) : (i32) -> () } ] def test5_after := [llvm| { -^0(%arg175 : i32): +^0(%arg205 : i32): %0 = "llvm.mlir.constant"() <{value = -124 : i32}> : () -> i32 - %1 = llvm.and %arg175, %0 : i32 + %1 = llvm.and %arg205, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -181,24 +181,24 @@ theorem test5_proof : test5_before ⊑ test5_after := by intros try simp ---BEGIN test5 - apply test5_thm + all_goals (try extract_goal ; sorry) ---END test5 def test6_before := [llvm| { -^0(%arg174 : i8): +^0(%arg204 : i8): %0 = "llvm.mlir.constant"() <{value = 17 : i8}> : () -> i8 - %1 = llvm.xor %arg174, %0 : i8 + %1 = llvm.xor %arg204, %0 : i8 %2 = llvm.xor %1, %0 : i8 "llvm.return"(%2) : (i8) -> () } ] def test6_after := [llvm| { -^0(%arg174 : i8): - "llvm.return"(%arg174) : (i8) -> () +^0(%arg204 : i8): + "llvm.return"(%arg204) : (i8) -> () } ] theorem test6_proof : test6_before ⊑ test6_after := by @@ -210,29 +210,29 @@ theorem test6_proof : test6_before ⊑ test6_after := by intros try simp ---BEGIN test6 - apply test6_thm + all_goals (try extract_goal ; sorry) ---END test6 def test7_before := [llvm| { -^0(%arg172 : i32, %arg173 : i32): +^0(%arg202 : i32, %arg203 : i32): %0 = "llvm.mlir.constant"() <{value = 7 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 128 : i32}> : () -> i32 - %2 = llvm.and %arg172, %0 : i32 - %3 = llvm.and %arg173, %1 : i32 + %2 = llvm.and %arg202, %0 : i32 + %3 = llvm.and %arg203, %1 : i32 %4 = llvm.xor %2, %3 : i32 "llvm.return"(%4) : (i32) -> () } ] def test7_after := [llvm| { -^0(%arg172 : i32, %arg173 : i32): +^0(%arg202 : i32, %arg203 : i32): %0 = "llvm.mlir.constant"() <{value = 7 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 128 : i32}> : () -> i32 - %2 = llvm.and %arg172, %0 : i32 - %3 = llvm.and %arg173, %1 : i32 + %2 = llvm.and %arg202, %0 : i32 + %3 = llvm.and %arg203, %1 : i32 %4 = llvm.or %2, %3 : i32 "llvm.return"(%4) : (i32) -> () } @@ -246,27 +246,27 @@ theorem test7_proof : test7_before ⊑ test7_after := by intros try simp ---BEGIN test7 - apply test7_thm + all_goals (try extract_goal ; sorry) ---END test7 def test10_before := [llvm| { -^0(%arg168 : i8): +^0(%arg198 : i8): %0 = "llvm.mlir.constant"() <{value = 3 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 4 : i8}> : () -> i8 - %2 = llvm.and %arg168, %0 : i8 + %2 = llvm.and %arg198, %0 : i8 %3 = llvm.xor %2, %1 : i8 "llvm.return"(%3) : (i8) -> () } ] def test10_after := [llvm| { -^0(%arg168 : i8): +^0(%arg198 : i8): %0 = "llvm.mlir.constant"() <{value = 3 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 4 : i8}> : () -> i8 - %2 = llvm.and %arg168, %0 : i8 + %2 = llvm.and %arg198, %0 : i8 %3 = llvm.or %2, %1 : i8 "llvm.return"(%3) : (i8) -> () } @@ -287,20 +287,20 @@ theorem test10_proof : test10_before ⊑ test10_after := by def test11_before := [llvm| { -^0(%arg167 : i8): +^0(%arg197 : i8): %0 = "llvm.mlir.constant"() <{value = 12 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 4 : i8}> : () -> i8 - %2 = llvm.or %arg167, %0 : i8 + %2 = llvm.or %arg197, %0 : i8 %3 = llvm.xor %2, %1 : i8 "llvm.return"(%3) : (i8) -> () } ] def test11_after := [llvm| { -^0(%arg167 : i8): +^0(%arg197 : i8): %0 = "llvm.mlir.constant"() <{value = -13 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 8 : i8}> : () -> i8 - %2 = llvm.and %arg167, %0 : i8 + %2 = llvm.and %arg197, %0 : i8 %3 = llvm.or %2, %1 : i8 "llvm.return"(%3) : (i8) -> () } @@ -321,19 +321,19 @@ theorem test11_proof : test11_before ⊑ test11_after := by def test18_before := [llvm| { -^0(%arg164 : i32): +^0(%arg194 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 123 : i32}> : () -> i32 - %2 = llvm.xor %arg164, %0 : i32 + %2 = llvm.xor %arg194, %0 : i32 %3 = llvm.sub %1, %2 : i32 "llvm.return"(%3) : (i32) -> () } ] def test18_after := [llvm| { -^0(%arg164 : i32): +^0(%arg194 : i32): %0 = "llvm.mlir.constant"() <{value = 124 : i32}> : () -> i32 - %1 = llvm.add %arg164, %0 : i32 + %1 = llvm.add %arg194, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -353,16 +353,16 @@ theorem test18_proof : test18_before ⊑ test18_after := by def test19_before := [llvm| { -^0(%arg162 : i32, %arg163 : i32): - %0 = llvm.xor %arg162, %arg163 : i32 - %1 = llvm.xor %0, %arg162 : i32 +^0(%arg192 : i32, %arg193 : i32): + %0 = llvm.xor %arg192, %arg193 : i32 + %1 = llvm.xor %0, %arg192 : i32 "llvm.return"(%1) : (i32) -> () } ] def test19_after := [llvm| { -^0(%arg162 : i32, %arg163 : i32): - "llvm.return"(%arg163) : (i32) -> () +^0(%arg192 : i32, %arg193 : i32): + "llvm.return"(%arg193) : (i32) -> () } ] theorem test19_proof : test19_before ⊑ test19_after := by @@ -381,18 +381,18 @@ theorem test19_proof : test19_before ⊑ test19_after := by def test25_before := [llvm| { -^0(%arg151 : i32, %arg152 : i32): +^0(%arg181 : i32, %arg182 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 - %1 = llvm.xor %arg152, %0 : i32 - %2 = llvm.and %1, %arg151 : i32 - %3 = llvm.xor %2, %arg151 : i32 + %1 = llvm.xor %arg182, %0 : i32 + %2 = llvm.and %1, %arg181 : i32 + %3 = llvm.xor %2, %arg181 : i32 "llvm.return"(%3) : (i32) -> () } ] def test25_after := [llvm| { -^0(%arg151 : i32, %arg152 : i32): - %0 = llvm.and %arg152, %arg151 : i32 +^0(%arg181 : i32, %arg182 : i32): + %0 = llvm.and %arg181, %arg182 : i32 "llvm.return"(%0) : (i32) -> () } ] @@ -412,19 +412,19 @@ theorem test25_proof : test25_before ⊑ test25_after := by def test28_before := [llvm| { -^0(%arg147 : i32): +^0(%arg177 : i32): %0 = "llvm.mlir.constant"() <{value = -2147483647 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -2147483648 : i32}> : () -> i32 - %2 = llvm.add %arg147, %0 : i32 + %2 = llvm.add %arg177, %0 : i32 %3 = llvm.xor %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def test28_after := [llvm| { -^0(%arg147 : i32): +^0(%arg177 : i32): %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %1 = llvm.add %arg147, %0 : i32 + %1 = llvm.add %arg177, %0 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -444,19 +444,19 @@ theorem test28_proof : test28_before ⊑ test28_after := by def test28_sub_before := [llvm| { -^0(%arg145 : i32): +^0(%arg175 : i32): %0 = "llvm.mlir.constant"() <{value = -2147483647 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -2147483648 : i32}> : () -> i32 - %2 = llvm.sub %0, %arg145 : i32 + %2 = llvm.sub %0, %arg175 : i32 %3 = llvm.xor %2, %1 : i32 "llvm.return"(%3) : (i32) -> () } ] def test28_sub_after := [llvm| { -^0(%arg145 : i32): +^0(%arg175 : i32): %0 = "llvm.mlir.constant"() <{value = 1 : i32}> : () -> i32 - %1 = llvm.sub %0, %arg145 : i32 + %1 = llvm.sub %0, %arg175 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -476,19 +476,19 @@ theorem test28_sub_proof : test28_sub_before ⊑ test28_sub_after := by def or_or_xor_before := [llvm| { -^0(%arg76 : i4, %arg77 : i4, %arg78 : i4): - %0 = llvm.or %arg78, %arg76 : i4 - %1 = llvm.or %arg78, %arg77 : i4 +^0(%arg106 : i4, %arg107 : i4, %arg108 : i4): + %0 = llvm.or %arg108, %arg106 : i4 + %1 = llvm.or %arg108, %arg107 : i4 %2 = llvm.xor %0, %1 : i4 "llvm.return"(%2) : (i4) -> () } ] def or_or_xor_after := [llvm| { -^0(%arg76 : i4, %arg77 : i4, %arg78 : i4): +^0(%arg106 : i4, %arg107 : i4, %arg108 : i4): %0 = "llvm.mlir.constant"() <{value = -1 : i4}> : () -> i4 - %1 = llvm.xor %arg78, %0 : i4 - %2 = llvm.xor %arg76, %arg77 : i4 + %1 = llvm.xor %arg108, %0 : i4 + %2 = llvm.xor %arg106, %arg107 : i4 %3 = llvm.and %2, %1 : i4 "llvm.return"(%3) : (i4) -> () } @@ -509,19 +509,19 @@ theorem or_or_xor_proof : or_or_xor_before ⊑ or_or_xor_after := by def or_or_xor_commute1_before := [llvm| { -^0(%arg73 : i4, %arg74 : i4, %arg75 : i4): - %0 = llvm.or %arg73, %arg75 : i4 - %1 = llvm.or %arg75, %arg74 : i4 +^0(%arg103 : i4, %arg104 : i4, %arg105 : i4): + %0 = llvm.or %arg103, %arg105 : i4 + %1 = llvm.or %arg105, %arg104 : i4 %2 = llvm.xor %0, %1 : i4 "llvm.return"(%2) : (i4) -> () } ] def or_or_xor_commute1_after := [llvm| { -^0(%arg73 : i4, %arg74 : i4, %arg75 : i4): +^0(%arg103 : i4, %arg104 : i4, %arg105 : i4): %0 = "llvm.mlir.constant"() <{value = -1 : i4}> : () -> i4 - %1 = llvm.xor %arg75, %0 : i4 - %2 = llvm.xor %arg73, %arg74 : i4 + %1 = llvm.xor %arg105, %0 : i4 + %2 = llvm.xor %arg103, %arg104 : i4 %3 = llvm.and %2, %1 : i4 "llvm.return"(%3) : (i4) -> () } @@ -542,19 +542,19 @@ theorem or_or_xor_commute1_proof : or_or_xor_commute1_before ⊑ or_or_xor_commu def or_or_xor_commute2_before := [llvm| { -^0(%arg70 : i4, %arg71 : i4, %arg72 : i4): - %0 = llvm.or %arg72, %arg70 : i4 - %1 = llvm.or %arg71, %arg72 : i4 +^0(%arg100 : i4, %arg101 : i4, %arg102 : i4): + %0 = llvm.or %arg102, %arg100 : i4 + %1 = llvm.or %arg101, %arg102 : i4 %2 = llvm.xor %0, %1 : i4 "llvm.return"(%2) : (i4) -> () } ] def or_or_xor_commute2_after := [llvm| { -^0(%arg70 : i4, %arg71 : i4, %arg72 : i4): +^0(%arg100 : i4, %arg101 : i4, %arg102 : i4): %0 = "llvm.mlir.constant"() <{value = -1 : i4}> : () -> i4 - %1 = llvm.xor %arg72, %0 : i4 - %2 = llvm.xor %arg70, %arg71 : i4 + %1 = llvm.xor %arg102, %0 : i4 + %2 = llvm.xor %arg100, %arg101 : i4 %3 = llvm.and %2, %1 : i4 "llvm.return"(%3) : (i4) -> () } @@ -575,22 +575,22 @@ theorem or_or_xor_commute2_proof : or_or_xor_commute2_before ⊑ or_or_xor_commu def not_is_canonical_before := [llvm| { -^0(%arg57 : i32, %arg58 : i32): +^0(%arg87 : i32, %arg88 : i32): %0 = "llvm.mlir.constant"() <{value = 1073741823 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %2 = llvm.xor %arg57, %0 : i32 - %3 = llvm.add %2, %arg58 : i32 + %2 = llvm.xor %arg87, %0 : i32 + %3 = llvm.add %2, %arg88 : i32 %4 = llvm.shl %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } ] def not_is_canonical_after := [llvm| { -^0(%arg57 : i32, %arg58 : i32): +^0(%arg87 : i32, %arg88 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 2 : i32}> : () -> i32 - %2 = llvm.xor %arg57, %0 : i32 - %3 = llvm.add %2, %arg58 : i32 + %2 = llvm.xor %arg87, %0 : i32 + %3 = llvm.add %arg88, %2 : i32 %4 = llvm.shl %3, %1 : i32 "llvm.return"(%4) : (i32) -> () } @@ -611,20 +611,20 @@ theorem not_is_canonical_proof : not_is_canonical_before ⊑ not_is_canonical_af def not_shl_before := [llvm| { -^0(%arg56 : i8): +^0(%arg86 : i8): %0 = "llvm.mlir.constant"() <{value = 7 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = -128 : i8}> : () -> i8 - %2 = llvm.shl %arg56, %0 : i8 + %2 = llvm.shl %arg86, %0 : i8 %3 = llvm.xor %2, %1 : i8 "llvm.return"(%3) : (i8) -> () } ] def not_shl_after := [llvm| { -^0(%arg56 : i8): +^0(%arg86 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 7 : i8}> : () -> i8 - %2 = llvm.xor %arg56, %0 : i8 + %2 = llvm.xor %arg86, %0 : i8 %3 = llvm.shl %2, %1 : i8 "llvm.return"(%3) : (i8) -> () } @@ -645,20 +645,20 @@ theorem not_shl_proof : not_shl_before ⊑ not_shl_after := by def not_lshr_before := [llvm| { -^0(%arg52 : i8): +^0(%arg82 : i8): %0 = "llvm.mlir.constant"() <{value = 5 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 7 : i8}> : () -> i8 - %2 = llvm.lshr %arg52, %0 : i8 + %2 = llvm.lshr %arg82, %0 : i8 %3 = llvm.xor %2, %1 : i8 "llvm.return"(%3) : (i8) -> () } ] def not_lshr_after := [llvm| { -^0(%arg52 : i8): +^0(%arg82 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 5 : i8}> : () -> i8 - %2 = llvm.xor %arg52, %0 : i8 + %2 = llvm.xor %arg82, %0 : i8 %3 = llvm.lshr %2, %1 : i8 "llvm.return"(%3) : (i8) -> () } @@ -679,20 +679,20 @@ theorem not_lshr_proof : not_lshr_before ⊑ not_lshr_after := by def ashr_not_before := [llvm| { -^0(%arg48 : i8): +^0(%arg78 : i8): %0 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = 5 : i8}> : () -> i8 - %2 = llvm.xor %arg48, %0 : i8 + %2 = llvm.xor %arg78, %0 : i8 %3 = llvm.ashr %2, %1 : i8 "llvm.return"(%3) : (i8) -> () } ] def ashr_not_after := [llvm| { -^0(%arg48 : i8): +^0(%arg78 : i8): %0 = "llvm.mlir.constant"() <{value = 5 : i8}> : () -> i8 %1 = "llvm.mlir.constant"() <{value = -1 : i8}> : () -> i8 - %2 = llvm.ashr %arg48, %0 : i8 + %2 = llvm.ashr %arg78, %0 : i8 %3 = llvm.xor %2, %1 : i8 "llvm.return"(%3) : (i8) -> () } @@ -713,20 +713,20 @@ theorem ashr_not_proof : ashr_not_before ⊑ ashr_not_after := by def tryFactorization_xor_ashr_lshr_before := [llvm| { -^0(%arg10 : i32): +^0(%arg40 : i32): %0 = "llvm.mlir.constant"() <{value = -3 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 - %2 = llvm.ashr %0, %arg10 : i32 - %3 = llvm.lshr %1, %arg10 : i32 + %2 = llvm.ashr %0, %arg40 : i32 + %3 = llvm.lshr %1, %arg40 : i32 %4 = llvm.xor %2, %3 : i32 "llvm.return"(%4) : (i32) -> () } ] def tryFactorization_xor_ashr_lshr_after := [llvm| { -^0(%arg10 : i32): +^0(%arg40 : i32): %0 = "llvm.mlir.constant"() <{value = -8 : i32}> : () -> i32 - %1 = llvm.ashr %0, %arg10 : i32 + %1 = llvm.ashr %0, %arg40 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -746,20 +746,20 @@ theorem tryFactorization_xor_ashr_lshr_proof : tryFactorization_xor_ashr_lshr_be def tryFactorization_xor_lshr_ashr_before := [llvm| { -^0(%arg9 : i32): +^0(%arg39 : i32): %0 = "llvm.mlir.constant"() <{value = -3 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 - %2 = llvm.ashr %0, %arg9 : i32 - %3 = llvm.lshr %1, %arg9 : i32 + %2 = llvm.ashr %0, %arg39 : i32 + %3 = llvm.lshr %1, %arg39 : i32 %4 = llvm.xor %3, %2 : i32 "llvm.return"(%4) : (i32) -> () } ] def tryFactorization_xor_lshr_ashr_after := [llvm| { -^0(%arg9 : i32): +^0(%arg39 : i32): %0 = "llvm.mlir.constant"() <{value = -8 : i32}> : () -> i32 - %1 = llvm.ashr %0, %arg9 : i32 + %1 = llvm.ashr %0, %arg39 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -779,20 +779,20 @@ theorem tryFactorization_xor_lshr_ashr_proof : tryFactorization_xor_lshr_ashr_be def tryFactorization_xor_lshr_lshr_before := [llvm| { -^0(%arg7 : i32): +^0(%arg37 : i32): %0 = "llvm.mlir.constant"() <{value = -3 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = 5 : i32}> : () -> i32 - %2 = llvm.lshr %0, %arg7 : i32 - %3 = llvm.lshr %1, %arg7 : i32 + %2 = llvm.lshr %0, %arg37 : i32 + %3 = llvm.lshr %1, %arg37 : i32 %4 = llvm.xor %2, %3 : i32 "llvm.return"(%4) : (i32) -> () } ] def tryFactorization_xor_lshr_lshr_after := [llvm| { -^0(%arg7 : i32): +^0(%arg37 : i32): %0 = "llvm.mlir.constant"() <{value = -8 : i32}> : () -> i32 - %1 = llvm.lshr %0, %arg7 : i32 + %1 = llvm.lshr %0, %arg37 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -812,20 +812,20 @@ theorem tryFactorization_xor_lshr_lshr_proof : tryFactorization_xor_lshr_lshr_be def tryFactorization_xor_ashr_ashr_before := [llvm| { -^0(%arg6 : i32): +^0(%arg36 : i32): %0 = "llvm.mlir.constant"() <{value = -3 : i32}> : () -> i32 %1 = "llvm.mlir.constant"() <{value = -5 : i32}> : () -> i32 - %2 = llvm.ashr %0, %arg6 : i32 - %3 = llvm.ashr %1, %arg6 : i32 + %2 = llvm.ashr %0, %arg36 : i32 + %3 = llvm.ashr %1, %arg36 : i32 %4 = llvm.xor %2, %3 : i32 "llvm.return"(%4) : (i32) -> () } ] def tryFactorization_xor_ashr_ashr_after := [llvm| { -^0(%arg6 : i32): +^0(%arg36 : i32): %0 = "llvm.mlir.constant"() <{value = 6 : i32}> : () -> i32 - %1 = llvm.lshr %0, %arg6 : i32 + %1 = llvm.lshr %0, %arg36 : i32 "llvm.return"(%1) : (i32) -> () } ] @@ -845,22 +845,22 @@ theorem tryFactorization_xor_ashr_ashr_proof : tryFactorization_xor_ashr_ashr_be def PR96857_xor_with_noundef_before := [llvm| { -^0(%arg3 : i4, %arg4 : i4, %arg5 : i4): +^0(%arg33 : i4, %arg34 : i4, %arg35 : i4): %0 = "llvm.mlir.constant"() <{value = -1 : i4}> : () -> i4 - %1 = llvm.and %arg5, %arg3 : i4 - %2 = llvm.xor %arg5, %0 : i4 - %3 = llvm.and %2, %arg4 : i4 + %1 = llvm.and %arg35, %arg33 : i4 + %2 = llvm.xor %arg35, %0 : i4 + %3 = llvm.and %2, %arg34 : i4 %4 = llvm.xor %1, %3 : i4 "llvm.return"(%4) : (i4) -> () } ] def PR96857_xor_with_noundef_after := [llvm| { -^0(%arg3 : i4, %arg4 : i4, %arg5 : i4): +^0(%arg33 : i4, %arg34 : i4, %arg35 : i4): %0 = "llvm.mlir.constant"() <{value = -1 : i4}> : () -> i4 - %1 = llvm.and %arg5, %arg3 : i4 - %2 = llvm.xor %arg5, %0 : i4 - %3 = llvm.and %2, %arg4 : i4 + %1 = llvm.and %arg35, %arg33 : i4 + %2 = llvm.xor %arg35, %0 : i4 + %3 = llvm.and %arg34, %2 : i4 %4 = llvm.or %1, %3 : i4 "llvm.return"(%4) : (i4) -> () } @@ -881,22 +881,22 @@ theorem PR96857_xor_with_noundef_proof : PR96857_xor_with_noundef_before ⊑ PR9 def PR96857_xor_without_noundef_before := [llvm| { -^0(%arg0 : i4, %arg1 : i4, %arg2 : i4): +^0(%arg30 : i4, %arg31 : i4, %arg32 : i4): %0 = "llvm.mlir.constant"() <{value = -1 : i4}> : () -> i4 - %1 = llvm.and %arg2, %arg0 : i4 - %2 = llvm.xor %arg2, %0 : i4 - %3 = llvm.and %2, %arg1 : i4 + %1 = llvm.and %arg32, %arg30 : i4 + %2 = llvm.xor %arg32, %0 : i4 + %3 = llvm.and %2, %arg31 : i4 %4 = llvm.xor %1, %3 : i4 "llvm.return"(%4) : (i4) -> () } ] def PR96857_xor_without_noundef_after := [llvm| { -^0(%arg0 : i4, %arg1 : i4, %arg2 : i4): +^0(%arg30 : i4, %arg31 : i4, %arg32 : i4): %0 = "llvm.mlir.constant"() <{value = -1 : i4}> : () -> i4 - %1 = llvm.and %arg2, %arg0 : i4 - %2 = llvm.xor %arg2, %0 : i4 - %3 = llvm.and %2, %arg1 : i4 + %1 = llvm.and %arg32, %arg30 : i4 + %2 = llvm.xor %arg32, %0 : i4 + %3 = llvm.and %arg31, %2 : i4 %4 = llvm.or %1, %3 : i4 "llvm.return"(%4) : (i4) -> () } @@ -912,3 +912,89 @@ theorem PR96857_xor_without_noundef_proof : PR96857_xor_without_noundef_before ---BEGIN PR96857_xor_without_noundef all_goals (try extract_goal ; sorry) ---END PR96857_xor_without_noundef + + + +def or_disjoint_with_xor_before := [llvm| +{ +^0(%arg28 : i32, %arg29 : i32): + %0 = llvm.or %arg28, %arg29 : i32 + %1 = llvm.xor %0, %arg28 : i32 + "llvm.return"(%1) : (i32) -> () +} +] +def or_disjoint_with_xor_after := [llvm| +{ +^0(%arg28 : i32, %arg29 : i32): + "llvm.return"(%arg29) : (i32) -> () +} +] +theorem or_disjoint_with_xor_proof : or_disjoint_with_xor_before ⊑ or_disjoint_with_xor_after := by + unfold or_disjoint_with_xor_before or_disjoint_with_xor_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN or_disjoint_with_xor + all_goals (try extract_goal ; sorry) + ---END or_disjoint_with_xor + + + +def xor_with_or_disjoint_ab_before := [llvm| +{ +^0(%arg26 : i32, %arg27 : i32): + %0 = llvm.or %arg26, %arg27 : i32 + %1 = llvm.xor %arg26, %0 : i32 + "llvm.return"(%1) : (i32) -> () +} +] +def xor_with_or_disjoint_ab_after := [llvm| +{ +^0(%arg26 : i32, %arg27 : i32): + "llvm.return"(%arg27) : (i32) -> () +} +] +theorem xor_with_or_disjoint_ab_proof : xor_with_or_disjoint_ab_before ⊑ xor_with_or_disjoint_ab_after := by + unfold xor_with_or_disjoint_ab_before xor_with_or_disjoint_ab_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN xor_with_or_disjoint_ab + all_goals (try extract_goal ; sorry) + ---END xor_with_or_disjoint_ab + + + +def xor_with_or_disjoint_ba_before := [llvm| +{ +^0(%arg24 : i32, %arg25 : i32): + %0 = llvm.or %arg25, %arg24 : i32 + %1 = llvm.xor %arg25, %0 : i32 + "llvm.return"(%1) : (i32) -> () +} +] +def xor_with_or_disjoint_ba_after := [llvm| +{ +^0(%arg24 : i32, %arg25 : i32): + "llvm.return"(%arg24) : (i32) -> () +} +] +theorem xor_with_or_disjoint_ba_proof : xor_with_or_disjoint_ba_before ⊑ xor_with_or_disjoint_ba_after := by + unfold xor_with_or_disjoint_ba_before xor_with_or_disjoint_ba_after + simp_alive_peephole + simp_alive_undef + simp_alive_ops + simp_alive_case_bash + intros + try simp + ---BEGIN xor_with_or_disjoint_ba + all_goals (try extract_goal ; sorry) + ---END xor_with_or_disjoint_ba + + diff --git a/SSA/Projects/InstCombine/tests/LLVM/gxor2.lean b/SSA/Projects/InstCombine/tests/LLVM/gxor2.lean index 6cf24a787..e4bb0016d 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gxor2.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gxor2.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gxor2_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -44,7 +44,7 @@ theorem test2_proof : test2_before ⊑ test2_after := by intros try simp ---BEGIN test2 - apply test2_thm + all_goals (try extract_goal ; sorry) ---END test2 @@ -80,7 +80,7 @@ theorem test3_proof : test3_before ⊑ test3_after := by intros try simp ---BEGIN test3 - apply test3_thm + all_goals (try extract_goal ; sorry) ---END test3 @@ -120,7 +120,7 @@ theorem test5_proof : test5_before ⊑ test5_after := by intros try simp ---BEGIN test5 - apply test5_thm + all_goals (try extract_goal ; sorry) ---END test5 @@ -156,7 +156,7 @@ theorem test6_proof : test6_before ⊑ test6_after := by intros try simp ---BEGIN test6 - apply test6_thm + all_goals (try extract_goal ; sorry) ---END test6 @@ -176,7 +176,7 @@ def test7_after := [llvm| ^0(%arg115 : i32, %arg116 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg116, %0 : i32 - %2 = llvm.or %1, %arg115 : i32 + %2 = llvm.or %arg115, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -189,7 +189,7 @@ theorem test7_proof : test7_before ⊑ test7_after := by intros try simp ---BEGIN test7 - apply test7_thm + all_goals (try extract_goal ; sorry) ---END test7 @@ -209,7 +209,7 @@ def test8_after := [llvm| ^0(%arg113 : i32, %arg114 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg114, %0 : i32 - %2 = llvm.or %1, %arg113 : i32 + %2 = llvm.or %arg113, %1 : i32 "llvm.return"(%2) : (i32) -> () } ] @@ -222,7 +222,7 @@ theorem test8_proof : test8_before ⊑ test8_after := by intros try simp ---BEGIN test8 - apply test8_thm + all_goals (try extract_goal ; sorry) ---END test8 @@ -252,7 +252,7 @@ theorem test9_proof : test9_before ⊑ test9_after := by intros try simp ---BEGIN test9 - apply test9_thm + all_goals (try extract_goal ; sorry) ---END test9 @@ -282,7 +282,7 @@ theorem test9b_proof : test9b_before ⊑ test9b_after := by intros try simp ---BEGIN test9b - apply test9b_thm + all_goals (try extract_goal ; sorry) ---END test9b @@ -312,7 +312,7 @@ theorem test10_proof : test10_before ⊑ test10_after := by intros try simp ---BEGIN test10 - apply test10_thm + all_goals (try extract_goal ; sorry) ---END test10 @@ -342,7 +342,7 @@ theorem test10b_proof : test10b_before ⊑ test10b_after := by intros try simp ---BEGIN test10b - apply test10b_thm + all_goals (try extract_goal ; sorry) ---END test10b @@ -378,7 +378,7 @@ theorem test11_proof : test11_before ⊑ test11_after := by intros try simp ---BEGIN test11 - apply test11_thm + all_goals (try extract_goal ; sorry) ---END test11 @@ -414,7 +414,7 @@ theorem test11b_proof : test11b_before ⊑ test11b_after := by intros try simp ---BEGIN test11b - apply test11b_thm + all_goals (try extract_goal ; sorry) ---END test11b @@ -450,7 +450,7 @@ theorem test11c_proof : test11c_before ⊑ test11c_after := by intros try simp ---BEGIN test11c - apply test11c_thm + all_goals (try extract_goal ; sorry) ---END test11c @@ -486,7 +486,7 @@ theorem test11d_proof : test11d_before ⊑ test11d_after := by intros try simp ---BEGIN test11d - apply test11d_thm + all_goals (try extract_goal ; sorry) ---END test11d @@ -509,7 +509,7 @@ def test11e_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.mul %arg95, %arg96 : i32 %2 = llvm.xor %1, %arg94 : i32 - %3 = llvm.xor %1, %arg94 : i32 + %3 = llvm.xor %arg94, %1 : i32 %4 = llvm.xor %3, %0 : i32 %5 = llvm.and %2, %4 : i32 "llvm.return"(%5) : (i32) -> () @@ -524,7 +524,7 @@ theorem test11e_proof : test11e_before ⊑ test11e_after := by intros try simp ---BEGIN test11e - apply test11e_thm + all_goals (try extract_goal ; sorry) ---END test11e @@ -547,7 +547,7 @@ def test11f_after := [llvm| %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.mul %arg92, %arg93 : i32 %2 = llvm.xor %1, %arg91 : i32 - %3 = llvm.xor %1, %arg91 : i32 + %3 = llvm.xor %arg91, %1 : i32 %4 = llvm.xor %3, %0 : i32 %5 = llvm.and %2, %4 : i32 "llvm.return"(%5) : (i32) -> () @@ -562,7 +562,7 @@ theorem test11f_proof : test11f_before ⊑ test11f_after := by intros try simp ---BEGIN test11f - apply test11f_thm + all_goals (try extract_goal ; sorry) ---END test11f @@ -596,7 +596,7 @@ theorem test12_proof : test12_before ⊑ test12_after := by intros try simp ---BEGIN test12 - apply test12_thm + all_goals (try extract_goal ; sorry) ---END test12 @@ -630,7 +630,7 @@ theorem test12commuted_proof : test12commuted_before ⊑ test12commuted_after := intros try simp ---BEGIN test12commuted - apply test12commuted_thm + all_goals (try extract_goal ; sorry) ---END test12commuted @@ -664,7 +664,7 @@ theorem test13_proof : test13_before ⊑ test13_after := by intros try simp ---BEGIN test13 - apply test13_thm + all_goals (try extract_goal ; sorry) ---END test13 @@ -698,7 +698,7 @@ theorem test13commuted_proof : test13commuted_before ⊑ test13commuted_after := intros try simp ---BEGIN test13commuted - apply test13commuted_thm + all_goals (try extract_goal ; sorry) ---END test13commuted @@ -717,7 +717,7 @@ def xor_or_xor_common_op_commute1_after := [llvm| ^0(%arg80 : i32, %arg81 : i32, %arg82 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg80, %0 : i32 - %2 = llvm.and %1, %arg81 : i32 + %2 = llvm.and %arg81, %1 : i32 %3 = llvm.xor %2, %arg82 : i32 "llvm.return"(%3) : (i32) -> () } @@ -731,7 +731,7 @@ theorem xor_or_xor_common_op_commute1_proof : xor_or_xor_common_op_commute1_befo intros try simp ---BEGIN xor_or_xor_common_op_commute1 - apply xor_or_xor_common_op_commute1_thm + all_goals (try extract_goal ; sorry) ---END xor_or_xor_common_op_commute1 @@ -750,7 +750,7 @@ def xor_or_xor_common_op_commute2_after := [llvm| ^0(%arg77 : i32, %arg78 : i32, %arg79 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg77, %0 : i32 - %2 = llvm.and %1, %arg78 : i32 + %2 = llvm.and %arg78, %1 : i32 %3 = llvm.xor %2, %arg79 : i32 "llvm.return"(%3) : (i32) -> () } @@ -764,7 +764,7 @@ theorem xor_or_xor_common_op_commute2_proof : xor_or_xor_common_op_commute2_befo intros try simp ---BEGIN xor_or_xor_common_op_commute2 - apply xor_or_xor_common_op_commute2_thm + all_goals (try extract_goal ; sorry) ---END xor_or_xor_common_op_commute2 @@ -783,7 +783,7 @@ def xor_or_xor_common_op_commute3_after := [llvm| ^0(%arg74 : i32, %arg75 : i32, %arg76 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg74, %0 : i32 - %2 = llvm.and %1, %arg75 : i32 + %2 = llvm.and %arg75, %1 : i32 %3 = llvm.xor %2, %arg76 : i32 "llvm.return"(%3) : (i32) -> () } @@ -797,7 +797,7 @@ theorem xor_or_xor_common_op_commute3_proof : xor_or_xor_common_op_commute3_befo intros try simp ---BEGIN xor_or_xor_common_op_commute3 - apply xor_or_xor_common_op_commute3_thm + all_goals (try extract_goal ; sorry) ---END xor_or_xor_common_op_commute3 @@ -816,7 +816,7 @@ def xor_or_xor_common_op_commute4_after := [llvm| ^0(%arg71 : i32, %arg72 : i32, %arg73 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg71, %0 : i32 - %2 = llvm.and %1, %arg72 : i32 + %2 = llvm.and %arg72, %1 : i32 %3 = llvm.xor %2, %arg73 : i32 "llvm.return"(%3) : (i32) -> () } @@ -830,7 +830,7 @@ theorem xor_or_xor_common_op_commute4_proof : xor_or_xor_common_op_commute4_befo intros try simp ---BEGIN xor_or_xor_common_op_commute4 - apply xor_or_xor_common_op_commute4_thm + all_goals (try extract_goal ; sorry) ---END xor_or_xor_common_op_commute4 @@ -849,7 +849,7 @@ def xor_or_xor_common_op_commute5_after := [llvm| ^0(%arg68 : i32, %arg69 : i32, %arg70 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg68, %0 : i32 - %2 = llvm.and %1, %arg69 : i32 + %2 = llvm.and %arg69, %1 : i32 %3 = llvm.xor %2, %arg70 : i32 "llvm.return"(%3) : (i32) -> () } @@ -863,7 +863,7 @@ theorem xor_or_xor_common_op_commute5_proof : xor_or_xor_common_op_commute5_befo intros try simp ---BEGIN xor_or_xor_common_op_commute5 - apply xor_or_xor_common_op_commute5_thm + all_goals (try extract_goal ; sorry) ---END xor_or_xor_common_op_commute5 @@ -882,7 +882,7 @@ def xor_or_xor_common_op_commute6_after := [llvm| ^0(%arg65 : i32, %arg66 : i32, %arg67 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg65, %0 : i32 - %2 = llvm.and %1, %arg66 : i32 + %2 = llvm.and %arg66, %1 : i32 %3 = llvm.xor %2, %arg67 : i32 "llvm.return"(%3) : (i32) -> () } @@ -896,7 +896,7 @@ theorem xor_or_xor_common_op_commute6_proof : xor_or_xor_common_op_commute6_befo intros try simp ---BEGIN xor_or_xor_common_op_commute6 - apply xor_or_xor_common_op_commute6_thm + all_goals (try extract_goal ; sorry) ---END xor_or_xor_common_op_commute6 @@ -915,7 +915,7 @@ def xor_or_xor_common_op_commute7_after := [llvm| ^0(%arg62 : i32, %arg63 : i32, %arg64 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg62, %0 : i32 - %2 = llvm.and %1, %arg63 : i32 + %2 = llvm.and %arg63, %1 : i32 %3 = llvm.xor %2, %arg64 : i32 "llvm.return"(%3) : (i32) -> () } @@ -929,7 +929,7 @@ theorem xor_or_xor_common_op_commute7_proof : xor_or_xor_common_op_commute7_befo intros try simp ---BEGIN xor_or_xor_common_op_commute7 - apply xor_or_xor_common_op_commute7_thm + all_goals (try extract_goal ; sorry) ---END xor_or_xor_common_op_commute7 @@ -948,7 +948,7 @@ def xor_or_xor_common_op_commute8_after := [llvm| ^0(%arg59 : i32, %arg60 : i32, %arg61 : i32): %0 = "llvm.mlir.constant"() <{value = -1 : i32}> : () -> i32 %1 = llvm.xor %arg59, %0 : i32 - %2 = llvm.and %1, %arg60 : i32 + %2 = llvm.and %arg60, %1 : i32 %3 = llvm.xor %2, %arg61 : i32 "llvm.return"(%3) : (i32) -> () } @@ -962,7 +962,7 @@ theorem xor_or_xor_common_op_commute8_proof : xor_or_xor_common_op_commute8_befo intros try simp ---BEGIN xor_or_xor_common_op_commute8 - apply xor_or_xor_common_op_commute8_thm + all_goals (try extract_goal ; sorry) ---END xor_or_xor_common_op_commute8 @@ -1000,7 +1000,7 @@ theorem test15_proof : test15_before ⊑ test15_after := by intros try simp ---BEGIN test15 - apply test15_thm + all_goals (try extract_goal ; sorry) ---END test15 @@ -1038,7 +1038,7 @@ theorem test16_proof : test16_before ⊑ test16_after := by intros try simp ---BEGIN test16 - apply test16_thm + all_goals (try extract_goal ; sorry) ---END test16 @@ -1074,7 +1074,7 @@ theorem not_xor_to_or_not1_proof : not_xor_to_or_not1_before ⊑ not_xor_to_or_n intros try simp ---BEGIN not_xor_to_or_not1 - apply not_xor_to_or_not1_thm + all_goals (try extract_goal ; sorry) ---END not_xor_to_or_not1 @@ -1110,7 +1110,7 @@ theorem not_xor_to_or_not2_proof : not_xor_to_or_not2_before ⊑ not_xor_to_or_n intros try simp ---BEGIN not_xor_to_or_not2 - apply not_xor_to_or_not2_thm + all_goals (try extract_goal ; sorry) ---END not_xor_to_or_not2 @@ -1146,7 +1146,7 @@ theorem not_xor_to_or_not3_proof : not_xor_to_or_not3_before ⊑ not_xor_to_or_n intros try simp ---BEGIN not_xor_to_or_not3 - apply not_xor_to_or_not3_thm + all_goals (try extract_goal ; sorry) ---END not_xor_to_or_not3 @@ -1182,7 +1182,7 @@ theorem not_xor_to_or_not4_proof : not_xor_to_or_not4_before ⊑ not_xor_to_or_n intros try simp ---BEGIN not_xor_to_or_not4 - apply not_xor_to_or_not4_thm + all_goals (try extract_goal ; sorry) ---END not_xor_to_or_not4 @@ -1218,7 +1218,7 @@ theorem xor_notand_to_or_not1_proof : xor_notand_to_or_not1_before ⊑ xor_notan intros try simp ---BEGIN xor_notand_to_or_not1 - apply xor_notand_to_or_not1_thm + all_goals (try extract_goal ; sorry) ---END xor_notand_to_or_not1 @@ -1254,7 +1254,7 @@ theorem xor_notand_to_or_not2_proof : xor_notand_to_or_not2_before ⊑ xor_notan intros try simp ---BEGIN xor_notand_to_or_not2 - apply xor_notand_to_or_not2_thm + all_goals (try extract_goal ; sorry) ---END xor_notand_to_or_not2 @@ -1290,7 +1290,7 @@ theorem xor_notand_to_or_not3_proof : xor_notand_to_or_not3_before ⊑ xor_notan intros try simp ---BEGIN xor_notand_to_or_not3 - apply xor_notand_to_or_not3_thm + all_goals (try extract_goal ; sorry) ---END xor_notand_to_or_not3 @@ -1326,7 +1326,7 @@ theorem xor_notand_to_or_not4_proof : xor_notand_to_or_not4_before ⊑ xor_notan intros try simp ---BEGIN xor_notand_to_or_not4 - apply xor_notand_to_or_not4_thm + all_goals (try extract_goal ; sorry) ---END xor_notand_to_or_not4 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gxor2_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gxor2_proof.lean deleted file mode 100644 index ec6a7abd3..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gxor2_proof.lean +++ /dev/null @@ -1,114 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gxor2_proof -theorem test2_thm (x : BitVec 32) : (x &&& 32#32) + 145#32 ^^^ 153#32 = x &&& 32#32 ||| 8#32 := sorry - -theorem test3_thm (x : BitVec 32) : (x ||| 145#32) &&& 177#32 ^^^ 153#32 = x &&& 32#32 ||| 8#32 := sorry - -theorem test5_thm (x : BitVec 32) : (x ^^^ 1234#32) >>> 8 ^^^ 1#32 = x >>> 8 ^^^ 5#32 := sorry - -theorem test6_thm (x : BitVec 32) : (x ^^^ 1234#32) >>> 16 = x >>> 16 := sorry - -theorem test7_thm (x x_1 : BitVec 32) : (x_1 ||| x) ^^^ (x_1 ^^^ 4294967295#32) = x ^^^ 4294967295#32 ||| x_1 := sorry - -theorem test8_thm (x x_1 : BitVec 32) : x_1 ^^^ 4294967295#32 ^^^ (x_1 ||| x) = x ^^^ 4294967295#32 ||| x_1 := sorry - -theorem test9_thm (x x_1 : BitVec 32) : x_1 &&& x ^^^ (x_1 ^^^ x) = x_1 ||| x := sorry - -theorem test9b_thm (x x_1 : BitVec 32) : x_1 &&& x ^^^ (x ^^^ x_1) = x_1 ||| x := sorry - -theorem test10_thm (x x_1 : BitVec 32) : x_1 ^^^ x ^^^ x_1 &&& x = x_1 ||| x := sorry - -theorem test10b_thm (x x_1 : BitVec 32) : x_1 ^^^ x ^^^ x &&& x_1 = x_1 ||| x := sorry - -theorem test11_thm (x x_1 : BitVec 32) : - (x_1 ^^^ x) &&& (x ^^^ 4294967295#32 ^^^ x_1) = (x_1 ^^^ x) &&& (x ^^^ x_1 ^^^ 4294967295#32) := sorry - -theorem test11b_thm (x x_1 : BitVec 32) : - (x_1 ^^^ 4294967295#32 ^^^ x) &&& (x ^^^ x_1) = (x ^^^ x_1) &&& (x_1 ^^^ x ^^^ 4294967295#32) := sorry - -theorem test11c_thm (x x_1 : BitVec 32) : - (x_1 ^^^ x) &&& (x_1 ^^^ 4294967295#32 ^^^ x) = (x_1 ^^^ x) &&& (x_1 ^^^ x ^^^ 4294967295#32) := sorry - -theorem test11d_thm (x x_1 : BitVec 32) : - (x_1 ^^^ 4294967295#32 ^^^ x) &&& (x_1 ^^^ x) = (x_1 ^^^ x) &&& (x_1 ^^^ x ^^^ 4294967295#32) := sorry - -theorem test11e_thm (x x_1 x_2 : BitVec 32) : - (x_2 * x_1 ^^^ x) &&& (x_2 * x_1 ^^^ (x ^^^ 4294967295#32)) = - (x_2 * x_1 ^^^ x) &&& (x_2 * x_1 ^^^ x ^^^ 4294967295#32) := sorry - -theorem test11f_thm (x x_1 x_2 : BitVec 32) : - (x_2 * x_1 ^^^ (x ^^^ 4294967295#32)) &&& (x_2 * x_1 ^^^ x) = - (x_2 * x_1 ^^^ x) &&& (x_2 * x_1 ^^^ x ^^^ 4294967295#32) := sorry - -theorem test12_thm (x x_1 : BitVec 32) : - x_1 &&& (x ^^^ 4294967295#32) ^^^ (x_1 ^^^ 4294967295#32) = x_1 &&& x ^^^ 4294967295#32 := sorry - -theorem test12commuted_thm (x x_1 : BitVec 32) : - (x_1 ^^^ 4294967295#32) &&& x ^^^ (x ^^^ 4294967295#32) = x &&& x_1 ^^^ 4294967295#32 := sorry - -theorem test13_thm (x x_1 : BitVec 32) : - x_1 ^^^ 4294967295#32 ^^^ x_1 &&& (x ^^^ 4294967295#32) = x_1 &&& x ^^^ 4294967295#32 := sorry - -theorem test13commuted_thm (x x_1 : BitVec 32) : - x_1 ^^^ 4294967295#32 ^^^ (x ^^^ 4294967295#32) &&& x_1 = x_1 &&& x ^^^ 4294967295#32 := sorry - -theorem xor_or_xor_common_op_commute1_thm (x x_1 x_2 : BitVec 32) : - x_2 ^^^ x_1 ^^^ (x_2 ||| x) = (x_2 ^^^ 4294967295#32) &&& x ^^^ x_1 := sorry - -theorem xor_or_xor_common_op_commute2_thm (x x_1 x_2 : BitVec 32) : - x_2 ^^^ x_1 ^^^ (x_1 ||| x) = (x_1 ^^^ 4294967295#32) &&& x ^^^ x_2 := sorry - -theorem xor_or_xor_common_op_commute3_thm (x x_1 x_2 : BitVec 32) : - x_2 ^^^ x_1 ^^^ (x ||| x_2) = (x_2 ^^^ 4294967295#32) &&& x ^^^ x_1 := sorry - -theorem xor_or_xor_common_op_commute4_thm (x x_1 x_2 : BitVec 32) : - x_2 ^^^ x_1 ^^^ (x ||| x_1) = (x_1 ^^^ 4294967295#32) &&& x ^^^ x_2 := sorry - -theorem xor_or_xor_common_op_commute5_thm (x x_1 x_2 : BitVec 32) : - (x_2 ||| x_1) ^^^ (x_2 ^^^ x) = (x_2 ^^^ 4294967295#32) &&& x_1 ^^^ x := sorry - -theorem xor_or_xor_common_op_commute6_thm (x x_1 x_2 : BitVec 32) : - (x_2 ||| x_1) ^^^ (x ^^^ x_2) = (x_2 ^^^ 4294967295#32) &&& x_1 ^^^ x := sorry - -theorem xor_or_xor_common_op_commute7_thm (x x_1 x_2 : BitVec 32) : - (x_2 ||| x_1) ^^^ (x_1 ^^^ x) = (x_1 ^^^ 4294967295#32) &&& x_2 ^^^ x := sorry - -theorem xor_or_xor_common_op_commute8_thm (x x_1 x_2 : BitVec 32) : - (x_2 ||| x_1) ^^^ (x ^^^ x_1) = (x_1 ^^^ 4294967295#32) &&& x_2 ^^^ x := sorry - -theorem test15_thm (x x_1 : BitVec 8) : - ((x_1 ^^^ x) &&& (x ^^^ 33#8 ^^^ x_1)) * (x ^^^ 33#8 ^^^ x_1) = - ((x_1 ^^^ x) &&& (x ^^^ x_1 ^^^ 33#8)) * (x ^^^ x_1 ^^^ 33#8) := sorry - -theorem test16_thm (x x_1 : BitVec 8) : - ((x_1 ^^^ 33#8 ^^^ x) &&& (x ^^^ x_1)) * (x_1 ^^^ 33#8 ^^^ x) = - ((x_1 ^^^ x ^^^ 33#8) &&& (x ^^^ x_1)) * (x_1 ^^^ x ^^^ 33#8) := sorry - -theorem not_xor_to_or_not1_thm (x x_1 x_2 : BitVec 3) : - x_2 &&& x_1 ^^^ (x ||| x_1) ^^^ 7#3 = x_2 &&& x_1 ||| (x ||| x_1) ^^^ 7#3 := sorry - -theorem not_xor_to_or_not2_thm (x x_1 x_2 : BitVec 3) : - x_2 &&& x_1 ^^^ (x_1 ||| x) ^^^ 7#3 = x_2 &&& x_1 ||| (x_1 ||| x) ^^^ 7#3 := sorry - -theorem not_xor_to_or_not3_thm (x x_1 x_2 : BitVec 3) : - x_2 &&& x_1 ^^^ (x_2 ||| x) ^^^ 7#3 = x_2 &&& x_1 ||| (x_2 ||| x) ^^^ 7#3 := sorry - -theorem not_xor_to_or_not4_thm (x x_1 x_2 : BitVec 3) : - x_2 &&& x_1 ^^^ (x ||| x_2) ^^^ 7#3 = x_2 &&& x_1 ||| (x ||| x_2) ^^^ 7#3 := sorry - -theorem xor_notand_to_or_not1_thm (x x_1 x_2 : BitVec 3) : - x_2 &&& x_1 ^^^ 7#3 ^^^ (x ||| x_1) = x_2 &&& x_1 ||| (x ||| x_1) ^^^ 7#3 := sorry - -theorem xor_notand_to_or_not2_thm (x x_1 x_2 : BitVec 3) : - x_2 &&& x_1 ^^^ 7#3 ^^^ (x_1 ||| x) = x_2 &&& x_1 ||| (x_1 ||| x) ^^^ 7#3 := sorry - -theorem xor_notand_to_or_not3_thm (x x_1 x_2 : BitVec 3) : - x_2 &&& x_1 ^^^ 7#3 ^^^ (x_2 ||| x) = x_2 &&& x_1 ||| (x_2 ||| x) ^^^ 7#3 := sorry - -theorem xor_notand_to_or_not4_thm (x x_1 x_2 : BitVec 3) : - x_2 &&& x_1 ^^^ 7#3 ^^^ (x ||| x_2) = x_2 &&& x_1 ||| (x ||| x_2) ^^^ 7#3 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gxor_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gxor_proof.lean deleted file mode 100644 index cbfb41798..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gxor_proof.lean +++ /dev/null @@ -1,18 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gxor_proof -theorem test1_thm (x : BitVec 32) : x ^^^ 0#32 = x := sorry - -theorem test3_thm (x : BitVec 32) : x ^^^ x = 0#32 := sorry - -theorem test4_thm (x : BitVec 32) : x ^^^ (4294967295#32 ^^^ x) = 4294967295#32 := sorry - -theorem test5_thm (x : BitVec 32) : (x ||| 123#32) ^^^ 123#32 = x &&& 4294967172#32 := sorry - -theorem test6_thm (x : BitVec 8) : x ^^^ 17#8 ^^^ 17#8 = x := sorry - -theorem test7_thm (x x_1 : BitVec 32) : x_1 &&& 7#32 ^^^ x &&& 128#32 = x_1 &&& 7#32 ||| x &&& 128#32 := sorry - diff --git a/SSA/Projects/InstCombine/tests/LLVM/gxorhofhor.lean b/SSA/Projects/InstCombine/tests/LLVM/gxorhofhor.lean index 706c6d4d6..797165234 100644 --- a/SSA/Projects/InstCombine/tests/LLVM/gxorhofhor.lean +++ b/SSA/Projects/InstCombine/tests/LLVM/gxorhofhor.lean @@ -1,4 +1,4 @@ -import SSA.Projects.InstCombine.tests.LLVM.gxorhofhor_proof + import SSA.Projects.InstCombine.LLVM.PrettyEDSL import SSA.Projects.InstCombine.TacticAuto import SSA.Projects.InstCombine.LLVM.Semantics @@ -42,7 +42,7 @@ theorem t1_proof : t1_before ⊑ t1_after := by intros try simp ---BEGIN t1 - apply t1_thm + all_goals (try extract_goal ; sorry) ---END t1 diff --git a/SSA/Projects/InstCombine/tests/LLVM/gxorhofhor_proof.lean b/SSA/Projects/InstCombine/tests/LLVM/gxorhofhor_proof.lean deleted file mode 100644 index b4e481b81..000000000 --- a/SSA/Projects/InstCombine/tests/LLVM/gxorhofhor_proof.lean +++ /dev/null @@ -1,8 +0,0 @@ - -import SSA.Projects.InstCombine.TacticAuto -import SSA.Projects.InstCombine.LLVM.Semantics -open BitVec - -section gxorhofhor_proof -theorem t1_thm (x : BitVec 4) : (x ||| 12#4) ^^^ 10#4 = x &&& 3#4 ^^^ 6#4 := sorry -