Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype SMT backend #273

Merged
merged 167 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
f5958cf
add: working on contract for collector
tnelson Jun 18, 2024
88127d4
add: template w/ Karim
tnelson Jun 18, 2024
9d1fcc2
add: Easy way to find Java Temp folder
tnelson Jun 19, 2024
ec18c92
change: send-to-kodkod -> send-to-solver
tnelson Jun 20, 2024
1f8de89
change: factor out pardinus backend
tnelson Jun 20, 2024
e38ad72
Merge branch 'dev' into feat_smt
tnelson Jun 20, 2024
5e6ed36
remove: experiment skeleton
tnelson Jun 20, 2024
d2ecaa0
Converted to format strings
k-mouline Jun 20, 2024
7fe890e
fix: ->
tnelson Jun 20, 2024
b82a887
first changes to parsing
k-mouline Jun 21, 2024
19da701
add: join builder, no preservation of loc
tnelson Jun 21, 2024
dfc9dbc
preserve syntax loc
tnelson Jun 21, 2024
03569ec
updated interpret calls
k-mouline Jun 24, 2024
8ec583b
examples added
k-mouline Jun 24, 2024
55e3c5a
pair with Karim, demo of match
tnelson Jun 24, 2024
c3aed57
identity parsing
k-mouline Jun 24, 2024
47ae4cf
NNF parser
k-mouline Jun 24, 2024
87ea87f
Draft of testing; needs to be validated
bisheshank Jun 25, 2024
68e42ad
Substitutor push
k-mouline Jun 25, 2024
f61ba63
updated testing; needs review
bisheshank Jun 25, 2024
17dd94c
updating substitutor
k-mouline Jun 26, 2024
7d83d9c
add: programming together in NNF/NNF testing, macros
tnelson Jun 26, 2024
5062063
quantifiers and decls fixed
k-mouline Jun 26, 2024
bf430e4
nnf testing updated; need to fix sig-rel contract vio
bisheshank Jun 26, 2024
d4e8a69
small sub tests and nnf conversion modified
k-mouline Jun 26, 2024
2c9de2e
verbosity added and sub tests
k-mouline Jun 26, 2024
23f820e
nnf-testing suite rewritten
bisheshank Jun 26, 2024
8d69be9
nff-test updated with comparision tests
bisheshank Jun 26, 2024
44d0280
refactor: one-sided integration prototype for cvc5
tnelson Jun 27, 2024
f1e5100
skolemization first implementation
k-mouline Jun 27, 2024
ff7e392
bounds propagate up
k-mouline Jun 27, 2024
7162ae1
add: additional refactoring around SMTlib backend
tnelson Jun 28, 2024
01dd402
minor: print out raw cvc5 response in sat case
tnelson Jun 28, 2024
2c8f5c6
working: basic parsing of SMTlib SAT response
tnelson Jun 28, 2024
eb4c77f
add: own-grandpa, sterling proof of concept
tnelson Jun 28, 2024
33f32d1
integer reconciliation
k-mouline Jun 28, 2024
a912f9a
first attempt at converting to smtlib
k-mouline Jun 28, 2024
649d3d6
add: working on integration. NNF and int-conversion in pipeline
tnelson Jun 29, 2024
abfa8ed
partial conversion, need to stop soon
tnelson Jun 29, 2024
e85656b
more adjustments to skolem
tnelson Jun 29, 2024
0c30972
add: more fixes, see initialed comments in skolem
tnelson Jun 29, 2024
c4c8fd1
add: final pipeline step
tnelson Jun 29, 2024
658ce7a
working through skolem, starting SMT conversion add
tnelson Jun 29, 2024
45b3297
rough mapping into cvc5, not done yet'
tnelson Jun 29, 2024
e26fd69
working on SMT conversion
tnelson Jun 29, 2024
59ebf96
fix: skolemize _inner_ formula as well. also fix var call order
tnelson Jun 29, 2024
c709c44
fix: quantifier IDs, more robust cmd line args
tnelson Jun 29, 2024
7ff052a
fix: use XSort in quantifier domains
tnelson Jun 29, 2024
1805e3c
intermediate checkpoint: multi-run is combining results
tnelson Jun 29, 2024
a4c7d5e
fix: singleton tuple processing. note failing test, skolem issue
tnelson Jun 29, 2024
83697e4
fix: skolem depth 0 only; cleanup
tnelson Jun 30, 2024
33c32fa
misc fixes, 3-ary relations
tnelson Jun 30, 2024
171e249
add test
tnelson Jul 1, 2024
9a1d174
add: print stderr from cvc5 in another location
tnelson Jul 1, 2024
52514ab
add: basic collector draft, working on smoke tests
tnelson Jul 2, 2024
3464314
update: collector
tnelson Jul 2, 2024
810c352
fix: ordering in collector, add tesT
tnelson Jul 2, 2024
ef54bb2
Small edits to skolemization
k-mouline Jul 2, 2024
d412ba1
atom test added
k-mouline Jul 3, 2024
ea59bec
several changes, mostly multiplicity
k-mouline Jul 3, 2024
6218d18
saving intermediate work
tnelson Jul 3, 2024
504ea94
adding tests
tnelson Jul 3, 2024
c46abe5
paren fix and beginning some work on ints
k-mouline Jul 3, 2024
0396f60
disable int literal checking for smtlibtor
tnelson Jul 3, 2024
0ab2f30
decl domains are expressions
tnelson Jul 3, 2024
5b8a834
add: fix errors with skolem, contract
tnelson Jul 3, 2024
9a2c532
working; will convert join to application on merge
tnelson Jul 3, 2024
e8a7c9f
convert join to application
tnelson Jul 3, 2024
5ae8d8c
add: allow Unknown message to Sterling; blank right now
tnelson Jul 3, 2024
b973852
defensive check
tnelson Jul 3, 2024
0fb298a
more int work
k-mouline Jul 3, 2024
a8dec28
merge
tnelson Jul 3, 2024
ba285b2
add: handle unknown in tests, etc. (cannot test much yet)
tnelson Jul 4, 2024
69c7123
to-skolem func args fixed
k-mouline Jul 5, 2024
0cda303
fun spacer maintained in substitutor
k-mouline Jul 5, 2024
df80e05
fix: error message string
tnelson Jul 5, 2024
9358764
add: pair programming
tnelson Jul 5, 2024
a7534bb
add: comment only, thinking re: int
tnelson Jul 5, 2024
06d4100
add: Goldbach for unsat
tnelson Jul 5, 2024
b614800
Vars and decls sorted out
k-mouline Jul 5, 2024
64d1b15
resolve conflict
tnelson Jul 8, 2024
a6574ce
fix: missing annotation #f
tnelson Jul 8, 2024
972ba22
add: annotation to qvar for smtlib integer conversion'
tnelson Jul 8, 2024
ae0d390
add: draft annotation use
tnelson Jul 8, 2024
0fb841e
add: define sign SMT function, question re ints
tnelson Jul 8, 2024
4e114a8
add: comment, question about ints
tnelson Jul 8, 2024
26a74a2
add: untangle expr/const case
tnelson Jul 8, 2024
6ae6ae9
add: relational update unsupported
tnelson Jul 8, 2024
a4bfc03
add: draft for translating none
tnelson Jul 8, 2024
b874a48
add: notes on int
tnelson Jul 8, 2024
dfd6128
oops
tnelson Jul 8, 2024
7c48a42
add: proof of concept, pair programming with Karim
tnelson Jul 8, 2024
b54323c
add: stop policy to collector
tnelson Jul 8, 2024
87342b7
fix: hacky fix for substitutor fun-spacer; needs expanding
tnelson Jul 9, 2024
32a92e0
quantifier grounding added
k-mouline Jul 9, 2024
efc57cf
fake run added
k-mouline Jul 9, 2024
a07b349
fix: minor to collector, add grandpa
tnelson Jul 9, 2024
80a1c1e
Comparison pull request (#265)
k-mouline Aug 1, 2024
e0686e8
patch
tnelson Aug 1, 2024
37d99b6
manual merge from dev
tnelson Aug 1, 2024
cc08cd9
minor: comment change to avoid confusion
tnelson Aug 1, 2024
35e7e4b
minor: comment fix
tnelson Aug 1, 2024
0c3e9e5
fix: get-annotation for nodes
tnelson Aug 1, 2024
2e22980
Fixing issue with to-smt visitor; refactor lang-specific error code (…
tnelson Aug 5, 2024
4cfef1a
fix: quantifier case in tor conversion
tnelson Aug 5, 2024
7717a47
fix: blocking in error case from cvc5
tnelson Aug 5, 2024
d4509d5
Comprehension and integer handling improved
k-mouline Aug 5, 2024
f9e4855
fix: parsing smt response, allow 'some Node'
tnelson Aug 5, 2024
cbc2b61
rename univInt, no longer pass IntAtom-to-Int
tnelson Aug 5, 2024
9e669dc
Cardinality supported, a few fixes needed
k-mouline Aug 6, 2024
9d4ed97
match against nested ites
tnelson Aug 7, 2024
5a1adf3
fix: issue with chained ite
tnelson Aug 7, 2024
dfc5daa
fix: negative numbers in IntAtom-to-Int
tnelson Aug 7, 2024
ea152f2
fix more
tnelson Aug 7, 2024
83e7bbc
fix: update sterling for larger numbers
tnelson Aug 7, 2024
af90532
Added more comp/card tests, added to expression-type struct
k-mouline Aug 7, 2024
462edb1
fix: remove leftover prints
tnelson Aug 8, 2024
7923a0d
fix: arity of function call
tnelson Aug 8, 2024
b05b7d5
Tests for Tim
k-mouline Aug 8, 2024
4aae72f
fix to use of 'second' in last-checker, clarifying comments
tnelson Aug 8, 2024
f3c86d4
Multiplicities fixed and tests added
k-mouline Aug 8, 2024
fa5b2e3
More tests
k-mouline Aug 12, 2024
48769bc
Relational override, reflexive tc typing, lone sig, and tests
k-mouline Aug 14, 2024
212463a
add: don't pass translation-helpers to sterling
tnelson Aug 14, 2024
17cde9e
Fixed cardinality of size 0 set typing
k-mouline Aug 14, 2024
dce6b19
Cardinality error fixed
k-mouline Aug 14, 2024
24a8905
add: finite int set, commented test example
tnelson Aug 15, 2024
1a23e3e
add: additional comment
tnelson Aug 15, 2024
b11ffa8
Plenty more tests added
k-mouline Aug 16, 2024
e9cbfeb
Tests fixed
k-mouline Aug 19, 2024
3312ac6
update pardinus: return parse error text
tnelson Aug 20, 2024
2768b8b
fix for non-smt, which gives no Int sig in instances
tnelson Aug 20, 2024
d91d825
Feat smt s exp (#271)
tnelson Aug 20, 2024
4bcfe5b
Fix prime check (#272)
tnelson Aug 20, 2024
f167639
Extra files removed
k-mouline Aug 20, 2024
8b62e4a
fix: skolemization tests robust to suffix
tnelson Aug 20, 2024
ff2ca40
S-exp descent and substitution added
k-mouline Aug 21, 2024
876db0e
Small errors fixed
k-mouline Aug 21, 2024
13c725b
refactor: SMT ToR tests into CI folder
tnelson Aug 21, 2024
3d8df26
Two out of three tests fixed
k-mouline Aug 21, 2024
2fefb34
remove outdated test
tnelson Aug 21, 2024
cc34513
Temp file added for verbose SMT runs
k-mouline Aug 21, 2024
f29b42c
cleanup verbosity, test cvc5 in CI
tnelson Aug 22, 2024
8efdc1e
experiment: actions
tnelson Aug 22, 2024
c67df5e
refine CI, update racket version and print cvc5 version
tnelson Aug 22, 2024
6b961d2
Wrap negative numbers for earlier cvc5 versions
tnelson Aug 22, 2024
7b068ed
fix: wrap -1 in sign built-in
tnelson Aug 22, 2024
e101a6d
minor: cleanup
tnelson Aug 22, 2024
a9f2c6d
add: more comprehension tests
tnelson Aug 22, 2024
54fe251
fix: uniqueness of ints, regression tests
tnelson Aug 22, 2024
da9777c
add: understanding ic3 example
tnelson Aug 23, 2024
66f377d
fix: remainder lambda
tnelson Aug 23, 2024
d01c5a9
minor fixes, mod
tnelson Sep 2, 2024
fe8d3e0
add: avoid asserting true
tnelson Sep 29, 2024
0c23720
add: include options in SMT-lib, not command line, where applicable
tnelson Sep 29, 2024
60a292f
add: simplify 'one' constraint
tnelson Oct 1, 2024
61d7392
adjust CI
tnelson Oct 15, 2024
050b654
update: CI
tnelson Oct 15, 2024
740b65b
smt tests verbosity set to 0
k-mouline Oct 17, 2024
85ca793
add: improve debugging line in reader
tnelson Oct 23, 2024
8fd9b3d
add: exclude examples from domains from compile
tnelson Nov 12, 2024
9ef1c70
Docker container for CI (#280)
k-mouline Nov 19, 2024
ccc9da5
add: null for PR in CI script
tnelson Nov 19, 2024
d654466
Merge branch 'dev' into feat_smt
tnelson Nov 19, 2024
d1dbee2
update: continue reconciling dev with feature branch
tnelson Nov 19, 2024
6d650ef
fix: is_theorem_disabled test, ++ case in smtlibtor conversion
tnelson Nov 19, 2024
82ca78a
cleanup: SMT / solver specifics
tnelson Nov 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change: send-to-kodkod -> send-to-solver
  • Loading branch information
tnelson committed Jun 20, 2024
commit ec18c92f14dd45fd2066c3d14bc0102c94a67439
4 changes: 2 additions & 2 deletions forge/amalgam.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

(require forge/amalgam/desugar/desugar)
(require forge/amalgam/lift-bounds/lift-bounds)
(require forge/send-to-kodkod)
(require forge/send-to-solver)

(require (only-in racket/contract define/contract ->i and/c or/c listof))
(require (only-in racket cartesian-product first second rest empty?
Expand Down Expand Up @@ -55,7 +55,7 @@
; which means we have its Run-spec
; which is post-processing by the run macro
(define modified-run-spec (struct-copy Run-spec (Run-run-spec orig-run) [scope scope] [bounds bounds]))
(define-values (run-result atoms server-ports kodkod-currents kodkod-bounds) (send-to-kodkod modified-run-spec (Run-command orig-run)))
(define-values (run-result atoms server-ports kodkod-currents kodkod-bounds) (send-to-solver modified-run-spec (Run-command orig-run)))
(Run (Run-name orig-run) (Run-command orig-run) modified-run-spec run-result server-ports atoms kodkod-currents kodkod-bounds))

; takes a hash-table representation of an instance and a tuple and flips the truth of
Expand Down
12 changes: 6 additions & 6 deletions forge/send-to-kodkod.rkt → forge/send-to-solver.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
; Disable DrRacket GUI extension/tool
;(require "drracket-gui.rkt")

(provide send-to-kodkod)
(provide send-to-solver)

(define no-version-printed-yet #t)

Expand All @@ -37,12 +37,12 @@
; and throw a friendlier error if one is re-used.
(define run-name-history (box (list)))

; send-to-kodkod :: Run-spec -> Stream<model>, List<Symbol>
; send-to-solver :: Run-spec -> Stream<model>, List<Symbol>
; Given a Run-spec structure, processes the data and communicates it to KodKod-CLI;
; then produces a stream to produce instances generated by KodKod,
; along with a list of all of the atom names for sig atoms.
(define (send-to-kodkod run-spec run-command #:run-name [run-name (gensym)])
(do-time "send-to-kodkod")
(define (send-to-solver run-spec run-command #:run-name [run-name (gensym)])
(do-time "send-to-solver")

; In case of error, highlight an AST node if able. Otherwise, focus on the offending run command.
(define (raise-run-error message [node #f])
Expand Down Expand Up @@ -152,7 +152,7 @@
[(and (unbox server-state) ((Server-ports-is-running? (unbox server-state))))
(define sstate (unbox server-state))
(when (@> (get-verbosity) VERBOSITY_LOW)
(printf "Pardinus solver process already running. Preparing to start new run with id ~a.~n" run-name))
(printf "~a solver process already running. Preparing to start new run with id ~a.~n" backend run-name))
(values (Server-ports-stdin sstate) (Server-ports-stdout sstate)
(Server-ports-stderr sstate) (Server-ports-shutdown sstate)
(Server-ports-is-running? sstate))]
Expand Down Expand Up @@ -797,7 +797,7 @@ Please declare a sufficient scope for ~a."
;(define upper (set->list (set-intersect (get-bound-upper relation) (list->set (apply cartesian-product sig-atoms)))))
;(printf "~a: refined upper : ~a~n" relation upper)

; Piecewise lower bounds were handled in sigs-functional, before send-to-kodkod is called.
; Piecewise lower bounds were handled in sigs-functional, before send-to-solver is called.
(define lower
(let ([bound-lower (get-bound-lower relation)])
(if bound-lower
Expand Down
12 changes: 6 additions & 6 deletions forge/sigs-functional.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
(require forge/shared
forge/sigs-structs
forge/evaluator
forge/send-to-kodkod)
forge/send-to-solver)

(require (only-in forge/lang/alloy-syntax/parser [parse forge-lang:parse])
(only-in forge/lang/alloy-syntax/tokenizer [make-tokenizer forge-lang:make-tokenizer]))
Expand Down Expand Up @@ -601,7 +601,7 @@
; piecewise (incomplete), it cannot be bound complete. E.g., we cannot mix "`Alice.father = ..."
; and "father = " ...
; However, we cannot actually convert 'in/'= piecewise bounds to complete upper bounds until
; send-to-kodkod, when we have created the universe of atoms and can "fill in" missing upper bounds.
; send-to-solver, when we have created the universe of atoms and can "fill in" missing upper bounds.
; (Piecewise 'ni bounds should be fine to convert here.)
(for/list ([rel (hash-keys (Bound-piecewise bounds))])
(when (or (hash-has-key? (Bound-tbindings bounds) rel)
Expand All @@ -614,10 +614,10 @@
(define pwb (hash-ref (Bound-piecewise bounds) rel))
(define tups (PiecewiseBound-tuples pwb))
(cond [(equal? '= (PiecewiseBound-operator pwb))
; update only lower bound, not upper (handled in send-to-kodkod)
; update only lower bound, not upper (handled in send-to-solver)
(update-bindings bs rel tups #f #:node #f)]
[(equal? 'in (PiecewiseBound-operator pwb))
; do nothing (upper bound handled in send-to-kodkod)
; do nothing (upper bound handled in send-to-solver)
bs]
[(equal? 'ni (PiecewiseBound-operator pwb))
; update lower-bound
Expand All @@ -633,7 +633,7 @@

(define spec (Run-spec state preds scope bounds-with-piecewise-lower target))
(define-values (result atoms server-ports kodkod-currents kodkod-bounds)
(send-to-kodkod spec command #:run-name name))
(send-to-solver spec command #:run-name name))

(Run name command spec result server-ports atoms kodkod-currents kodkod-bounds (box #f)))

Expand Down Expand Up @@ -911,7 +911,7 @@
[target new-target]
[state new-state]))
(define-values (run-result atom-rels server-ports kodkod-currents kodkod-bounds)
(send-to-kodkod contrast-run-spec))
(send-to-solver contrast-run-spec))
(define contrast-run
(struct-copy Run run
[name (string->symbol (format "~a-contrast" (Run-name run)))]
Expand Down
2 changes: 1 addition & 1 deletion forge/sigs-structs.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

; NOTE WELL:
; The structs below define an intermediate representation; the Kodkod bounds (produced in
; forge/send-to-kodkod) are what is actually sent to the solver.
; forge/send-to-solver) are what is actually sent to the solver.

; ALSO: be aware that the "bounds", "sbounds" etc. structs defined elsewhere are distinct from
; the Bounds struct defined here. At some point, we can perhaps condense these into a single IR.
Expand Down
4 changes: 2 additions & 2 deletions forge/sigs.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
forge/sigs-structs
forge/evaluator
(prefix-in tree: forge/lazy-tree)
forge/send-to-kodkod)
forge/send-to-solver)
(require (only-in forge/lang/alloy-syntax/parser [parse forge-lang:parse])
(only-in forge/lang/alloy-syntax/tokenizer [make-tokenizer forge-lang:make-tokenizer]))
(require (only-in forge/sigs-functional
Expand Down Expand Up @@ -876,7 +876,7 @@
[target new-target]
[state new-state]))
(define-values (run-result atom-rels server-ports kodkod-currents kodkod-bounds)
(send-to-kodkod contrast-run-spec))
(send-to-solver contrast-run-spec))
(define contrast-run
(struct-copy Run run
[name (string->symbol (format "~a-contrast" (Run-name run)))]
Expand Down