Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
119
Issues
119
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
be01c33b
Commit
be01c33b
authored
Jun 22, 2011
by
MARCHE Claude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no need for sqlite3 anymore for IDE
experimental distance of terms dropped
parent
05239c19
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
768 additions
and
16 deletions
+768
-16
configure.in
configure.in
+16
-16
examples/power/power.mlw_Power_Power_sum_1.v
examples/power/power.mlw_Power_Power_sum_1.v
+39
-0
examples/programs/euler001/euler001.mlw_SumMultiple_Closed_formula_1.v
...rams/euler001/euler001.mlw_SumMultiple_Closed_formula_1.v
+88
-0
examples/programs/euler001/euler001.mlw_SumMultiple_Closed_formula_2.v
...rams/euler001/euler001.mlw_SumMultiple_Closed_formula_2.v
+105
-0
examples/programs/euler001/euler001.mlw_SumMultiple_Closed_formula_n_1_1.v
.../euler001/euler001.mlw_SumMultiple_Closed_formula_n_1_1.v
+80
-0
examples/programs/euler002/euler002.mlw_FibOnlyEven_fib_even_1.v
...s/programs/euler002/euler002.mlw_FibOnlyEven_fib_even_1.v
+73
-0
src/core/term.ml
src/core/term.ml
+26
-0
src/ide/session.ml
src/ide/session.ml
+66
-0
src/ide/termcode.ml
src/ide/termcode.ml
+168
-0
src/ide/termcode.mli
src/ide/termcode.mli
+4
-0
theories/int/int.why_NumOfParam_Num_of_non_negative_1.v
theories/int/int.why_NumOfParam_Num_of_non_negative_1.v
+103
-0
No files found.
configure.in
View file @
be01c33b
...
...
@@ -320,22 +320,22 @@ if test "$enable_ide" = yes ; then
fi
fi
# checking for sqlite3
if test "$enable_ide" = yes ; then
if test "$USEOCAMLFIND" = yes; then
SQLITE3LIB=$(ocamlfind query sqlite3)
fi
if test -n "$SQLITE3LIB";then
echo "ocamlfind found sqlite3 in $SQLITE3LIB"
else
SQLITE3LIB="+sqlite3"
AC_CHECK_FILE($OCAMLLIB/sqlite3/sqlite3.cma,,enable_ide=no)
if test "$enable_ide" = no; then
AC_MSG_WARN(Lib sqlite3 not found, IDE disabled.)
reason_ide=" (sqlite3 not found)"
fi
fi
fi
dnl
# checking for sqlite3
dnl
if test "$enable_ide" = yes ; then
dnl
if test "$USEOCAMLFIND" = yes; then
dnl
SQLITE3LIB=$(ocamlfind query sqlite3)
dnl
fi
dnl
if test -n "$SQLITE3LIB";then
dnl
echo "ocamlfind found sqlite3 in $SQLITE3LIB"
dnl
else
dnl
SQLITE3LIB="+sqlite3"
dnl
AC_CHECK_FILE($OCAMLLIB/sqlite3/sqlite3.cma,,enable_ide=no)
dnl
if test "$enable_ide" = no; then
dnl
AC_MSG_WARN(Lib sqlite3 not found, IDE disabled.)
dnl
reason_ide=" (sqlite3 not found)"
dnl
fi
dnl
fi
dnl
fi
# checking for sqlite3
if test "$enable_bench" = yes ; then
...
...
examples/power/power.mlw_Power_Power_sum_1.v
0 → 100644
View file @
be01c33b
(
*
This
file
is
generated
by
Why3
'
s
Coq
driver
*
)
(
*
Beware
!
Only
edit
allowed
sections
below
*
)
Require
Import
ZArith
.
Require
Import
Rbase
.
Definition
unit
:=
unit
.
Parameter
ignore
:
forall
(
a
:
Type
),
a
->
unit
.
Implicit
Arguments
ignore
.
Parameter
label_
:
Type
.
Parameter
at1
:
forall
(
a
:
Type
),
a
->
label_
->
a
.
Implicit
Arguments
at1
.
Parameter
old
:
forall
(
a
:
Type
),
a
->
a
.
Implicit
Arguments
old
.
Parameter
power
:
Z
->
Z
->
Z
.
Axiom
Power_0
:
forall
(
x
:
Z
),
((
power
x
0
%
Z
)
=
1
%
Z
).
Axiom
Power_s
:
forall
(
x
:
Z
)
(
n
:
Z
),
(
0
%
Z
<
n
)
%
Z
->
((
power
x
n
)
=
(
x
*
(
power
x
(
n
-
1
%
Z
)
%
Z
))
%
Z
).
Axiom
Power_1
:
forall
(
x
:
Z
),
((
power
x
1
%
Z
)
=
x
).
Theorem
Power_sum
:
forall
(
x
:
Z
)
(
n
:
Z
)
(
m
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
((
0
%
Z
<=
m
)
%
Z
->
((
power
x
(
n
+
m
)
%
Z
)
=
((
power
x
n
)
*
(
power
x
m
))
%
Z
)).
(
*
YOU
MAY
EDIT
THE
PROOF
BELOW
*
)
intuition
.
Qed
.
(
*
DO
NOT
EDIT
BELOW
*
)
examples/programs/euler001/euler001.mlw_SumMultiple_Closed_formula_1.v
0 → 100644
View file @
be01c33b
(
*
Beware
!
Only
edit
allowed
sections
below
*
)
(
*
This
file
is
generated
by
Why3
'
s
Coq
driver
*
)
Require
Import
ZArith
.
Require
Import
Rbase
.
Require
Import
Zdiv
.
Parameter
ghost
:
forall
(
a
:
Type
),
Type
.
Definition
unit
:=
unit
.
Parameter
ignore
:
forall
(
a
:
Type
),
a
->
unit
.
Implicit
Arguments
ignore
.
Parameter
label_
:
Type
.
Parameter
at1
:
forall
(
a
:
Type
),
a
->
label_
->
a
.
Implicit
Arguments
at1
.
Parameter
old
:
forall
(
a
:
Type
),
a
->
a
.
Implicit
Arguments
old
.
Axiom
Abs_pos
:
forall
(
x
:
Z
),
(
0
%
Z
<=
(
Zabs
x
))
%
Z
.
Axiom
Div_mod
:
forall
(
x
:
Z
)
(
y
:
Z
),
(
~
(
y
=
0
%
Z
))
->
(
x
=
((
y
*
(
Zdiv
x
y
))
%
Z
+
(
Zmod
x
y
))
%
Z
).
Axiom
Div_bound
:
forall
(
x
:
Z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z
*
n5
)
%
Z
*
(
n5
+
1
%
Z
)
%
Z
)
%
Z
)
%
Z
-
((
15
%
Z
*
n15
)
%
Z
*
(
n15
+
1
%
Z
)
%
Z
)
%
Z
)
%
Z
2
%
Z
)
in
(
s
=
(
sum_multiple_3_5_lt
(
n
+
1
%
Z
)
%
Z
)).
(
*
YOU
MAY
EDIT
THE
PROOF
BELOW
*
)
apply
Zlt_lower_bound_ind
.
intros
n
Hind
Hpos
.
assert
(
h
:
(
n
=
0
\
/
n
>
0
)
%
Z
)
by
omega
.
destruct
h
.
(
*
case
n
=
0
*
)
subst
;
simpl
.
rewrite
Zdiv_0_l
.
replace
1
%
Z
with
(
0
+
1
)
%
Z
by
omega
.
rewrite
SumYes
;
auto
.
rewrite
SumEmpty
;
auto
.
(
*
case
n
>
0
*
)
assert
(
h
:
(
n
mod
3
=
0
\
/
n
mod
3
<>
0
)
%
Z
)
by
omega
.
destruct
h
.
(
*
case
n
mod
3
=
0
*
)
assert
(
h
:
(
n
mod
5
=
0
\
/
n
mod
5
<>
0
)
%
Z
)
by
omega
.
destruct
h
.
(
*
case
n
mod
3
=
0
and
n
mod
5
=
0
*
)
rewrite
SumYes
;
auto
.
rewrite
<-
Hind
;
auto
.
SearchAbout
Zdiv
.
rewrite
<-
(
Z_div_exact_full_2
n
3
).
assert
(
h
:
(
n
mod
5
=
0
\
/
n
mod
5
<>
0
)
%
Z
)
by
omega
.
destruct
h
.
rewrite
Zdiv0
.
Qed
.
(
*
DO
NOT
EDIT
BELOW
*
)
examples/programs/euler001/euler001.mlw_SumMultiple_Closed_formula_2.v
0 → 100644
View file @
be01c33b
(
*
Beware
!
Only
edit
allowed
sections
below
*
)
(
*
This
file
is
generated
by
Why3
'
s
Coq
driver
*
)
Require
Import
ZArith
.
Require
Import
Rbase
.
Require
Import
Zdiv
.
Parameter
ghost
:
forall
(
a
:
Type
),
Type
.
Definition
unit
:=
unit
.
Parameter
ignore
:
forall
(
a
:
Type
),
a
->
unit
.
Implicit
Arguments
ignore
.
Parameter
label_
:
Type
.
Parameter
at1
:
forall
(
a
:
Type
),
a
->
label_
->
a
.
Implicit
Arguments
at1
.
Parameter
old
:
forall
(
a
:
Type
),
a
->
a
.
Implicit
Arguments
old
.
Axiom
Abs_pos
:
forall
(
x
:
Z
),
(
0
%
Z
<=
(
Zabs
x
))
%
Z
.
Axiom
Div_mod
:
forall
(
x
:
Z
)
(
y
:
Z
),
(
~
(
y
=
0
%
Z
))
->
(
x
=
((
y
*
(
Zdiv
x
y
))
%
Z
+
(
Zmod
x
y
))
%
Z
).
Axiom
Div_bound
:
forall
(
x
:
Z
)
(
y
:
Z
),
((
0
%
Z
<=
x
)
%
Z
/
\
(
0
%
Z
<
y
)
%
Z
)
->
((
0
%
Z
<=
(
Zdiv
x
y
))
%
Z
/
\
((
Zdiv
x
y
)
<=
x
)
%
Z
).
Axiom
Mod_bound
:
forall
(
x
:
Z
)
(
y
:
Z
),
(
~
(
y
=
0
%
Z
))
->
((
0
%
Z
<=
(
Zmod
x
y
))
%
Z
/
\
((
Zmod
x
y
)
<
(
Zabs
y
))
%
Z
).
Axiom
Mod_1
:
forall
(
x
:
Z
),
((
Zmod
x
1
%
Z
)
=
0
%
Z
).
Axiom
Div_1
:
forall
(
x
:
Z
),
((
Zdiv
x
1
%
Z
)
=
x
).
Parameter
sum_multiple_3_5_lt
:
Z
->
Z
.
Axiom
SumEmpty
:
((
sum_multiple_3_5_lt
0
%
Z
)
=
0
%
Z
).
Axiom
SumNo
:
forall
(
n
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
(((
~
((
Zmod
n
3
%
Z
)
=
0
%
Z
))
/
\
~
((
Zmod
n
5
%
Z
)
=
0
%
Z
))
->
((
sum_multiple_3_5_lt
(
n
+
1
%
Z
)
%
Z
)
=
(
sum_multiple_3_5_lt
n
))).
Axiom
SumYes
:
forall
(
n
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
((((
Zmod
n
3
%
Z
)
=
0
%
Z
)
\
/
((
Z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closed_formula_n_1
:
forall
(
n
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
(((
closed_formula
n
)
=
(
sum_multiple_3_5_lt
n
))
->
(((
~
((
Zmod
n
3
%
Z
)
=
0
%
Z
))
/
\
~
((
Zmod
n
5
%
Z
)
=
0
%
Z
))
->
((
sum_multiple_3_5_lt
(
n
+
1
%
Z
)
%
Z
)
=
(
closed_formula
n
)))).
Axiom
Closed_formula_n_2
:
forall
(
n
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
(((
closed_formula
n
)
=
(
sum_multiple_3_5_lt
n
))
->
((((
Zmod
n
3
%
Z
)
=
0
%
Z
)
\
/
((
Zmod
n
5
%
Z
)
=
0
%
Z
))
->
((
sum_multiple_3_5_lt
(
n
+
1
%
Z
)
%
Z
)
=
(
closed_formula
n
)))).
Definition
p
(
n
:
Z
)
:
Prop
:=
((
sum_multiple_3_5_lt
(
n
+
1
%
Z
)
%
Z
)
=
(
closed_formula
n
)).
Axiom
Induction
:
(
forall
(
n
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
((
forall
(
k
:
Z
),
((
0
%
Z
<=
k
)
%
Z
/
\
(
k
<
n
)
%
Z
)
->
(
p
k
))
->
(
p
n
)))
->
forall
(
n
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
(
p
n
).
Parameter
bound
:
Z
.
Axiom
Induction_bound
:
(
forall
(
n
:
Z
),
((
bound
)
<=
n
)
%
Z
->
((
forall
(
k
:
Z
),
(((
bound
)
<=
k
)
%
Z
/
\
(
k
<
n
)
%
Z
)
->
(
p
k
))
->
(
p
n
)))
->
forall
(
n
:
Z
),
((
bound
)
<=
n
)
%
Z
->
(
p
n
).
Theorem
Closed_formula
:
forall
(
n
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
((
sum_multiple_3_5_lt
(
n
+
1
%
Z
)
%
Z
)
=
(
closed_formula
n
)).
(
*
YOU
MAY
EDIT
THE
PROOF
BELOW
*
)
apply
Induction
.
unfold
p
.
intros
n
Hpos
Hind
.
assert
(
h
:
(
n
=
0
\
/
0
<
n
)
%
Z
)
by
omega
.
destruct
h
.
subst
;
apply
Closed_formula_0
.
assert
(
h
:
(
Zmod
n
3
=
0
\
/
Zmod
n
5
=
0
)
Qed
.
(
*
DO
NOT
EDIT
BELOW
*
)
examples/programs/euler001/euler001.mlw_SumMultiple_Closed_formula_n_1_1.v
0 → 100644
View file @
be01c33b
(
*
Beware
!
Only
edit
allowed
sections
below
*
)
(
*
This
file
is
generated
by
Why3
'
s
Coq
driver
*
)
Require
Import
ZArith
.
Require
Import
Rbase
.
Require
Import
Zdiv
.
Parameter
ghost
:
forall
(
a
:
Type
),
Type
.
Definition
unit
:=
unit
.
Parameter
ignore
:
forall
(
a
:
Type
),
a
->
unit
.
Implicit
Arguments
ignore
.
Parameter
label_
:
Type
.
Parameter
at1
:
forall
(
a
:
Type
),
a
->
label_
->
a
.
Implicit
Arguments
at1
.
Parameter
old
:
forall
(
a
:
Type
),
a
->
a
.
Implicit
Arguments
old
.
Axiom
Abs_pos
:
forall
(
x
:
Z
),
(
0
%
Z
<=
(
Zabs
x
))
%
Z
.
Axiom
Div_mod
:
forall
(
x
:
Z
)
(
y
:
Z
),
(
~
(
y
=
0
%
Z
))
->
(
x
=
((
y
*
(
Zdiv
x
y
))
%
Z
+
(
Zmod
x
y
))
%
Z
).
Axiom
Div_bound
:
forall
(
x
:
Z
)
(
y
:
Z
),
((
0
%
Z
<=
x
)
%
Z
/
\
(
0
%
Z
<
y
)
%
Z
)
->
((
0
%
Z
<=
(
Zdiv
x
y
))
%
Z
/
\
((
Zdiv
x
y
)
<=
x
)
%
Z
).
Axiom
Mod_bound
:
forall
(
x
:
Z
)
(
y
:
Z
),
(
~
(
y
=
0
%
Z
))
->
((
0
%
Z
<=
(
Zmod
x
y
))
%
Z
/
\
((
Zmod
x
y
)
<
(
Zabs
y
))
%
Z
).
Axiom
Mod_1
:
forall
(
x
:
Z
),
((
Zmod
x
1
%
Z
)
=
0
%
Z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
*
n3
)
%
Z
*
(
n3
+
1
%
Z
)
%
Z
)
%
Z
+
((
5
%
Z
*
n5
)
%
Z
*
(
n5
+
1
%
Z
)
%
Z
)
%
Z
)
%
Z
-
((
15
%
Z
*
n15
)
%
Z
*
(
n15
+
1
%
Z
)
%
Z
)
%
Z
)
%
Z
2
%
Z
).
Axiom
mod_15
:
forall
(
n
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
(((
Zmod
n
15
%
Z
)
=
0
%
Z
)
<->
(((
Zmod
n
3
%
Z
)
=
0
%
Z
)
/
\
((
Zmod
n
5
%
Z
)
=
0
%
Z
))).
Axiom
Closed_formula_0
:
((
closed_formula
0
%
Z
)
=
(
sum_multiple_3_5_lt
0
%
Z
)).
Theorem
Closed_formula_n_1
:
forall
(
n
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
(((
closed_formula
n
)
=
(
sum_multiple_3_5_lt
n
))
->
(((
~
((
Zmod
n
3
%
Z
)
=
0
%
Z
))
/
\
~
((
Zmod
n
5
%
Z
)
=
0
%
Z
))
->
((
closed_formula
(
n
+
1
%
Z
)
%
Z
)
=
(
sum_multiple_3_5_lt
(
n
+
1
%
Z
)
%
Z
)))).
(
*
YOU
MAY
EDIT
THE
PROOF
BELOW
*
)
unfold
closed_formula
.
intros
n
Hnpos
Hind
(
H3
,
H5
).
rewrite
div_minus1_2
;
auto
with
zarith
.
Qed
.
(
*
DO
NOT
EDIT
BELOW
*
)
examples/programs/euler002/euler002.mlw_FibOnlyEven_fib_even_1.v
0 → 100644
View file @
be01c33b
(
*
Beware
!
Only
edit
allowed
sections
below
*
)
(
*
This
file
is
generated
by
Why3
'
s
Coq
driver
*
)
Require
Import
ZArith
.
Require
Import
Rbase
.
Require
Import
Zdiv
.
Parameter
ghost
:
forall
(
a
:
Type
),
Type
.
Definition
unit
:=
unit
.
Parameter
ignore
:
forall
(
a
:
Type
),
a
->
unit
.
Implicit
Arguments
ignore
.
Parameter
label_
:
Type
.
Parameter
at1
:
forall
(
a
:
Type
),
a
->
label_
->
a
.
Implicit
Arguments
at1
.
Parameter
old
:
forall
(
a
:
Type
),
a
->
a
.
Implicit
Arguments
old
.
Parameter
fib
:
Z
->
Z
.
Axiom
fib0
:
((
fib
0
%
Z
)
=
1
%
Z
).
Axiom
fib1
:
((
fib
1
%
Z
)
=
2
%
Z
).
Axiom
fibn
:
forall
(
n
:
Z
),
(
2
%
Z
<=
n
)
%
Z
->
((
fib
n
)
=
((
fib
(
n
-
1
%
Z
)
%
Z
)
+
(
fib
(
n
-
2
%
Z
)
%
Z
))
%
Z
).
Axiom
Abs_pos
:
forall
(
x
:
Z
),
(
0
%
Z
<=
(
Zabs
x
))
%
Z
.
Axiom
Div_mod
:
forall
(
x
:
Z
)
(
y
:
Z
),
(
~
(
y
=
0
%
Z
))
->
(
x
=
((
y
*
(
Zdiv
x
y
))
%
Z
+
(
Zmod
x
y
))
%
Z
).
Axiom
Div_bound
:
forall
(
x
:
Z
)
(
y
:
Z
),
((
0
%
Z
<=
x
)
%
Z
/
\
(
0
%
Z
<
y
)
%
Z
)
->
((
0
%
Z
<=
(
Zdiv
x
y
))
%
Z
/
\
((
Zdiv
x
y
)
<=
x
)
%
Z
).
Axiom
Mod_bound
:
forall
(
x
:
Z
)
(
y
:
Z
),
(
~
(
y
=
0
%
Z
))
->
((
0
%
Z
<=
(
Zmod
x
y
))
%
Z
/
\
((
Zmod
x
y
)
<
(
Zabs
y
))
%
Z
).
Axiom
Mod_1
:
forall
(
x
:
Z
),
((
Zmod
x
1
%
Z
)
=
0
%
Z
).
Axiom
Div_1
:
forall
(
x
:
Z
),
((
Zdiv
x
1
%
Z
)
=
x
).
Theorem
fib_even
:
forall
(
n
:
Z
),
(
0
%
Z
<=
n
)
%
Z
->
(((
Zmod
(
fib
n
)
2
%
Z
)
=
0
%
Z
)
<->
((
Zmod
n
3
%
Z
)
=
1
%
Z
)).
(
*
YOU
MAY
EDIT
THE
PROOF
BELOW
*
)
apply
Zlt_lower_bound_ind
.
intros
n
Hind
Hnpos
.
assert
(
h
:
(
n
=
0
\
/
n
=
1
\
/
n
>=
2
)
%
Z
)
by
omega
;
clear
Hnpos
.
destruct
h
as
[
h0
|
[
h1
|
hn
]].
subst
n
;
rewrite
fib0
;
intuition
.
subst
n
;
rewrite
fib1
;
intuition
.
rewrite
fibn
;
auto
with
zarith
.
rewrite
Zplus_mod
.
assert
(
h
:
(
0
<=
(
n
mod
3
)
<
3
)
%
Z
).
apply
Z_mod_lt
;
auto
with
zarith
.
assert
(
h
'
:
(
n
mod
3
=
0
\
/
n
mod
3
=
1
\
/
n
mod
3
=
2
)
%
Z
)
by
omega
.
clear
h
.
destruct
h
'
as
[
h0
|
[
h1
|
h2
]].
split
;
auto
with
zarith
.
SearchAbout
Zmod
.
assert
Qed
.
(
*
DO
NOT
EDIT
BELOW
*
)
src/core/term.ml
View file @
be01c33b
...
...
@@ -1253,6 +1253,32 @@ module Hterm_alpha = Hashtbl.Make (struct
let
hash
=
t_hash_alpha
end
)
(* binder-free term/formula matching *)
(* exception NoMatch *)
(* let rec t_match s t1 t2 = *)
(* if not (oty_equal t1.t_ty t2.t_ty) then raise NoMatch else *)
(* match t1.t_node, t2.t_node with *)
(* | Tconst c1, Tconst c2 when c1 = c2 -> s *)
(* | Tvar v1, _ -> *)
(* Mvs.change v1 (function *)
(* | None -> Some t2 *)
(* | Some t1 as r when t_equal t1 t2 -> r *)
(* | _ -> raise NoMatch) s *)
(* | Tapp (s1,l1), Tapp (s2,l2) when ls_equal s1 s2 -> *)
(* List.fold_left2 t_match s l1 l2 *)
(* | Tif (f1,t1,e1), Tif (f2,t2,e2) -> *)
(* t_match (t_match (t_match s f1 f2) t1 t2) e1 e2 *)
(* | Tbinop (op1,f1,g1), Tbinop (op2,f2,g2) when op1 = op2 -> *)
(* t_match (t_match s f1 f2) g1 g2 *)
(* | Tnot f1, Tnot f2 -> *)
(* t_match s f1 f2 *)
(* | Ttrue, Ttrue *)
(* | Tfalse, Tfalse -> *)
(* s *)
(* | _ -> raise NoMatch *)
(* occurrence check *)
let
rec
t_occurs
r
t
=
...
...
src/ide/session.ml
View file @
be01c33b
...
...
@@ -799,6 +799,26 @@ let reload_proof obsolete goal pid old_a =
in
!
notify_fun
(
Goal
a
.
proof_goal
)
(*
let reload_proof ~provers obsolete goal pid old_a =
try
let p = Util.Mstr.find pid provers in
let old_res = old_a.proof_state in
let obsolete = obsolete or old_a.proof_obsolete in
(* eprintf "proof_obsolete : %b@." obsolete; *)
let a =
raw_add_external_proof ~obsolete ~timelimit:old_a.timelimit
~edit:old_a.edited_as goal p old_res
in
!notify_fun (Goal a.proof_goal)
with Not_found ->
eprintf
"Warning: prover %s appears in database but is not installed.@."
pid
*)
let
rec
reload_any_goal
parent
gid
gname
sum
t
old_goal
goal_obsolete
=
let
info
=
get_explanation
gid
(
Task
.
task_goal_fmla
t
)
in
let
exp
=
match
old_goal
with
None
->
true
|
Some
g
->
g
.
goal_expanded
in
...
...
@@ -884,6 +904,52 @@ and reload_trans _goal_obsolete goal _ tr =
new_new_goals_map = [ [ (g1, h2) ; (g2, h1) ; (g3, fresh) ; ]
TODO: use the distance Term.t_dist to obtain a better match
other solution: sort in some arbitrary total order
g1 < g2 < ... <
h1 < h2 < ... <
then identical goals can be detected by a merge_like algorithm :
if merged list starts with g :
g1 < ... gk <= h1 < ... <
then g1 .. g{k-1} are new and gk associated to h1, and then
recursively merge g{k+1} ... and h2 ...
otherwise, list starts
h1 < ... hk <= g1 <= ... <
....
Another formulation :
if merged list starts with
1) g1 g2 ...
associate g1 to nothing and recursively process g2 ...
2) g1 h1 g2 ... with d(g1,h1) < d(h1,g2)
associate g1 to h1 and recursively process g2 ...
3) g1 h1 g2 ... with d(g1,h1) > d(h1,g2)
?
4) g1 h1 h2 ...
PRELIMINARY: store the shape of the conclusion of the goal in the XML
file.
*)
let
rec
associate_remaining_goals
new_goals_map
remaining
acc
=
match
new_goals_map
with
...
...
src/ide/termcode.ml
0 → 100644
View file @
be01c33b
(* distance of two terms *)
let
dist_bool
b
=
if
b
then
0
.
0
else
1
.
0
let
average
l
=
let
n
,
s
=
List
.
fold_left
(
fun
(
n
,
s
)
x
->
(
n
+
1
,
s
+.
x
))
(
0
,
0
.
0
)
l
in
float
n
*.
s
let
rec
pat_dist
p1
p2
=
if
ty_equal
p1
.
pat_ty
p2
.
pat_ty
then
match
p1
.
pat_node
,
p2
.
pat_node
with
|
Pwild
,
Pwild
|
Pvar
_
,
Pvar
_
->
0
.
0
|
Papp
(
f1
,
l1
)
,
Papp
(
f2
,
l2
)
->
if
ls_equal
f1
f2
then
0
.
5
*.
average
(
List
.
map2
pat_dist
l1
l2
)
else
1
.
0
|
Pas
(
p1
,
_
)
,
Pas
(
p2
,
_
)
->
pat_dist
p1
p2
|
Por
(
p1
,
q1
)
,
Por
(
p2
,
q2
)
->
0
.
5
*.
average
[
pat_dist
p1
p2
;
pat_dist
q1
q2
]
|
_
->
1
.
0