src/FOL/ex/IffOracle.ML
author paulson
Tue, 16 Jul 1996 15:49:46 +0200
changeset 1868 836950047d85
parent 1847 58ab3b74a344
child 3817 f20f193d42b4
permissions -rw-r--r--
Put in minimal simpset to avoid excessive simplification, just as in revision 1.9 of HOL/indrule.ML
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1537
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
     1
(*  Title:      FOL/ex/IffOracle
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
     2
    ID:         $Id$
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
     5
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
     6
Example of how to use an oracle
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
     7
*)
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
     8
1847
58ab3b74a344 Modified to reject certain inputs -- illustrates error handling
paulson
parents: 1537
diff changeset
     9
invoke_oracle (IffOracle.thy, sign_of IffOracle.thy, IffOracleExn 2);
1537
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
    10
invoke_oracle (IffOracle.thy, sign_of IffOracle.thy, IffOracleExn 10);
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
    11
#der(rep_thm it);
3f51f0945a3e Example of declaring oracles
paulson
parents:
diff changeset
    12
1847
58ab3b74a344 Modified to reject certain inputs -- illustrates error handling
paulson
parents: 1537
diff changeset
    13
(*These oracle calls had better fail*)
58ab3b74a344 Modified to reject certain inputs -- illustrates error handling
paulson
parents: 1537
diff changeset
    14
58ab3b74a344 Modified to reject certain inputs -- illustrates error handling
paulson
parents: 1537
diff changeset
    15
(invoke_oracle (IffOracle.thy, sign_of IffOracle.thy, IffOracleExn 5); 
58ab3b74a344 Modified to reject certain inputs -- illustrates error handling
paulson
parents: 1537
diff changeset
    16
 raise ERROR) handle IffOracleExn _ => writeln"Failed, as expected";  
58ab3b74a344 Modified to reject certain inputs -- illustrates error handling
paulson
parents: 1537
diff changeset
    17
58ab3b74a344 Modified to reject certain inputs -- illustrates error handling
paulson
parents: 1537
diff changeset
    18
(invoke_oracle (IffOracle.thy, sign_of IffOracle.thy, IffOracleExn 0); 
58ab3b74a344 Modified to reject certain inputs -- illustrates error handling
paulson
parents: 1537
diff changeset
    19
 raise ERROR) handle IffOracleExn _ => writeln"Failed, as expected";