| author | blanchet | 
| Mon, 23 Jul 2012 15:32:30 +0200 | |
| changeset 48442 | 3c9890c19e90 | 
| parent 47951 | 8c8a03765de7 | 
| child 50225 | f478f4ca7f19 | 
| permissions | -rw-r--r-- | 
| 47698 | 1 | (* Title: HOL/Tools/Lifting/lifting_util.ML | 
| 2 | Author: Ondrej Kuncar | |
| 3 | ||
| 4 | General-purpose functions used by the Lifting package. | |
| 5 | *) | |
| 6 | ||
| 7 | signature LIFTING_UTIL = | |
| 8 | sig | |
| 9 | val MRSL: thm list * thm -> thm | |
| 47699 | 10 | val Trueprop_conv: conv -> conv | 
| 47777 
f29e7dcd7c40
use a quot_map theorem attribute instead of the complicated map attribute
 kuncar parents: 
47699diff
changeset | 11 | val dest_Quotient: term -> term * term * term * term | 
| 47951 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 12 | |
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 13 | val quot_thm_rel: thm -> term | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 14 | val quot_thm_abs: thm -> term | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 15 | val quot_thm_rep: thm -> term | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 16 | val quot_thm_rty_qty: thm -> typ * typ | 
| 47698 | 17 | end; | 
| 18 | ||
| 19 | ||
| 20 | structure Lifting_Util: LIFTING_UTIL = | |
| 21 | struct | |
| 22 | ||
| 23 | infix 0 MRSL | |
| 24 | ||
| 25 | fun ants MRSL thm = fold (fn rl => fn thm => rl RS thm) ants thm | |
| 26 | ||
| 47699 | 27 | fun Trueprop_conv cv ct = | 
| 28 | (case Thm.term_of ct of | |
| 29 |     Const (@{const_name Trueprop}, _) $ _ => Conv.arg_conv cv ct
 | |
| 30 |   | _ => raise CTERM ("Trueprop_conv", [ct]))
 | |
| 31 | ||
| 47777 
f29e7dcd7c40
use a quot_map theorem attribute instead of the complicated map attribute
 kuncar parents: 
47699diff
changeset | 32 | fun dest_Quotient (Const (@{const_name Quotient}, _) $ rel $ abs $ rep $ cr)
 | 
| 
f29e7dcd7c40
use a quot_map theorem attribute instead of the complicated map attribute
 kuncar parents: 
47699diff
changeset | 33 | = (rel, abs, rep, cr) | 
| 
f29e7dcd7c40
use a quot_map theorem attribute instead of the complicated map attribute
 kuncar parents: 
47699diff
changeset | 34 |   | dest_Quotient t = raise TERM ("dest_Quotient", [t])
 | 
| 
f29e7dcd7c40
use a quot_map theorem attribute instead of the complicated map attribute
 kuncar parents: 
47699diff
changeset | 35 | |
| 47951 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 36 | (* | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 37 | quot_thm_rel, quot_thm_abs, quot_thm_rep and quot_thm_rty_qty - simple functions | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 38 | for destructing quotient theorems (Quotient R Abs Rep T). | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 39 | *) | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 40 | |
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 41 | fun quot_thm_rel quot_thm = | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 42 | case (dest_Quotient o HOLogic.dest_Trueprop o prop_of) quot_thm of | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 43 | (rel, _, _, _) => rel | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 44 | |
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 45 | fun quot_thm_abs quot_thm = | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 46 | case (dest_Quotient o HOLogic.dest_Trueprop o prop_of) quot_thm of | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 47 | (_, abs, _, _) => abs | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 48 | |
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 49 | fun quot_thm_rep quot_thm = | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 50 | case (dest_Quotient o HOLogic.dest_Trueprop o prop_of) quot_thm of | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 51 | (_, _, rep, _) => rep | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 52 | |
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 53 | fun quot_thm_rty_qty quot_thm = | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 54 | let | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 55 | val abs = quot_thm_abs quot_thm | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 56 | val abs_type = fastype_of abs | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 57 | in | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 58 | (domain_type abs_type, range_type abs_type) | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 59 | end | 
| 
8c8a03765de7
quot_del attribute, it allows us to deregister quotient types
 kuncar parents: 
47777diff
changeset | 60 | |
| 47698 | 61 | end; |