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