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

Isabelle Translation #3514

Draft
wants to merge 253 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
253 commits
Select commit Hold shift + click to select a range
0b4d42d
Now throws IllegalFormulaException when translating unimplemented par…
BookWood7th Jan 24, 2024
47efaf6
temp
BookWood7th Jan 25, 2024
027f5d2
Added temporary mechanisms for handling isabelle intrinsic functions
BookWood7th Jan 28, 2024
0440925
Started adding handlers for translation
BookWood7th Mar 2, 2024
6f7367a
Added LogicalVariableHandler
BookWood7th Mar 2, 2024
5ed77c6
Added BooleanOpHandler
BookWood7th Mar 2, 2024
ac9c2bc
Added UninterpretedSymbolsHandler
BookWood7th Mar 2, 2024
5b87e7c
Added handlers for integers
BookWood7th Mar 2, 2024
2bf6cfa
Preambles and handlers are now loaded from property files
BookWood7th Mar 2, 2024
904a5dc
Now adds locales to Translation like jArithmetics
BookWood7th Mar 3, 2024
3dab8bd
Added QuantifierHandler
BookWood7th Mar 3, 2024
9dbc690
Fixed negative numbers getting two neg signs
BookWood7th Mar 3, 2024
1547228
Fixed negative numbers getting two neg signs
BookWood7th Mar 3, 2024
2498b62
Now create typedef for all sorts in sequent
BookWood7th Mar 3, 2024
2876c25
Removed some unused fields and methods in IsabelleTranslator
BookWood7th Mar 3, 2024
ece3842
Added correct predefined sorts in UninterpretedSymbolsHandler
BookWood7th Mar 3, 2024
80b7f27
removed unused translation parts and added class instantiation for ex…
BookWood7th Mar 3, 2024
223fb93
changed some instanceall functions in preamble
BookWood7th Mar 3, 2024
0abb4a1
corrected predefined sorts
BookWood7th Mar 5, 2024
9017582
added length to preamble
BookWood7th Mar 5, 2024
0e78f3f
field handler v1
BookWood7th Mar 5, 2024
e01b85f
fix indentation
BookWood7th Mar 5, 2024
d356980
redundant escape in regex
BookWood7th Mar 6, 2024
ff01f54
added SortDependingFunctionHandler
BookWood7th Mar 6, 2024
dc147ed
added DefinedSymbolsHandler
BookWood7th Mar 6, 2024
d9f8fe9
added comments improved lemmata for sort declarations
BookWood7th Mar 6, 2024
50f8949
ensured fieldhandler only handles field constants
BookWood7th Mar 6, 2024
29f1a1d
handleAsUnkownValue now functions better
BookWood7th Mar 6, 2024
96de5f0
slight preamble changes and changed translation for eqv
BookWood7th Mar 6, 2024
763732c
renamed Object to java_lang_Object in preamble
BookWood7th Mar 6, 2024
e69ae64
ensure illegal chars in name are not translated in UninterpretedSymbo…
BookWood7th Mar 6, 2024
984b1d7
now looks for sorts parents only among given sorts (and any, Object)
BookWood7th Mar 6, 2024
24d52e3
fixed some remaining illegal sort names
BookWood7th Mar 6, 2024
fa94d5f
preamble change so all rep abs have the same format
BookWood7th Mar 7, 2024
bd3aa86
added coercions to parent types
BookWood7th Mar 7, 2024
97a5f93
added length function and axiom to preamble
BookWood7th Mar 7, 2024
ffb7f29
formatting integers.locale
BookWood7th Mar 7, 2024
69126d3
fix length axiom
BookWood7th Mar 7, 2024
17baf33
locale formatting
BookWood7th Mar 7, 2024
fb8ccbc
accounted for 2nd field syntax
BookWood7th Mar 7, 2024
962aa3a
added ObserverFunctionHandler
BookWood7th Mar 7, 2024
5250146
added BSumHandler for bounded sums
BookWood7th Mar 7, 2024
2f66287
translation now translates antecedents as assumptions of a theorem
BookWood7th Mar 7, 2024
f23d9a8
now throws exception when encountering unknown values
BookWood7th Mar 8, 2024
6c1df63
fixing pipeline
BookWood7th Mar 8, 2024
3e4af59
revert pipeline changes
BookWood7th Mar 8, 2024
381c8ea
ensured FieldHandler fixes unknown fields
BookWood7th Mar 9, 2024
67b0849
changed sort name translations to better account for predefined sorts…
BookWood7th Mar 9, 2024
bf211e6
changed any type class instantiations to use fun instead of definition.
BookWood7th Mar 9, 2024
6b67f3d
fix error in sort depending functions
BookWood7th Mar 9, 2024
6a8c37b
added axiomatizations for function symbols in preamble
BookWood7th Mar 9, 2024
110d020
adjusted translation name for length of objects
BookWood7th Mar 9, 2024
918d951
fixed bug where translation crashes on non open goals
BookWood7th Mar 9, 2024
7a18eb9
add arr function to defined symbols
BookWood7th Mar 9, 2024
e3cdbad
added LocSet function definitions
BookWood7th Mar 10, 2024
04b2b18
made BSum use at least less than instead of subtracting one
BookWood7th Mar 10, 2024
b29c834
1st version of reasoning over Sequences
BookWood7th Mar 10, 2024
081078b
bug fixes
BookWood7th Mar 11, 2024
2c06f40
added locale interpretation for int and bool to access additional lem…
BookWood7th Mar 13, 2024
4992fbe
better translation of array sorts
BookWood7th Mar 13, 2024
060d992
added lots of axioms and types to preamble
BookWood7th Mar 14, 2024
dc1262b
added some more defined symbols in DefinedSymbolsHandler
BookWood7th Mar 14, 2024
b3e03e4
inverted knownSymbol and knownSort functions
BookWood7th Mar 15, 2024
6639c6e
added jdiv and jmod to IntegerOpHandler
BookWood7th Mar 15, 2024
4dc07de
added InstanceOperatorHandler
BookWood7th Mar 15, 2024
75e262b
added function to switch from int bSum to nat bSum in preamble
BookWood7th Mar 16, 2024
2e4619e
field names should not include .
BookWood7th Mar 16, 2024
e5fe37c
neg, jdiv, jmod translation fixes
BookWood7th Mar 17, 2024
e2da013
removed fulfilled TODO
BookWood7th Mar 17, 2024
10417ae
fix javaDL_type declaration
BookWood7th Mar 17, 2024
30f6720
currying applied to elementOf function
BookWood7th Mar 17, 2024
48101e5
now saves translation file to subdirectory of .key folder
BookWood7th Mar 18, 2024
da0aa66
moved services parameter of methods to field in Translator
BookWood7th Mar 18, 2024
0d2a1e5
added scala-isabelle project to dependencies
BookWood7th Mar 20, 2024
44f50f2
opens the translation file in Isabelle
BookWood7th Mar 20, 2024
a037d50
added naive concurrency implementation for opening Isabelle
BookWood7th Mar 20, 2024
1da460a
cleanup
BookWood7th Mar 21, 2024
4b7aad3
handling other observer functions
BookWood7th Mar 21, 2024
4bddd78
Seq handling improved
BookWood7th Mar 22, 2024
233c483
changed function signatures in preamble to match KeY
BookWood7th Mar 25, 2024
47b0abd
parameter order fixes in functions
BookWood7th Apr 2, 2024
5b0d9a1
further fixes
BookWood7th Apr 2, 2024
d10d8da
removed div_nonzero
BookWood7th Apr 2, 2024
8c515d1
temp
BookWood7th Apr 8, 2024
388c6c4
further temp
BookWood7th Apr 11, 2024
900db5e
Now calls sledgehammer and outputs result to command line
BookWood7th Apr 12, 2024
ce55e0b
added type to lambda parameter
BookWood7th Apr 13, 2024
ea7ee25
Merge remote-tracking branch 'refs/remotes/key-origin/ScalaAutomation…
BookWood7th Apr 13, 2024
db3e478
removed unused converter stumps
BookWood7th Apr 13, 2024
4a42667
auto closes selected goal if proven by sledgehammer
BookWood7th Apr 13, 2024
4a5d889
added all default provers to sledgehammer
BookWood7th Apr 13, 2024
493603d
added settings to change save file path and isabelle path
BookWood7th Apr 14, 2024
9a679e1
better default path handling
BookWood7th Apr 14, 2024
2d10f4b
added GUI settings
BookWood7th Apr 14, 2024
5911eda
fixed file store location
BookWood7th Apr 14, 2024
1339185
now destroys isabelle resources
BookWood7th Apr 14, 2024
a727966
splitting into preamble and sequent
BookWood7th Apr 15, 2024
3d16ccd
handle missing isabelle correctly
BookWood7th Apr 15, 2024
5a4f8c1
rename settings window
BookWood7th Apr 15, 2024
e308a88
default translation path rename
BookWood7th Apr 15, 2024
c47c919
fix translation preamble
BookWood7th Apr 15, 2024
eba83d1
improve close message
BookWood7th Apr 15, 2024
e950c8b
better Log messages
BookWood7th Apr 15, 2024
c9c4ad4
add SeqPerm
BookWood7th Apr 16, 2024
7528970
now built around having a ROOT session and unchanging preamble
BookWood7th Apr 16, 2024
eba422e
load settings at startup
BookWood7th Apr 16, 2024
2c4ce32
file path changes
BookWood7th Apr 16, 2024
82ed6e5
create session files at startup and when changing translation path
BookWood7th Apr 16, 2024
dd1e262
fix file loading errors and translation imports
BookWood7th Apr 16, 2024
cefc94a
remove interpretations as subtypes of any (might interfere with induc…
BookWood7th Apr 16, 2024
ab3d918
fix observer functions
BookWood7th Apr 18, 2024
2c63a1e
add infiniteUnion
BookWood7th Apr 18, 2024
9e39900
fix translation when multiple invariants occur
BookWood7th Apr 18, 2024
6c7a204
fix infiniteUnion and add preamble definition for it
BookWood7th Apr 18, 2024
cf717b6
add broken main file
BookWood7th Apr 16, 2024
8d7e497
fixed main file
BookWood7th Apr 16, 2024
295635f
bugs in main file
BookWood7th Apr 16, 2024
9fb3910
remove replay from stats
BookWood7th Apr 16, 2024
958a812
write files down in file crawler
BookWood7th Apr 17, 2024
c1fb9e9
run SMT Prep and launch solvers on all goals
BookWood7th Apr 17, 2024
ee43f0b
first attempt at recording stats for each goal
BookWood7th Apr 17, 2024
48b960e
message improvement add timeout for valid file search
BookWood7th Apr 17, 2024
bed3a44
evaluation now works for KeY and Z3
BookWood7th Apr 17, 2024
368cd48
fixes statistics save
BookWood7th Apr 18, 2024
a4429c8
fix csv
BookWood7th Apr 18, 2024
2a52750
add timeout and listeners to IsabelleProblem
BookWood7th Apr 18, 2024
8cde773
add Isabelle to evaluation class
BookWood7th Apr 18, 2024
cab98ce
fix result not being set when notifying listeners
BookWood7th Apr 18, 2024
ac7cb91
change runtimeexception to illegal formula exception
BookWood7th Apr 18, 2024
0745812
fix Isabelle actually starting
BookWood7th Apr 18, 2024
5268259
add isabelle stats to csv
BookWood7th Apr 18, 2024
f941eb4
change return timing to get notifications
BookWood7th Apr 18, 2024
d3e5e38
fix exactInstance overlapping for multiple instances
BookWood7th Apr 18, 2024
2c73ff0
fix exactInstance overlapping for multiple instances
BookWood7th Apr 18, 2024
e9929c2
fix array types being defined before their base type
BookWood7th Apr 18, 2024
e43235f
Merge branch 'refs/heads/isabelleTranslation' into Evaluation
BookWood7th Apr 18, 2024
25f3302
add timeout in other places it should occur
BookWood7th Apr 18, 2024
d5d2661
add isabelle proof to csv
BookWood7th Apr 18, 2024
0203874
try try0 before sledgehammering
BookWood7th Apr 19, 2024
b6aaba2
add right sum induct lemma to preamble
BookWood7th Apr 19, 2024
35a4985
various fixes, adding a timeout
BookWood7th Apr 19, 2024
ee33591
verit missing from sledgehammer
BookWood7th Apr 19, 2024
bae7037
wrong timeout being thrown
BookWood7th Apr 19, 2024
99ee8ff
string for empty results
BookWood7th Apr 19, 2024
9a16c07
add create to defined symbols
BookWood7th Apr 19, 2024
5a86b7b
add create to defined symbols
BookWood7th Apr 19, 2024
38dd299
fix invariants for different types colliding
BookWood7th Apr 19, 2024
422cdd2
add back falsify to sledgehammer
BookWood7th Apr 19, 2024
355a457
strategy settings messed up the SMT Prep macro
BookWood7th Apr 19, 2024
93ddcb3
fix locale for no variables in sequent and destroy isabelle process e…
BookWood7th Apr 20, 2024
26c04b4
added launcher for Isabelle to avoid loading theory for each problem
BookWood7th Apr 20, 2024
1749913
observer function naming fix
BookWood7th Apr 20, 2024
4fa03e7
move logger outputs in IsabelleProblem to debug
BookWood7th Apr 20, 2024
2d0f65d
remove settings parameter from individual sledgehammer calls, fix bug…
BookWood7th Apr 21, 2024
2817fc7
logger outputs and setting max steps to max value
BookWood7th Apr 21, 2024
838bbcd
fix unknowns with #
BookWood7th Apr 21, 2024
59529ff
add assumption to locale to make sure all fields are distinct.
BookWood7th Apr 21, 2024
77ab9a6
Change to LOGGER from System.out.println, parallelize Z3, hopefully c…
BookWood7th Apr 21, 2024
fb11bff
stop Z3 launcher to hopefully prevent zombie Z3 instances
BookWood7th Apr 21, 2024
bca4777
add created field to distinct field lemma
BookWood7th Apr 22, 2024
198ca2f
move outdir to home/tmp
BookWood7th Apr 22, 2024
622fe17
fix last commit
BookWood7th Apr 22, 2024
acad9df
example now dependent on user home
BookWood7th Apr 22, 2024
a3ed40f
need to create directories before session files
BookWood7th Apr 22, 2024
ce9d405
write translation files on launcher start
BookWood7th Apr 22, 2024
a41e62f
add shutdown hook for saving csv and increase concurrency
BookWood7th Apr 22, 2024
d7ec385
switch to expansion without splits and set indices for goals
BookWood7th Apr 23, 2024
33ac488
improve concurrency and resource management
BookWood7th Apr 23, 2024
ffff417
take advantage of more Z3 launches, and Isabelle concurrency
BookWood7th Apr 23, 2024
5c6dd54
add shadow plugin to create executable jars for evaluation deployment
BookWood7th Apr 23, 2024
c6b9e35
remove non pooled sledgehammerAll, was redundant
BookWood7th Apr 23, 2024
5a8de75
inline begin theory parameter
BookWood7th Apr 23, 2024
62de571
fix csv header, illegal characters
BookWood7th Apr 23, 2024
d55e4fa
fix typo of seqGetOutside
BookWood7th Apr 24, 2024
9e87fca
load smt settings instead of using default instance
BookWood7th Apr 24, 2024
00f345d
add seqNPerm
BookWood7th Apr 24, 2024
50956de
add seqNPerm to DefinedSymbolsHandler
BookWood7th Apr 24, 2024
2078118
add seqSwap and seqRemove
BookWood7th Apr 24, 2024
2303777
ensure try0 is not waited on indefinitely
BookWood7th Apr 25, 2024
64e64c8
fix seqRemove
BookWood7th Apr 25, 2024
50ad2e8
seqIndexOf undefined case
BookWood7th Apr 25, 2024
7e7b400
replace seqIndexOf with nonexhaustive function
BookWood7th Apr 26, 2024
e5e73b4
add back interpretations
BookWood7th Apr 26, 2024
a9614a7
add disjoint types axioms and assumptions
BookWood7th May 3, 2024
59dbc6e
fix indent
BookWood7th May 3, 2024
af496ef
add disjointModNull for java types
BookWood7th May 4, 2024
b348d44
fix java type disjoint
BookWood7th May 4, 2024
645ed2a
change the disjointModNull assumptions for java types to be easier to…
BookWood7th May 4, 2024
ae284ef
give names to assumptions disjoint types
BookWood7th May 4, 2024
b08a696
change disjointModNull
BookWood7th May 6, 2024
03de9d9
set KeY strategy before preparation
BookWood7th May 6, 2024
e4dd0af
ensure timeouts sent by sledgehammer are recognized as timeouts
BookWood7th May 7, 2024
005be5d
listener change to avoid mislabelling state
BookWood7th May 7, 2024
26a62d2
remove strategy settings before prep, caused prep to stop prematurely
BookWood7th May 7, 2024
0878b35
fix goalNr in csv
BookWood7th May 7, 2024
dfe148d
change input file format to save parent directory name
BookWood7th May 7, 2024
aaa067d
wrong order of setting goalNr
BookWood7th May 7, 2024
e161552
add back strategy with right timeouts before prep
BookWood7th May 7, 2024
514afd4
timeout recognition problem
BookWood7th May 7, 2024
caa8c12
change distinct types to include standard types
BookWood7th May 7, 2024
2cdc2ed
unfolded disjoint Types assumptions
BookWood7th May 7, 2024
cef85d3
fix distinctSortsAssumptions
BookWood7th May 7, 2024
2d35493
flipflop strategy for prep
BookWood7th May 7, 2024
aa4caf2
fix disjoint types assumptions
BookWood7th May 7, 2024
2dbba8f
fix disjoint types assumptions name collision by binding to quantifier
BookWood7th May 7, 2024
bb7b93c
run instead of start shutdownResources
BookWood7th May 7, 2024
68c592e
revert new disjoint type changes. Assumptions overwhelmed sledgehammer
BookWood7th May 8, 2024
973df0f
remove the disjoint types as they did not help
BookWood7th May 8, 2024
ac67336
Merge branch 'refs/heads/isabelleTranslation'
BookWood7th Jul 4, 2024
ece94de
remove evaluation artifacts
BookWood7th Jul 4, 2024
443a7ab
renamed translation package
BookWood7th Jul 4, 2024
0c6861f
Refactored Handler classes to use the new ncore package
BookWood7th Jul 17, 2024
51d85cd
Major Launcher reworks and first version of UI (nonfunctional)
BookWood7th Aug 21, 2024
fee0baf
Further Launcher Structure reworks and adding TranslateAllAction
BookWood7th Aug 21, 2024
46b2f28
Update scala-isabelle version
BookWood7th Sep 4, 2024
311aafe
Better naming in Isabelle dialog
BookWood7th Sep 4, 2024
a3cba4a
Remove unsuitable start method
BookWood7th Sep 4, 2024
4014b57
Let Launcher write back files, no need for double writing, add interf…
BookWood7th Sep 4, 2024
d211ae5
IsabelleResourceController now uses ThreadPool for instance creation …
BookWood7th Sep 4, 2024
74f3f18
Allow IsabelleLauncher to be shutdown
BookWood7th Sep 4, 2024
5f99dc0
Implement stop button in Isabelle dialog
BookWood7th Sep 4, 2024
9aaa6ac
Make final fields final in IsabelleResourceController
BookWood7th Sep 4, 2024
fda17ae
first version of reporting solver status in dialog
BookWood7th Sep 4, 2024
861a3cd
report result of solvers instead of simply state
BookWood7th Sep 4, 2024
c30fbc5
tracking down some uncaught exceptions when interrupting Isabelle sol…
BookWood7th Sep 4, 2024
5b797f3
Change interrupt behaviour for Isabelle solvers
BookWood7th Sep 5, 2024
061c43b
rename package
BookWood7th Sep 19, 2024
34fef8f
add new IsabelleResult to replace SledgehammerResult prototype
BookWood7th Sep 22, 2024
74b631f
replacing SledgehammerResult
BookWood7th Sep 22, 2024
a2f6a87
fix running additional solvers after user interruptions
BookWood7th Sep 23, 2024
83008bc
notify listener when launcher finishes work
BookWood7th Sep 24, 2024
2de6895
discard button functionality
BookWood7th Sep 24, 2024
5d800ec
show solver progress in dialog, remove bugs in dialog, remove info bu…
BookWood7th Sep 24, 2024
3038ce1
separate IsabelleProblem from solvers, remove result
BookWood7th Sep 24, 2024
3a784bb
add prototypical apply action for dialog that does not require change…
BookWood7th Sep 24, 2024
a7f8af2
make solvers callable. Add timeout settings
BookWood7th Oct 8, 2024
27f5083
package refactoring
BookWood7th Oct 8, 2024
d16bdd6
fix progress bars
BookWood7th Oct 10, 2024
c1b990e
major documentation and spotless compliance push
BookWood7th Oct 11, 2024
f51cf41
preparing to handle partially translatable proofs
BookWood7th Oct 17, 2024
09c70e9
fix interrupts during preparations causing dialog to freeze
BookWood7th Oct 20, 2024
12d129f
now opens launcher when some problems are untranslatable instead of o…
BookWood7th Oct 20, 2024
6a4df92
changed prefix to postfix to avoid isabelle errors for UninterpretedS…
BookWood7th Oct 21, 2024
edac00d
add information buttons to display solver input, output and exception…
BookWood7th Oct 22, 2024
3bdb527
add AbstractExternalSolverRuleApp to allow other external solvers to …
BookWood7th Oct 23, 2024
48cfb76
Merge branch 'KeYMainBranch' into isabelleTranslation
BookWood7th Oct 23, 2024
6cccf8e
resolve differences to main in .gitlab-ci.yml
BookWood7th Oct 23, 2024
08a518d
Merge branch 'ExternalSolverRuleApp' into isabelleTranslation
BookWood7th Oct 23, 2024
b6d9b73
add custom IsabelleRuleApp to close goals
BookWood7th Oct 23, 2024
ee123ff
applied spotless
BookWood7th Oct 23, 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
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ before_script:
- export SONAR_SCANNER_OPTS="-Xmx8G"

stages:
- primary
- secondary
- ternary
- deploy
- primary
- secondary
- ternary
- deploy

compile:classes:
stage: primary
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ subprojects {
// specific delimiter: normally just 'package', but spotless crashes for files in default package
// (see https://github.com/diffplug/spotless/issues/30), therefore 'import' is needed. '//' is for files
// with completely commented out code (which would probably better just be removed in future).
if(project.name == 'recoder') {
if (project.name == 'recoder') {
licenseHeaderFile("$rootDir/gradle/header-recoder", '(package|import|//)')
}else {
} else {
licenseHeaderFile("$rootDir/gradle/header", '(package|import|//)')
}
}
Expand Down
3 changes: 1 addition & 2 deletions key.core/src/main/java/de/uka/ilkd/key/proof/Goal.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import de.uka.ilkd.key.rule.*;
import de.uka.ilkd.key.rule.inst.SVInstantiations;
import de.uka.ilkd.key.rule.merge.MergeRule;
import de.uka.ilkd.key.smt.SMTRuleApp;
import de.uka.ilkd.key.strategy.AutomatedRuleApplicationManager;
import de.uka.ilkd.key.strategy.QueueRuleApplicationManager;
import de.uka.ilkd.key.strategy.Strategy;
Expand Down Expand Up @@ -627,7 +626,7 @@ public ImmutableList<Goal> apply(final RuleApp ruleApp) {
} else {
proof.replace(this, goalList);
if (ruleApp instanceof TacletApp tacletApp && tacletApp.taclet().closeGoal()
|| ruleApp instanceof SMTRuleApp) {
|| ruleApp instanceof AbstractExternalSolverRuleApp) {
// the first new goal is the one to be closed
proof.closeGoal(goalList.head());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
/* This file is part of KeY - https://key-project.org
* KeY is licensed under the GNU General Public License Version 2
* SPDX-License-Identifier: GPL-2.0-only */
package de.uka.ilkd.key.rule;

import java.util.ArrayList;
import java.util.List;

import de.uka.ilkd.key.java.Services;
import de.uka.ilkd.key.logic.*;
import de.uka.ilkd.key.proof.Goal;

import org.key_project.logic.Name;
import org.key_project.util.collection.ImmutableList;

/**
* The rule application that is used when a goal is closed by means of an external solver. So far it
* stores the rule that that has been used and a title containing some information for the user.
* <p>
* {@link de.uka.ilkd.key.smt.SMTRuleApp}
*/
public abstract class AbstractExternalSolverRuleApp extends AbstractBuiltInRuleApp {
protected final ExternalSolverRule rule;
protected final String title;
protected final String successfulSolverName;

/**
* Creates a new AbstractExternalSolverRuleApp,
*
* @param rule the ExternalSolverRule to apply
* @param pio the position in the term to apply the rule to
* @param unsatCore an unsat core consisting of the formulas that are needed to prove the goal
* (optional null)
* @param successfulSolverName the name of the solver used to find the proof
* @param title the title of this rule app
*/
protected AbstractExternalSolverRuleApp(ExternalSolverRule rule, PosInOccurrence pio,
ImmutableList<PosInOccurrence> unsatCore,
String successfulSolverName, String title) {
super(rule, pio, unsatCore);
this.rule = rule.newRule();
this.title = title;
this.successfulSolverName = successfulSolverName;
}

/**
* Gets the title of this rule application
*
* @return title of this application
*/
public String getTitle() {
return title;
}

/**
* Gets the name of the successful solver
*
* @return name of the successful solver
*/
public String getSuccessfulSolverName() {
return successfulSolverName;
}

@Override
public BuiltInRule rule() {
return rule;
}

@Override
public String displayName() {
return title;
}

/**
* Interface for the rules of external solvers
*/
public interface ExternalSolverRule extends BuiltInRule {
Name name = new Name("ExternalSolverRule");

ExternalSolverRule newRule();

AbstractExternalSolverRuleApp createApp(String successfulSolverName);

/**
* Create a new rule application with the given solver name and unsat core.
*
* @param successfulSolverName solver that produced this result
* @param unsatCore formulas required to prove the result
* @return rule application instance
*/
AbstractExternalSolverRuleApp createApp(String successfulSolverName,
ImmutableList<PosInOccurrence> unsatCore);

@Override
AbstractExternalSolverRuleApp createApp(PosInOccurrence pos, TermServices services);


@Override
default boolean isApplicable(Goal goal, PosInOccurrence pio) {
return false;
}


/**
* Create a new goal (to be closed in {@link Goal#apply(RuleApp)} directly afterwards)
* with the same sequent as the given one.
*
* @param goal the Goal on which to apply <tt>ruleApp</tt>
* @param services the Services with the necessary information about the java programs
* @param ruleApp the rule application to be executed
* @return a list with an identical goal as the given <tt>goal</tt>
*/
@Override
default ImmutableList<Goal> apply(Goal goal, Services services, RuleApp ruleApp) {
if (goal.proof().getInitConfig().getJustifInfo().getJustification(newRule()) == null) {
goal.proof().getInitConfig().registerRule(newRule(), () -> false);
}
return goal.split(1);
}

@Override
default boolean isApplicableOnSubTerms() {
return false;
}

@Override
default String displayName() {
return "ExternalSolver";
}

@Override
String toString();

@Override
default Name name() {
return name;
}

}

/**
* Sets the title (needs to create a new instance for this)
*
* @param title new title for rule app
* @return copy of this with the new title
*/
public abstract AbstractExternalSolverRuleApp setTitle(String title);

@Override
public AbstractExternalSolverRuleApp setIfInsts(ImmutableList<PosInOccurrence> ifInsts) {
setMutable(ifInsts);
return this;
}

/**
* Create a new RuleApp with the same pio (in this case, that will probably be null as the
* AbstractExternalSolver rule is applied to the complete sequent) as this one.
* Add all top level formulas of the goal
* to the RuleApp's ifInsts.
*
* @param goal the goal to instantiate the current RuleApp on
* @return a new RuleApp with the same pio and all top level formulas of the goal as ifInsts
*/
@Override
public AbstractExternalSolverRuleApp tryToInstantiate(Goal goal) {
AbstractExternalSolverRuleApp app = rule.createApp(pio, goal.proof().getServices());
Sequent seq = goal.sequent();
List<PosInOccurrence> ifInsts = new ArrayList<>();
for (SequentFormula ante : seq.antecedent()) {
ifInsts.add(new PosInOccurrence(ante, PosInTerm.getTopLevel(), true));
}
for (SequentFormula succ : seq.succedent()) {
ifInsts.add(new PosInOccurrence(succ, PosInTerm.getTopLevel(), false));
}
return app.setIfInsts(ImmutableList.fromList(ifInsts));
}

}
54 changes: 16 additions & 38 deletions key.core/src/main/java/de/uka/ilkd/key/smt/SMTRuleApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@
import de.uka.ilkd.key.java.Services;
import de.uka.ilkd.key.logic.*;
import de.uka.ilkd.key.proof.Goal;
import de.uka.ilkd.key.rule.AbstractBuiltInRuleApp;
import de.uka.ilkd.key.rule.AbstractExternalSolverRuleApp;
import de.uka.ilkd.key.rule.BuiltInRule;
import de.uka.ilkd.key.rule.RuleApp;

import org.key_project.logic.Name;
import org.key_project.util.collection.ImmutableList;

/**
* The rule application that is used when a goal is closed by means of an external solver. So far it
* The rule application that is used when a goal is closed by means of an SMT solver. So far it
* stores the rule that that has been used and a title containing some information for the user.
*/
public class SMTRuleApp extends AbstractBuiltInRuleApp {

public class SMTRuleApp extends AbstractExternalSolverRuleApp {
public static final SMTRule RULE = new SMTRule();
private final String title;
private final String successfulSolverName;

/**
* Create a new rule app without ifInsts (will be null).
Expand All @@ -37,39 +34,31 @@ public class SMTRuleApp extends AbstractBuiltInRuleApp {
this(rule, pio, null, successfulSolverName);
}

SMTRuleApp(SMTRule rule, PosInOccurrence pio, ImmutableList<PosInOccurrence> unsatCore,
SMTRuleApp(ExternalSolverRule rule, PosInOccurrence pio,
ImmutableList<PosInOccurrence> unsatCore,
String successfulSolverName) {
super(rule, pio, unsatCore);
this.title = "SMT: " + successfulSolverName;
this.successfulSolverName = successfulSolverName;
super(rule, pio, unsatCore, successfulSolverName, "SMT: " + successfulSolverName);
}

@Override
public SMTRuleApp replacePos(PosInOccurrence newPos) {
return new SMTRuleApp(RULE, newPos, ifInsts, successfulSolverName);
}

public String getTitle() {
return title;
}

public String getSuccessfulSolverName() {
return successfulSolverName;
}

@Override
public BuiltInRule rule() {
return RULE;
}

@Override
public String displayName() {
return title;
}

public static class SMTRule implements BuiltInRule {
public static class SMTRule implements ExternalSolverRule {
public static final Name name = new Name("SMTRule");

@Override
public ExternalSolverRule newRule() {
return new SMTRule();
}

@Override
public SMTRuleApp createApp(String successfulSolverName) {
return new SMTRuleApp(this, null, successfulSolverName);
}
Expand All @@ -81,6 +70,7 @@ public SMTRuleApp createApp(String successfulSolverName) {
* @param unsatCore formulas required to prove the result
* @return rule application instance
*/
@Override
public SMTRuleApp createApp(String successfulSolverName,
ImmutableList<PosInOccurrence> unsatCore) {
return new SMTRuleApp(this, null, unsatCore, successfulSolverName);
Expand All @@ -91,13 +81,6 @@ public SMTRuleApp createApp(PosInOccurrence pos, TermServices services) {
return new SMTRuleApp(this, null, "");
}


@Override
public boolean isApplicable(Goal goal, PosInOccurrence pio) {
return false;
}


/**
* Create a new goal (to be closed in {@link Goal#apply(RuleApp)} directly afterwards)
* with the same sequent as the given one.
Expand All @@ -115,16 +98,12 @@ public ImmutableList<Goal> apply(Goal goal, Services services, RuleApp ruleApp)
return goal.split(1);
}

@Override
public boolean isApplicableOnSubTerms() {
return false;
}

@Override
public String displayName() {
return "SMT";
}

@Override
public String toString() {
return displayName();
}
Expand All @@ -133,9 +112,9 @@ public String toString() {
public Name name() {
return name;
}

}

@Override
public SMTRuleApp setTitle(String title) {
return new SMTRuleApp(RULE, pio, ifInsts, title);
}
Expand Down Expand Up @@ -168,5 +147,4 @@ public SMTRuleApp tryToInstantiate(Goal goal) {
}
return app.setIfInsts(ImmutableList.fromList(ifInsts));
}

}
1 change: 1 addition & 0 deletions key.ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
runtimeOnly project(":keyext.exploration")
runtimeOnly project(":keyext.slicing")
runtimeOnly project(":keyext.proofmanagement")
runtimeOnly project(":keyext.isabelletranslation")
}

task createExamplesZip(type: Zip) {
Expand Down
7 changes: 7 additions & 0 deletions keyext.isabelletranslation/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description "Translation of Sequents to Isabelle"

dependencies {
implementation project(':key.core')
implementation project(':key.ui')
implementation("de.unruh:scala-isabelle_2.13:0.4.3-RC1")
}
Loading
Loading