3817
|
1 |
(* Title: FOL/ex/IffOracle.thy
|
1537
|
2 |
ID: $Id$
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1996 University of Cambridge
|
|
5 |
*)
|
|
6 |
|
16063
|
7 |
header{*Example of Declaring an Oracle*}
|
|
8 |
|
|
9 |
theory IffOracle = FOL:
|
3817
|
10 |
|
16063
|
11 |
text{*This oracle makes tautologies of the form "P <-> P <-> P <-> P".
|
|
12 |
The length is specified by an integer, which is checked to be even and
|
|
13 |
positive.*}
|
3817
|
14 |
|
|
15 |
ML
|
16063
|
16 |
{*
|
3817
|
17 |
local
|
|
18 |
|
|
19 |
(* internal syntactic declarations *)
|
|
20 |
|
|
21 |
val oT = Type("o",[]);
|
|
22 |
|
|
23 |
val iff = Const("op <->", [oT,oT]--->oT);
|
|
24 |
|
|
25 |
fun mk_iff 1 = Free("P", oT)
|
|
26 |
| mk_iff n = iff $ Free("P", oT) $ mk_iff (n-1);
|
|
27 |
|
|
28 |
val Trueprop = Const("Trueprop",oT-->propT);
|
|
29 |
|
|
30 |
in
|
|
31 |
|
|
32 |
(*new exception constructor for passing arguments to the oracle*)
|
|
33 |
exception IffOracleExn of int;
|
|
34 |
|
|
35 |
fun mk_iff_oracle (sign, IffOracleExn n) =
|
|
36 |
if n > 0 andalso n mod 2 = 0
|
|
37 |
then Trueprop $ mk_iff n
|
|
38 |
else raise IffOracleExn n;
|
|
39 |
|
16063
|
40 |
end
|
|
41 |
*}
|
|
42 |
|
|
43 |
oracle
|
|
44 |
iff = mk_iff_oracle
|
|
45 |
|
|
46 |
end
|
|
47 |
|
|
48 |
|