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 |
Example of how to declare an oracle
|
|
7 |
*)
|
|
8 |
|
3817
|
9 |
IffOracle = FOL +
|
|
10 |
|
|
11 |
oracle
|
|
12 |
iff = mk_iff_oracle
|
|
13 |
|
1537
|
14 |
end
|
3817
|
15 |
|
|
16 |
|
|
17 |
ML
|
|
18 |
|
|
19 |
local
|
|
20 |
|
|
21 |
(* internal syntactic declarations *)
|
|
22 |
|
|
23 |
val oT = Type("o",[]);
|
|
24 |
|
|
25 |
val iff = Const("op <->", [oT,oT]--->oT);
|
|
26 |
|
|
27 |
fun mk_iff 1 = Free("P", oT)
|
|
28 |
| mk_iff n = iff $ Free("P", oT) $ mk_iff (n-1);
|
|
29 |
|
|
30 |
val Trueprop = Const("Trueprop",oT-->propT);
|
|
31 |
|
|
32 |
in
|
|
33 |
|
|
34 |
(*new exception constructor for passing arguments to the oracle*)
|
|
35 |
exception IffOracleExn of int;
|
|
36 |
|
|
37 |
(*oracle makes tautologies of the form "P <-> P <-> P <-> P"*)
|
|
38 |
fun mk_iff_oracle (sign, IffOracleExn n) =
|
|
39 |
if n > 0 andalso n mod 2 = 0
|
|
40 |
then Trueprop $ mk_iff n
|
|
41 |
else raise IffOracleExn n;
|
|
42 |
|
|
43 |
end;
|