src/FOLP/ex/If.ML
author wenzelm
Sun Sep 18 14:25:48 2005 +0200 (2005-09-18)
changeset 17480 fd19f77dcf60
parent 5061 f947332d5465
permissions -rw-r--r--
converted to Isar theory format;
     1 (*  Title:      FOLP/ex/If.ML
     2     ID:         $Id$
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1991  University of Cambridge
     5 *)
     6 
     7 val prems = goalw (the_context ()) [if_def]
     8     "[| !!x. x:P ==> f(x):Q; !!x. x:~P ==> g(x):R |] ==> ?p:if(P,Q,R)";
     9 by (fast_tac (FOLP_cs addIs prems) 1);
    10 val ifI = result();
    11 
    12 val major::prems = goalw (the_context ()) [if_def]
    13    "[| p:if(P,Q,R);  !!x y.[| x:P; y:Q |] ==> f(x,y):S; \
    14 \                    !!x y.[| x:~P; y:R |] ==> g(x,y):S |] ==> ?p:S";
    15 by (cut_facts_tac [major] 1);
    16 by (fast_tac (FOLP_cs addIs prems) 1);
    17 val ifE = result();
    18 
    19 
    20 Goal
    21     "?p : if(P, if(Q,A,B), if(Q,C,D)) <-> if(Q, if(P,A,C), if(P,B,D))";
    22 by (rtac iffI 1);
    23 by (etac ifE 1);
    24 by (etac ifE 1);
    25 by (rtac ifI 1);
    26 by (rtac ifI 1);
    27 
    28 choplev 0;
    29 val if_cs = FOLP_cs addSIs [ifI] addSEs[ifE];
    30 by (fast_tac if_cs 1);
    31 val if_commute = result();
    32 
    33 
    34 Goal "?p : if(if(P,Q,R), A, B) <-> if(P, if(Q,A,B), if(R,A,B))";
    35 by (fast_tac if_cs 1);
    36 val nested_ifs = result();