src/FOL/ex/IffOracle.thy
changeset 3817 f20f193d42b4
parent 1537 3f51f0945a3e
child 16063 7dd4eb2c8055
--- a/src/FOL/ex/IffOracle.thy	Thu Oct 09 14:56:52 1997 +0200
+++ b/src/FOL/ex/IffOracle.thy	Thu Oct 09 14:59:36 1997 +0200
@@ -1,4 +1,4 @@
-(*  Title:      FOL/ex/IffOracle
+(*  Title:      FOL/ex/IffOracle.thy
     ID:         $Id$
     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     Copyright   1996  University of Cambridge
@@ -6,6 +6,38 @@
 Example of how to declare an oracle
 *)
 
-IffOracle = "declIffOracle" + FOL +
-oracle mk_iff_oracle
+IffOracle = FOL +
+
+oracle
+  iff = mk_iff_oracle
+
 end
+
+
+ML
+
+local
+
+(* internal syntactic declarations *)
+
+val oT = Type("o",[]);
+
+val iff = Const("op <->", [oT,oT]--->oT);
+
+fun mk_iff 1 = Free("P", oT)
+  | mk_iff n = iff $ Free("P", oT) $ mk_iff (n-1);
+
+val Trueprop = Const("Trueprop",oT-->propT);
+
+in
+
+(*new exception constructor for passing arguments to the oracle*)
+exception IffOracleExn of int;
+
+(*oracle makes tautologies of the form "P <-> P <-> P <-> P"*)
+fun mk_iff_oracle (sign, IffOracleExn n) =
+  if n > 0 andalso n mod 2 = 0
+  then Trueprop $ mk_iff n
+  else raise IffOracleExn n;
+
+end;