src/HOL/Tools/SMT/z3_proof_literals.ML
changeset 38795 848be46708dc
parent 36898 8e55aa1306c5
child 38864 4abe644fcea5
equal deleted inserted replaced
38794:2d638e963357 38795:848be46708dc
    60 (** properties and term operations **)
    60 (** properties and term operations **)
    61 
    61 
    62 val is_neg = (fn @{term Not} $ _ => true | _ => false)
    62 val is_neg = (fn @{term Not} $ _ => true | _ => false)
    63 fun is_neg' f = (fn @{term Not} $ t => f t | _ => false)
    63 fun is_neg' f = (fn @{term Not} $ t => f t | _ => false)
    64 val is_dneg = is_neg' is_neg
    64 val is_dneg = is_neg' is_neg
    65 val is_conj = (fn @{term "op &"} $ _ $ _ => true | _ => false)
    65 val is_conj = (fn @{term HOL.conj} $ _ $ _ => true | _ => false)
    66 val is_disj = (fn @{term "op |"} $ _ $ _ => true | _ => false)
    66 val is_disj = (fn @{term HOL.disj} $ _ $ _ => true | _ => false)
    67 
    67 
    68 fun dest_disj_term' f = (fn
    68 fun dest_disj_term' f = (fn
    69     @{term Not} $ (@{term "op |"} $ t $ u) => SOME (f t, f u)
    69     @{term Not} $ (@{term HOL.disj} $ t $ u) => SOME (f t, f u)
    70   | _ => NONE)
    70   | _ => NONE)
    71 
    71 
    72 val dest_conj_term = (fn @{term "op &"} $ t $ u => SOME (t, u) | _ => NONE)
    72 val dest_conj_term = (fn @{term HOL.conj} $ t $ u => SOME (t, u) | _ => NONE)
    73 val dest_disj_term =
    73 val dest_disj_term =
    74   dest_disj_term' (fn @{term Not} $ t => t | t => @{term Not} $ t)
    74   dest_disj_term' (fn @{term Not} $ t => t | t => @{term Not} $ t)
    75 
    75 
    76 fun exists_lit is_conj P =
    76 fun exists_lit is_conj P =
    77   let
    77   let
   200   fun comp_disj ((false, thm1), (false, thm2)) = comp2 disj1 thm1 thm2
   200   fun comp_disj ((false, thm1), (false, thm2)) = comp2 disj1 thm1 thm2
   201     | comp_disj ((false, thm1), (true, thm2)) = comp2 disj2 thm1 thm2
   201     | comp_disj ((false, thm1), (true, thm2)) = comp2 disj2 thm1 thm2
   202     | comp_disj ((true, thm1), (false, thm2)) = comp2 disj3 thm1 thm2
   202     | comp_disj ((true, thm1), (false, thm2)) = comp2 disj3 thm1 thm2
   203     | comp_disj ((true, thm1), (true, thm2)) = comp2 disj4 thm1 thm2
   203     | comp_disj ((true, thm1), (true, thm2)) = comp2 disj4 thm1 thm2
   204 
   204 
   205   fun dest_conj (@{term "op &"} $ t $ u) = ((false, t), (false, u))
   205   fun dest_conj (@{term HOL.conj} $ t $ u) = ((false, t), (false, u))
   206     | dest_conj t = raise TERM ("dest_conj", [t])
   206     | dest_conj t = raise TERM ("dest_conj", [t])
   207 
   207 
   208   val neg = (fn @{term Not} $ t => (true, t) | t => (false, @{term Not} $ t))
   208   val neg = (fn @{term Not} $ t => (true, t) | t => (false, @{term Not} $ t))
   209   fun dest_disj (@{term Not} $ (@{term "op |"} $ t $ u)) = (neg t, neg u)
   209   fun dest_disj (@{term Not} $ (@{term HOL.disj} $ t $ u)) = (neg t, neg u)
   210     | dest_disj t = raise TERM ("dest_disj", [t])
   210     | dest_disj t = raise TERM ("dest_disj", [t])
   211 
   211 
   212   val dnegE = T.precompose (single o d2 o d1) @{thm notnotD}
   212   val dnegE = T.precompose (single o d2 o d1) @{thm notnotD}
   213   val dnegI = T.precompose (single o d1) @{lemma "P ==> ~~P" by fast}
   213   val dnegI = T.precompose (single o d1) @{lemma "P ==> ~~P" by fast}
   214   fun as_dneg f t = f (@{term Not} $ (@{term Not} $ t))
   214   fun as_dneg f t = f (@{term Not} $ (@{term Not} $ t))