equal
deleted
inserted
replaced
1 (* Title: FOL/ex/IffOracle |
1 (* Title: FOL/ex/IffOracle.thy |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
3 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
4 Copyright 1996 University of Cambridge |
4 Copyright 1996 University of Cambridge |
5 |
5 |
6 Example of how to declare an oracle |
6 Example of how to declare an oracle |
7 *) |
7 *) |
8 |
8 |
9 IffOracle = "declIffOracle" + FOL + |
9 IffOracle = FOL + |
10 oracle mk_iff_oracle |
10 |
|
11 oracle |
|
12 iff = mk_iff_oracle |
|
13 |
11 end |
14 end |
|
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; |