655 produces a rule which can be used to perform case distinction on both |
655 produces a rule which can be used to perform case distinction on both |
656 a list and a nat. |
656 a list and a nat. |
657 |
657 |
658 * Theory Library/Multiset: Improved code generation of multisets. |
658 * Theory Library/Multiset: Improved code generation of multisets. |
659 |
659 |
|
660 * New Transfer package: |
|
661 |
|
662 - transfer_rule attribute: Maintains a collection of transfer rules, |
|
663 which relate constants at two different types. Transfer rules may |
|
664 relate different type instances of the same polymorphic constant, |
|
665 or they may relate an operation on a raw type to a corresponding |
|
666 operation on an abstract type (quotient or subtype). For example: |
|
667 |
|
668 ((A ===> B) ===> list_all2 A ===> list_all2 B) map map |
|
669 (cr_int ===> cr_int ===> cr_int) (%(x,y) (u,v). (x+u, y+v)) plus_int |
|
670 |
|
671 - transfer method: Replaces a subgoal on abstract types with an |
|
672 equivalent subgoal on the corresponding raw types. Constants are |
|
673 replaced with corresponding ones according to the transfer rules. |
|
674 Goals are generalized over all free variables by default; this is |
|
675 necessary for variables whose types changes, but can be overridden |
|
676 for specific variables with e.g. 'transfer fixing: x y z'. |
|
677 |
|
678 - relator_eq attribute: Collects identity laws for relators of |
|
679 various type constructors, e.g. "list_all2 (op =) = (op =)". The |
|
680 transfer method uses these lemmas to infer transfer rules for |
|
681 non-polymorphic constants on the fly. |
|
682 |
|
683 - transfer_prover method: Assists with proving a transfer rule for a |
|
684 new constant, provided the constant is defined in terms of other |
|
685 constants that already have transfer rules. It should be applied |
|
686 after unfolding the constant definitions. |
|
687 |
|
688 - HOL/ex/Transfer_Int_Nat.thy: Example theory demonstrating transfer |
|
689 from type nat to type int. |
|
690 |
|
691 * New Lifting package: |
|
692 |
|
693 - lift_definition command: Defines operations on an abstract type in |
|
694 terms of a corresponding operation on a representation type. Example |
|
695 syntax: |
|
696 |
|
697 lift_definition dlist_insert :: "'a => 'a dlist => 'a dlist" |
|
698 is List.insert |
|
699 |
|
700 Users must discharge a respectfulness proof obligation when each |
|
701 constant is defined. (For a type copy, i.e. a typedef with UNIV, |
|
702 the proof is discharged automatically.) The obligation is |
|
703 presented in a user-friendly, readable form; a respectfulness |
|
704 theorem in the standard format and a transfer rule are generated |
|
705 by the package. |
|
706 |
|
707 - Integration with code_abstype: For typedefs (e.g. subtypes |
|
708 corresponding to a datatype invariant, such as dlist), |
|
709 lift_definition generates a code certificate theorem and sets up |
|
710 code generation for each constant. |
|
711 |
|
712 - setup_lifting command: Sets up the Lifting package to work with |
|
713 a user-defined type. The user must provide either a quotient |
|
714 theorem or a type_definition theorem. The package configures |
|
715 transfer rules for equality and quantifiers on the type, and sets |
|
716 up the lift_definition command to work with the type. |
|
717 |
|
718 - Usage examples: See Quotient_Examples/Lift_DList.thy, |
|
719 Quotient_Examples/Lift_RBT.thy, Word/Word.thy and |
|
720 Library/Float.thy. |
|
721 |
|
722 * Quotient package: |
|
723 |
|
724 - The 'quotient_type' command now supports a 'morphisms' option with |
|
725 rep and abs functions, similar to typedef. |
|
726 |
|
727 - 'quotient_type' sets up new types to work with the Lifting and |
|
728 Transfer packages, as with 'setup_lifting'. |
|
729 |
|
730 - The 'quotient_definition' command now requires the user to prove a |
|
731 respectfulness property at the point where the constant is |
|
732 defined, similar to lift_definition; INCOMPATIBILITY. Users are |
|
733 encouraged to use lift_definition + transfer instead of |
|
734 quotient_definition + descending, which will eventually be |
|
735 deprecated. |
|
736 |
|
737 - Renamed predicate 'Quotient' to 'Quotient3', and renamed theorems |
|
738 accordingly, INCOMPATIBILITY. |
|
739 |
660 * New diagnostic command 'find_unused_assms' to find potentially |
740 * New diagnostic command 'find_unused_assms' to find potentially |
661 superfluous assumptions in theorems using Quickcheck. |
741 superfluous assumptions in theorems using Quickcheck. |
662 |
742 |
663 * Quickcheck: |
743 * Quickcheck: |
664 |
744 |