Skip to content

Commit 7860741

Browse files
committed
add settings, add recursive variant
1 parent c3112b4 commit 7860741

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

BinarySearch/project.key

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
\profile "Java Profile";
2+
3+
\settings {
4+
"#Proof-Settings-Config-File
5+
#Tue Jan 09 21:12:58 CET 2024
6+
[Labels]UseOriginLabels=true
7+
[StrategyProperty]QUERYAXIOM_OPTIONS_KEY=QUERYAXIOM_OFF
8+
[SMTSettings]invariantForall=false
9+
[Strategy]ActiveStrategy=JavaCardDLStrategy
10+
[StrategyProperty]USER_TACLETS_OPTIONS_KEY1=USER_TACLETS_OFF
11+
[StrategyProperty]QUANTIFIERS_OPTIONS_KEY=QUANTIFIERS_NON_SPLITTING_WITH_PROGS
12+
[StrategyProperty]USER_TACLETS_OPTIONS_KEY2=USER_TACLETS_OFF
13+
[Choice]DefaultChoices=JavaCard-JavaCard\\:off, Strings-Strings\\:on, assertions-assertions\\:safe, bigint-bigint\\:on, floatRules-floatRules\\:strictfpOnly, initialisation-initialisation\\:disableStaticInitialisation, intRules-intRules\\:arithmeticSemanticsIgnoringOF, integerSimplificationRules-integerSimplificationRules\\:full, javaLoopTreatment-javaLoopTreatment\\:efficient, mergeGenerateIsWeakeningGoal-mergeGenerateIsWeakeningGoal\\:off, methodExpansion-methodExpansion\\:modularOnly, modelFields-modelFields\\:treatAsAxiom, moreSeqRules-moreSeqRules\\:off, permissions-permissions\\:off, programRules-programRules\\:Java, reach-reach\\:on, runtimeExceptions-runtimeExceptions\\:ban, sequences-sequences\\:on, wdChecks-wdChecks\\:off, wdOperator-wdOperator\\:L
14+
[StrategyProperty]LOOP_OPTIONS_KEY=LOOP_INVARIANT
15+
[StrategyProperty]INF_FLOW_CHECK_PROPERTY=INF_FLOW_CHECK_FALSE
16+
[SMTSettings]UseBuiltUniqueness=false
17+
[SMTSettings]explicitTypeHierarchy=false
18+
[SMTSettings]instantiateHierarchyAssumptions=true
19+
[StrategyProperty]NON_LIN_ARITH_OPTIONS_KEY=NON_LIN_ARITH_DEF_OPS
20+
[SMTSettings]SelectedTaclets=
21+
[StrategyProperty]DEP_OPTIONS_KEY=DEP_ON
22+
[StrategyProperty]AUTO_INDUCTION_OPTIONS_KEY=AUTO_INDUCTION_OFF
23+
[Strategy]MaximumNumberOfAutomaticApplications=10000
24+
[StrategyProperty]STOPMODE_OPTIONS_KEY=STOPMODE_DEFAULT
25+
[StrategyProperty]CLASS_AXIOM_OPTIONS_KEY=CLASS_AXIOM_DELAYED
26+
[SMTSettings]useConstantsForBigOrSmallIntegers=true
27+
[StrategyProperty]MPS_OPTIONS_KEY=MPS_MERGE
28+
[StrategyProperty]SYMBOLIC_EXECUTION_NON_EXECUTION_BRANCH_HIDING_OPTIONS_KEY=SYMBOLIC_EXECUTION_NON_EXECUTION_BRANCH_HIDING_OFF
29+
[Strategy]Timeout=-1
30+
[StrategyProperty]SYMBOLIC_EXECUTION_ALIAS_CHECK_OPTIONS_KEY=SYMBOLIC_EXECUTION_ALIAS_CHECK_NEVER
31+
[StrategyProperty]QUERY_NEW_OPTIONS_KEY=QUERY_OFF
32+
[SMTSettings]useUninterpretedMultiplication=true
33+
[StrategyProperty]BLOCK_OPTIONS_KEY=BLOCK_CONTRACT_INTERNAL
34+
[StrategyProperty]METHOD_OPTIONS_KEY=METHOD_CONTRACT
35+
[StrategyProperty]USER_TACLETS_OPTIONS_KEY3=USER_TACLETS_OFF
36+
[SMTSettings]maxGenericSorts=2
37+
[StrategyProperty]OSS_OPTIONS_KEY=OSS_ON
38+
[StrategyProperty]SPLITTING_OPTIONS_KEY=SPLITTING_DELAYED
39+
[SMTSettings]integersMinimum=-2147483645
40+
[StrategyProperty]VBT_PHASE=VBT_SYM_EX
41+
[SMTSettings]integersMaximum=2147483645
42+
"
43+
}
44+
45+
\javaSource "src";
46+
47+
\chooseContract

BinarySearch/prove.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
CI_TOOL=../tools/key-citool-1.6.0-mini.jar
44
KEY=../tools/key-2.13.0-exe.jar
55

6-
java -cp $KEY:$CI_TOOL de.uka.ilkd.key.CheckerKt --proof-path proofs src/
6+
java -cp $KEY:$CI_TOOL de.uka.ilkd.key.CheckerKt --proof-path proofs project.key
77

88
# project.key 2>&1 | tee prove.log

BinarySearch/src/BinSearch.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,23 @@ private int binSearch(int v) {
3131

3232
throw new RuntimeException();
3333
}
34+
35+
/*@ private normal_behavior
36+
@ requires 0 <= low <= up <= a.length;
37+
@ requires (\forall int x, y; 0 <= x < y < a.length; a[x] <= a[y]);
38+
@ ensures \result == -1 || low <= \result < up;
39+
@ ensures (\exists int idx; low <= idx < up; a[idx] == v) ?
40+
@ \result >= low && a[\result] == v : \result == -1;
41+
@ assignable \nothing;
42+
@ measured_by up - low;
43+
@*/
44+
private int binSearchR(int v, int low, int up) {
45+
if (low < up) {
46+
int mid = low + ((up - low) / 2);
47+
if (v == a[mid]) { return mid;
48+
} else if (v < a[mid]) { return binSearchR(v, low, mid);
49+
} else { return binSearchR(v, mid + 1, up); }
50+
}
51+
return -1;
52+
}
3453
}

0 commit comments

Comments
 (0)