176 and do_term_or_formula ext_arg T = |
176 and do_term_or_formula ext_arg T = |
177 if T = HOLogic.boolT then do_formula else do_term ext_arg |
177 if T = HOLogic.boolT then do_formula else do_term ext_arg |
178 and do_formula t = |
178 and do_formula t = |
179 (case t of |
179 (case t of |
180 Const (\<^const_name>\<open>Pure.all\<close>, _) $ Abs (_, _, t') => do_formula t' |
180 Const (\<^const_name>\<open>Pure.all\<close>, _) $ Abs (_, _, t') => do_formula t' |
181 | \<^const>\<open>Pure.imp\<close> $ t1 $ t2 => do_formula t1 #> do_formula t2 |
181 | \<^Const_>\<open>Pure.imp for t1 t2\<close> => do_formula t1 #> do_formula t2 |
182 | Const (\<^const_name>\<open>Pure.eq\<close>, Type (_, [T, _])) $ t1 $ t2 => |
182 | Const (\<^const_name>\<open>Pure.eq\<close>, Type (_, [T, _])) $ t1 $ t2 => |
183 do_term_or_formula false T t1 #> do_term_or_formula true T t2 |
183 do_term_or_formula false T t1 #> do_term_or_formula true T t2 |
184 | \<^const>\<open>Trueprop\<close> $ t1 => do_formula t1 |
184 | \<^Const_>\<open>Trueprop for t1\<close> => do_formula t1 |
185 | \<^const>\<open>False\<close> => I |
185 | \<^Const_>\<open>False\<close> => I |
186 | \<^const>\<open>True\<close> => I |
186 | \<^Const_>\<open>True\<close> => I |
187 | \<^const>\<open>Not\<close> $ t1 => do_formula t1 |
187 | \<^Const_>\<open>Not for t1\<close> => do_formula t1 |
188 | Const (\<^const_name>\<open>All\<close>, _) $ Abs (_, _, t') => do_formula t' |
188 | Const (\<^const_name>\<open>All\<close>, _) $ Abs (_, _, t') => do_formula t' |
189 | Const (\<^const_name>\<open>Ex\<close>, _) $ Abs (_, _, t') => do_formula t' |
189 | Const (\<^const_name>\<open>Ex\<close>, _) $ Abs (_, _, t') => do_formula t' |
190 | \<^const>\<open>HOL.conj\<close> $ t1 $ t2 => do_formula t1 #> do_formula t2 |
190 | \<^Const_>\<open>conj for t1 t2\<close> => do_formula t1 #> do_formula t2 |
191 | \<^const>\<open>HOL.disj\<close> $ t1 $ t2 => do_formula t1 #> do_formula t2 |
191 | \<^Const_>\<open>disj for t1 t2\<close> => do_formula t1 #> do_formula t2 |
192 | \<^const>\<open>HOL.implies\<close> $ t1 $ t2 => do_formula t1 #> do_formula t2 |
192 | \<^Const_>\<open>implies for t1 t2\<close> => do_formula t1 #> do_formula t2 |
193 | Const (\<^const_name>\<open>HOL.eq\<close>, Type (_, [T, _])) $ t1 $ t2 => |
193 | Const (\<^const_name>\<open>HOL.eq\<close>, Type (_, [T, _])) $ t1 $ t2 => |
194 do_term_or_formula false T t1 #> do_term_or_formula true T t2 |
194 do_term_or_formula false T t1 #> do_term_or_formula true T t2 |
195 | Const (\<^const_name>\<open>If\<close>, Type (_, [_, Type (_, [T, _])])) $ t1 $ t2 $ t3 => |
195 | Const (\<^const_name>\<open>If\<close>, Type (_, [_, Type (_, [T, _])])) $ t1 $ t2 $ t3 => |
196 do_formula t1 #> fold (do_term_or_formula false T) [t2, t3] |
196 do_formula t1 #> fold (do_term_or_formula false T) [t2, t3] |
197 | Const (\<^const_name>\<open>Ex1\<close>, _) $ Abs (_, _, t') => do_formula t' |
197 | Const (\<^const_name>\<open>Ex1\<close>, _) $ Abs (_, _, t') => do_formula t' |