src/HOL/Matrix/conv.ML
author berghofe
Fri, 10 Dec 2004 16:47:15 +0100
changeset 15393 2e6a9146caca
parent 15178 5f621aa35c25
permissions -rw-r--r--
Realizer for exE now uses let instead of case.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15178
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
     1
exception Fail_conv;
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
     2
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
     3
fun orelsec conv1 conv2 ct = conv1 ct handle Fail_conv => conv2 ct
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
     4
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
     5
val allc = Thm.reflexive
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
     6
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
     7
fun thenc conv1 conv2 ct = 
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
     8
    let 
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
     9
	fun rhs_of t = snd (Thm.dest_comb (strip_imp_concl (cprop_of t)))
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    10
	    
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    11
	val eq = conv1 ct
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    12
    in
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    13
	Thm.transitive eq (conv2 (rhs_of eq))
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    14
    end
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    15
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    16
fun subc conv ct = 
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    17
    case term_of ct of
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    18
	_ $ _ => 
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    19
	let 
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    20
	    val (ct1, ct2) = Thm.dest_comb ct
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    21
	in
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    22
	    Thm.combination (conv ct1) (conv ct2)
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    23
	end
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    24
      | _ => allc ct
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    25
5f621aa35c25 Matrix theory, linear programming
obua
parents:
diff changeset
    26
fun botc conv ct = thenc (subc (botc conv)) (orelsec conv allc) ct