You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Prover/Core.fs
+38-33Lines changed: 38 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ open Microsoft.Z3
18
18
// 2: ∧ ∨
19
19
// 3: ¬
20
20
// 4: = ≠ > < ≤ ≥
21
-
// 5: + - × ÷
21
+
// 5: + - × ÷ ↑ ↓
22
22
// 6: - (unary minus) # :: ++ ◁ ▷
23
23
// 7: variables, function applications, and other atoms like true, false, ϵ, expressions inside parenthesis and angle brackets, like universal and existential quantifiers
24
24
// 8: array access
@@ -175,22 +175,24 @@ and Integer =
175
175
memberthis.ToSymbolTree()=
176
176
lettoTree(e:WExpr)= e.ToSymbolTree()
177
177
178
-
letbinary5 symbol x y =
179
-
SymbolTree.Node(Symbol.Op(symbol,5),[ toTree x; toTree y ])
178
+
letbinary b symbol x y =
179
+
SymbolTree.Node(Symbol.Op(symbol, b),[ toTree x; toTree y ])
180
+
181
+
letbinary5,binary4 = binary 5, binary 4
180
182
181
183
match this with
182
184
| ExtInteger e -> e.ToSymbolTree()
183
185
| Integer i -> SymbolTree.Node(Symbol.Const $"{i}",[])
184
186
| UnaryMinus n -> SymbolTree.Node(Symbol.Op("-",6),[ toTree n ])
187
+
| Exceeds(x, y)-> binary4 ">" x y
188
+
| LessThan(x, y)-> binary4 "<" x y
189
+
| AtLeast(x, y)-> binary4 "≥" x y
190
+
| AtMost(x, y)-> binary4 "≤" x y
191
+
| IsDivisor(x, y)-> binary4 "∣" x y
185
192
| Plus(x, y)-> binary5 "+" x y
186
193
| Minus(x, y)-> binary5 "-" x y
187
194
| Times(x, y)-> binary5 "×" x y
188
195
| Divide(x, y)-> binary5 "÷" x y
189
-
| Exceeds(x, y)-> binary5 ">" x y
190
-
| LessThan(x, y)-> binary5 "<" x y
191
-
| AtLeast(x, y)-> binary5 "≥" x y
192
-
| AtMost(x, y)-> binary5 "≤" x y
193
-
| IsDivisor(x, y)-> binary5 "∣" x y
194
196
| Max(x, y)-> binary5 "↑" x y
195
197
| Min(x, y)-> binary5 "↓" x y
196
198
@@ -219,24 +221,16 @@ and Integer =
219
221
letp,q = toExp n, toExp m
220
222
ctx.MkLe(p, q)
221
223
| IsDivisor(n, m)->
222
-
// exists x such n*x = m
223
-
letextractVar=
224
-
function
225
-
| ExtInteger a ->
226
-
match a with
227
-
|:? Var as z -> Some z.Name
228
-
|_-> None
229
-
|_-> None
230
-
231
-
letvarSet=[ n; m ]|> List.choose extractVar |> Set
232
-
letx= varSet - Set ["x";"y";"z"]|> Set.toList |> List.head
233
-
// x ∉ { n, m }
234
-
235
-
letx= ctx.MkIntConst x
224
+
// ⟨∃x :: n*x = m⟩
225
+
letx= ctx.MkBound(0u, ctx.IntSort):?> ArithExpr
236
226
letp,q = toExp n, toExp m
237
227
ctx.MkExists([| x |], ctx.MkEq(ctx.MkMul(p, x), q))
0 commit comments