author | Norbert Schirmer <norbert.schirmer@web.de> |
Tue, 21 May 2019 14:37:39 +0200 | |
changeset 572 | 438703674711 |
parent 569 | f875a25aa72d |
permissions | -rw-r--r-- |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
theory Oracle |
346
0fea8b7a14a1
tuned the ML-output mechanism; tuned slightly the text
Christian Urban <urbanc@in.tum.de>
parents:
211
diff
changeset
|
2 |
imports "../Appendix" |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
5 |
section \<open>Writing an Oracle (TBD)\label{rec:oracle}\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
6 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
7 |
text \<open> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
{\bf Problem:} |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
9 |
You want to use a fast, new decision procedure not based one Isabelle's |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
10 |
tactics, and you do not care whether it is sound. |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
11 |
\smallskip |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
12 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
13 |
{\bf Solution:} Isabelle provides the oracle mechanisms to bypass the |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
14 |
inference kernel. Note that theorems proven by an oracle carry a special |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
15 |
mark to inform the user of their potential incorrectness. |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
16 |
\smallskip |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
17 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
18 |
\begin{readmore} |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
19 |
A short introduction to oracles can be found in [isar-ref: no suitable label |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
20 |
for section 3.11]. A simple example, which we will slightly extend here, |
457 | 21 |
is given in @{ML_file "HOL/ex/Iff_Oracle.thy"}. The raw interface for adding |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
22 |
oracles is @{ML add_oracle in Thm} in @{ML_file "Pure/thm.ML"}. |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
23 |
\end{readmore} |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
24 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
25 |
For our explanation here, we restrict ourselves to decide propositional |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
26 |
formulae which consist only of equivalences between propositional variables, |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
27 |
i.e. we want to decide whether @{term "P = (Q = P) = Q"} is a tautology. |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
28 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
29 |
Assume, that we have a decision procedure for such formulae, implemented |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
30 |
in ML. Since we do not care how it works, we will use it here as an |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
31 |
``external solver'': |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
32 |
\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
33 |
|
538
e9fd5eff62c1
removed "use" for "ML_file"
Christian Urban <urbanc@in.tum.de>
parents:
535
diff
changeset
|
34 |
ML_file "external_solver.ML" |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
35 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
36 |
text \<open> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
37 |
We do, however, know that the solver provides a function |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
38 |
@{ML IffSolver.decide}. |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
39 |
It takes a string representation of a formula and returns either |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
40 |
@{ML true} if the formula is a tautology or |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
41 |
@{ML false} otherwise. The input syntax is specified as follows: |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
42 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
43 |
formula $::=$ atom $\mid$ \verb|(| formula \verb|<=>| formula \verb|)| |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
44 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
and all token are separated by at least one space. |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
46 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
47 |
(FIXME: is there a better way for describing the syntax?) |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
48 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
49 |
We will proceed in the following way. We start by translating a HOL formula |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
50 |
into the string representation expected by the solver. The solver's result |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
51 |
is then used to build an oracle, which we will subsequently use as a core |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
52 |
for an Isar method to be able to apply the oracle in proving theorems. |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
53 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
54 |
Let us start with the translation function from Isabelle propositions into |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
55 |
the solver's string representation. To increase efficiency while building |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
56 |
the string, we use functions from the \<open>Buffer\<close> module. |
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
57 |
\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
58 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
59 |
ML %grayML\<open>fun translate t = |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
60 |
let |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
61 |
fun trans t = |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
62 |
(case t of |
562
daf404920ab9
Accomodate to Isabelle 2018
Norbert Schirmer <norbert.schirmer@web.de>
parents:
538
diff
changeset
|
63 |
@{term "(=) :: bool \<Rightarrow> bool \<Rightarrow> bool"} $ t $ u => |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
64 |
Buffer.add " (" #> |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
65 |
trans t #> |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
66 |
Buffer.add "<=>" #> |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
67 |
trans u #> |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
68 |
Buffer.add ") " |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
69 |
| Free (n, @{typ bool}) => |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
70 |
Buffer.add " " #> |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
71 |
Buffer.add n #> |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
72 |
Buffer.add " " |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
73 |
| _ => error "inacceptable term") |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
74 |
in Buffer.content (trans t Buffer.empty) end\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
75 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
76 |
text \<open> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
77 |
Here is the string representation of the term @{term "p = (q = p)"}: |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
78 |
|
569
f875a25aa72d
prefer cartouches over " in ML antiquotations
Norbert Schirmer <norbert.schirmer@web.de>
parents:
567
diff
changeset
|
79 |
@{ML_matchresult \<open>translate @{term "p = (q = p)"}\<close> |
f875a25aa72d
prefer cartouches over " in ML antiquotations
Norbert Schirmer <norbert.schirmer@web.de>
parents:
567
diff
changeset
|
80 |
\<open>" ( p <=> ( q <=> p ) ) "\<close>} |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
81 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
82 |
Let us check, what the solver returns when given a tautology: |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
83 |
|
569
f875a25aa72d
prefer cartouches over " in ML antiquotations
Norbert Schirmer <norbert.schirmer@web.de>
parents:
567
diff
changeset
|
84 |
@{ML_matchresult \<open>IffSolver.decide (translate @{term "p = (q = p) = q"})\<close> |
f875a25aa72d
prefer cartouches over " in ML antiquotations
Norbert Schirmer <norbert.schirmer@web.de>
parents:
567
diff
changeset
|
85 |
\<open>true\<close>} |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
86 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
87 |
And here is what it returns for a formula which is not valid: |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
88 |
|
569
f875a25aa72d
prefer cartouches over " in ML antiquotations
Norbert Schirmer <norbert.schirmer@web.de>
parents:
567
diff
changeset
|
89 |
@{ML_matchresult \<open>IffSolver.decide (translate @{term "p = (q = p)"})\<close> |
f875a25aa72d
prefer cartouches over " in ML antiquotations
Norbert Schirmer <norbert.schirmer@web.de>
parents:
567
diff
changeset
|
90 |
\<open>false\<close>} |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
91 |
\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
92 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
93 |
text \<open> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
94 |
Now, we combine these functions into an oracle. In general, an oracle may |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
95 |
be given any input, but it has to return a certified proposition (a |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
96 |
special term which is type-checked), out of which Isabelle's inference |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
97 |
kernel ``magically'' makes a theorem. |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
98 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
99 |
Here, we take the proposition to be show as input. Note that we have |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
100 |
to first extract the term which is then passed to the translation and |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
101 |
decision procedure. If the solver finds this term to be valid, we return |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
102 |
the given proposition unchanged to be turned then into a theorem: |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
103 |
\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
104 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
105 |
oracle iff_oracle = \<open>fn ct => |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
106 |
if IffSolver.decide (translate (HOLogic.dest_Trueprop (Thm.term_of ct))) |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
107 |
then ct |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
108 |
else error "Proof failed."\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
109 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
110 |
text \<open> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
111 |
Here is what we get when applying the oracle: |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
112 |
|
572
438703674711
prefer more result checking in ML antiquotations
Norbert Schirmer <norbert.schirmer@web.de>
parents:
569
diff
changeset
|
113 |
@{ML_response \<open>iff_oracle @{cprop "p = (p::bool)"}\<close> \<open>p = p\<close>} |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
114 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
115 |
(FIXME: is there a better way to present the theorem?) |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
116 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
117 |
To be able to use our oracle for Isar proofs, we wrap it into a tactic: |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
118 |
\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
119 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
120 |
ML %grayML\<open>fun iff_oracle_tac ctxt = |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
121 |
CSUBGOAL (fn (goal, i) => |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
122 |
(case try iff_oracle goal of |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
123 |
NONE => no_tac |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
124 |
| SOME thm => resolve_tac ctxt [thm] i))\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
125 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
126 |
text \<open> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
127 |
and create a new method solely based on this tactic: |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
128 |
\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
129 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
130 |
method_setup iff_oracle = \<open> |
562
daf404920ab9
Accomodate to Isabelle 2018
Norbert Schirmer <norbert.schirmer@web.de>
parents:
538
diff
changeset
|
131 |
Scan.succeed (fn ctxt => (Method.SIMPLE_METHOD' (iff_oracle_tac ctxt))) |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
132 |
\<close> "Oracle-based decision procedure for chains of equivalences" |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
133 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
134 |
text \<open> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
135 |
Finally, we can test our oracle to prove some theorems: |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
136 |
\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
137 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
138 |
lemma "p = (p::bool)" |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
139 |
by iff_oracle |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
140 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
141 |
lemma "p = (q = p) = q" |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
142 |
by iff_oracle |
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
143 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
144 |
|
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
145 |
text \<open> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
146 |
(FIXME: say something about what the proof of the oracle is ... what do you mean?) |
565
cecd7a941885
isabelle update_cartouches -t
Norbert Schirmer <norbert.schirmer@web.de>
parents:
562
diff
changeset
|
147 |
\<close> |
120
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
148 |
|
c39f83d8daeb
some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
149 |
|
457 | 150 |
end |