src/HOL/Tools/refute.ML
changeset 28524 644b62cf678f
parent 26957 e3f04fdd994d
child 29004 a5a91f387791
equal deleted inserted replaced
28523:5818d9cfb2e7 28524:644b62cf678f
   679       | Const ("Not", _)                => t
   679       | Const ("Not", _)                => t
   680       | (* redundant, since 'True' is also an IDT constructor *)
   680       | (* redundant, since 'True' is also an IDT constructor *)
   681         Const ("True", _)               => t
   681         Const ("True", _)               => t
   682       | (* redundant, since 'False' is also an IDT constructor *)
   682       | (* redundant, since 'False' is also an IDT constructor *)
   683         Const ("False", _)              => t
   683         Const ("False", _)              => t
   684       | Const ("arbitrary", _)          => t
   684       | Const (@{const_name undefined}, _)          => t
   685       | Const ("The", _)                => t
   685       | Const ("The", _)                => t
   686       | Const ("Hilbert_Choice.Eps", _) => t
   686       | Const ("Hilbert_Choice.Eps", _) => t
   687       | Const ("All", _)                => t
   687       | Const ("All", _)                => t
   688       | Const ("Ex", _)                 => t
   688       | Const ("Ex", _)                 => t
   689       | Const ("op =", _)               => t
   689       | Const ("op =", _)               => t
   854       | Const ("Not", _)                => axs
   854       | Const ("Not", _)                => axs
   855       (* redundant, since 'True' is also an IDT constructor *)
   855       (* redundant, since 'True' is also an IDT constructor *)
   856       | Const ("True", _)               => axs
   856       | Const ("True", _)               => axs
   857       (* redundant, since 'False' is also an IDT constructor *)
   857       (* redundant, since 'False' is also an IDT constructor *)
   858       | Const ("False", _)              => axs
   858       | Const ("False", _)              => axs
   859       | Const ("arbitrary", T)          => collect_type_axioms (axs, T)
   859       | Const (@{const_name undefined}, T)          => collect_type_axioms (axs, T)
   860       | Const ("The", T)                =>
   860       | Const ("The", T)                =>
   861         let
   861         let
   862           val ax = specialize_type thy ("The", T)
   862           val ax = specialize_type thy ("The", T)
   863             (lookup axioms "HOL.the_eq_trivial")
   863             (lookup axioms "HOL.the_eq_trivial")
   864         in
   864         in
  3200         SOME (foldr (fn (pair, acc) => HOLogic_insert $ pair $ acc)
  3200         SOME (foldr (fn (pair, acc) => HOLogic_insert $ pair $ acc)
  3201           HOLogic_empty_set pairs)
  3201           HOLogic_empty_set pairs)
  3202       end
  3202       end
  3203     | Type ("prop", [])      =>
  3203     | Type ("prop", [])      =>
  3204       (case index_from_interpretation intr of
  3204       (case index_from_interpretation intr of
  3205         ~1 => SOME (HOLogic.mk_Trueprop (Const ("arbitrary", HOLogic.boolT)))
  3205         ~1 => SOME (HOLogic.mk_Trueprop (Const (@{const_name undefined}, HOLogic.boolT)))
  3206       | 0  => SOME (HOLogic.mk_Trueprop HOLogic.true_const)
  3206       | 0  => SOME (HOLogic.mk_Trueprop HOLogic.true_const)
  3207       | 1  => SOME (HOLogic.mk_Trueprop HOLogic.false_const)
  3207       | 1  => SOME (HOLogic.mk_Trueprop HOLogic.false_const)
  3208       | _  => raise REFUTE ("stlc_interpreter",
  3208       | _  => raise REFUTE ("stlc_interpreter",
  3209         "illegal interpretation for a propositional value"))
  3209         "illegal interpretation for a propositional value"))
  3210     | Type _  => if index_from_interpretation intr = (~1) then
  3210     | Type _  => if index_from_interpretation intr = (~1) then
  3211         SOME (Const ("arbitrary", T))
  3211         SOME (Const (@{const_name undefined}, T))
  3212       else
  3212       else
  3213         SOME (Const (string_of_typ T ^
  3213         SOME (Const (string_of_typ T ^
  3214           string_of_int (index_from_interpretation intr), T))
  3214           string_of_int (index_from_interpretation intr), T))
  3215     | TFree _ => if index_from_interpretation intr = (~1) then
  3215     | TFree _ => if index_from_interpretation intr = (~1) then
  3216         SOME (Const ("arbitrary", T))
  3216         SOME (Const (@{const_name undefined}, T))
  3217       else
  3217       else
  3218         SOME (Const (string_of_typ T ^
  3218         SOME (Const (string_of_typ T ^
  3219           string_of_int (index_from_interpretation intr), T))
  3219           string_of_int (index_from_interpretation intr), T))
  3220     | TVar _  => if index_from_interpretation intr = (~1) then
  3220     | TVar _  => if index_from_interpretation intr = (~1) then
  3221         SOME (Const ("arbitrary", T))
  3221         SOME (Const (@{const_name undefined}, T))
  3222       else
  3222       else
  3223         SOME (Const (string_of_typ T ^
  3223         SOME (Const (string_of_typ T ^
  3224           string_of_int (index_from_interpretation intr), T))
  3224           string_of_int (index_from_interpretation intr), T))
  3225   end;
  3225   end;
  3226 
  3226 
  3289               Leaf xs => find_index (PropLogic.eval assignment) xs
  3289               Leaf xs => find_index (PropLogic.eval assignment) xs
  3290             | Node _  => raise REFUTE ("IDT_printer",
  3290             | Node _  => raise REFUTE ("IDT_printer",
  3291               "interpretation is not a leaf"))
  3291               "interpretation is not a leaf"))
  3292         in
  3292         in
  3293           if element < 0 then
  3293           if element < 0 then
  3294             SOME (Const ("arbitrary", Type (s, Ts)))
  3294             SOME (Const (@{const_name undefined}, Type (s, Ts)))
  3295           else let
  3295           else let
  3296             (* takes a datatype constructor, and if for some arguments this  *)
  3296             (* takes a datatype constructor, and if for some arguments this  *)
  3297             (* constructor generates the datatype's element that is given by *)
  3297             (* constructor generates the datatype's element that is given by *)
  3298             (* 'element', returns the constructor (as a term) as well as the *)
  3298             (* 'element', returns the constructor (as a term) as well as the *)
  3299             (* indices of the arguments                                      *)
  3299             (* indices of the arguments                                      *)