@@ -84,7 +84,32 @@ def solver (bvExpr: BVLogicalExpr) : TermElabM (Option (Std.HashMap Nat BVExpr.P
84
84
return .some equations
85
85
86
86
87
- def substitute (bvLogicalExpr: BVLogicalExpr) (assignment: Std.HashMap Nat BVExpr.PackedBitVec) : BVLogicalExpr :=
87
+ ---- Test Solver function ----
88
+ def simpleArith : BVLogicalExpr :=
89
+ let x := BVExpr.const (BitVec.ofNat 5 2 )
90
+ let y := BVExpr.const (BitVec.ofNat 5 4 )
91
+ let z : BVExpr 5 := BVExpr.var 0
92
+ let sum : BVExpr 5 := BVExpr.bin x BVBinOp.add z
93
+ BoolExpr.literal (BVPred.bin sum BVBinPred.eq y)
94
+
95
+ syntax (name := testExSolver) "test_solver" : tactic
96
+ @[tactic testExSolver]
97
+ def testSolverImpl : Tactic := fun _ => do
98
+ let res ← solver simpleArith
99
+ match res with
100
+ | none => pure ()
101
+ | some counterex =>
102
+ for (id, var) in counterex do
103
+ logInfo m! "Results: {id}={var.bv}"
104
+ pure ()
105
+
106
+ theorem test_solver : False := by
107
+ test_solver
108
+
109
+
110
+
111
+ def substitute (bvLogicalExpr: BVLogicalExpr) (assignment: Std.HashMap Nat BVExpr.PackedBitVec) :
112
+ BVLogicalExpr :=
88
113
let rec substituteBVExpr {w: Nat} (bvExpr : BVExpr w) : BVExpr w :=
89
114
match bvExpr with
90
115
| .var idx =>
@@ -152,30 +177,6 @@ partial def existsForAll (bvExpr: BVLogicalExpr) (existsVars: List Nat) (forAllV
152
177
existsForAll (BoolExpr.gate Gate.and bvExpr newExpr) existsVars forAllVars
153
178
154
179
155
-
156
- ---- Test Solver function ----
157
- def simpleArith : BVLogicalExpr :=
158
- let x := BVExpr.const (BitVec.ofNat 5 2 )
159
- let y := BVExpr.const (BitVec.ofNat 5 4 )
160
- let z : BVExpr 5 := BVExpr.var 0
161
- let sum : BVExpr 5 := BVExpr.bin x BVBinOp.add z
162
- BoolExpr.literal (BVPred.bin sum BVBinPred.eq y)
163
-
164
- syntax (name := testExSolver) "test_solver" : tactic
165
- @[tactic testExSolver]
166
- def testSolverImpl : Tactic := fun _ => do
167
- let res ← solver simpleArith
168
- match res with
169
- | none => pure ()
170
- | some counterex =>
171
- for (id, var) in counterex do
172
- logInfo m! "Results: {id}={var.bv}"
173
- pure ()
174
-
175
- theorem test_solver : False := by
176
- test_solver
177
-
178
-
179
180
---- Test ExistsForAll function ---
180
181
def leftShiftRightShiftOne : BVLogicalExpr :=
181
182
let bitwidth := 4
@@ -235,3 +236,18 @@ def testExFaImpl : Tactic := fun _ => do
235
236
236
237
theorem test_exists_for_all : False := by
237
238
test_exists_for_all
239
+
240
+
241
+ def binaryOperators : List BVBinOp :=
242
+ [BVBinOp.add, BVBinOp.mul]
243
+
244
+
245
+ def inductive_synthesis (expr: BVExpr w) (inputs: List Nat) (constants: Std.HashMap Nat (BVExpr w)) (target: BVExpr w) (depth: Nat) :
246
+ TermElabM (Option (List (BVExpr w))) := do
247
+ match depth with
248
+ | 1 => return none -- enumerative synthesis
249
+ | _ =>
250
+ let res : List (BVExpr w) := []
251
+ for (const, value) in constants.toArray do
252
+ logInfo m! "Hello"
253
+ return some []
0 commit comments