# HG changeset patch # User Christian Urban # Date 1261266815 -3600 # Node ID 37285ec4387d463cd0c0c9068cfdca6fa6889747 # Parent df053507edba2fcf88973371357cc096868253d3 on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file diff -r df053507edba -r 37285ec4387d Quot/Examples/FSet.thy --- a/Quot/Examples/FSet.thy Sun Dec 20 00:26:53 2009 +0100 +++ b/Quot/Examples/FSet.thy Sun Dec 20 00:53:35 2009 +0100 @@ -26,17 +26,17 @@ fset = "'a list" / "list_eq" by (rule equivp_list_eq) -quotient_def +quotient_definition "EMPTY :: 'a fset" as "[]::'a list" -quotient_def +quotient_definition "INSERT :: 'a \ 'a fset \ 'a fset" as "op #" -quotient_def +quotient_definition "FUNION :: 'a fset \ 'a fset \ 'a fset" as "op @" @@ -47,7 +47,7 @@ card1_nil: "(card1 []) = 0" | card1_cons: "(card1 (x # xs)) = (if (x mem xs) then (card1 xs) else (Suc (card1 xs)))" -quotient_def +quotient_definition "CARD :: 'a fset \ nat" as "card1" @@ -110,17 +110,17 @@ apply (metis List.member.simps(1) list_eq.intros(6) list_eq_refl mem_cons) done -quotient_def +quotient_definition "IN :: 'a \ 'a fset \ bool" as "op mem" -quotient_def +quotient_definition "FOLD :: ('a \ 'a \ 'a) \ ('b \ 'a) \ 'a \ 'b fset \ 'a" as "fold1" -quotient_def +quotient_definition "fmap :: ('a \ 'b) \ 'a fset \ 'b fset" as "map" @@ -274,12 +274,12 @@ quotient_type fset2 = "'a list" / "list_eq" by (rule equivp_list_eq) -quotient_def +quotient_definition "EMPTY2 :: 'a fset2" as "[]::'a list" -quotient_def +quotient_definition "INSERT2 :: 'a \ 'a fset2 \ 'a fset2" as "op #" @@ -292,12 +292,12 @@ apply (lifting list_induct_part) done -quotient_def +quotient_definition "fset_rec :: 'a \ ('b \ 'b fset \ 'a \ 'a) \ 'b fset \ 'a" as "list_rec" -quotient_def +quotient_definition "fset_case :: 'a \ ('b \ 'b fset \ 'a) \ 'b fset \ 'a" as "list_case" diff -r df053507edba -r 37285ec4387d Quot/Examples/FSet2.thy --- a/Quot/Examples/FSet2.thy Sun Dec 20 00:26:53 2009 +0100 +++ b/Quot/Examples/FSet2.thy Sun Dec 20 00:53:35 2009 +0100 @@ -24,12 +24,12 @@ quotient_type fset = "'a list" / "list_eq" by (rule equivp_list_eq) -quotient_def +quotient_definition "fempty :: 'a fset" ("{||}") as "[]" -quotient_def +quotient_definition "finsert :: 'a \ 'a fset \ 'a fset" as "(op #)" @@ -38,7 +38,7 @@ shows "(op = ===> op \ ===> op \) (op #) (op #)" by (auto intro: list_eq.intros) -quotient_def +quotient_definition "funion :: 'a fset \ 'a fset \ 'a fset" ("_ \f _" [65,66] 65) as "(op @)" @@ -65,7 +65,7 @@ by (auto simp add: append_rsp_aux2) -quotient_def +quotient_definition "fmem :: 'a \ 'a fset \ bool" ("_ \f _" [50, 51] 50) as "(op mem)" @@ -89,7 +89,7 @@ where "inter_list X Y \ [x \ X. x\set Y]" -quotient_def +quotient_definition "finter::'a fset \ 'a fset \ 'a fset" ("_ \f _" [70, 71] 70) as "inter_list" diff -r df053507edba -r 37285ec4387d Quot/Examples/FSet3.thy --- a/Quot/Examples/FSet3.thy Sun Dec 20 00:26:53 2009 +0100 +++ b/Quot/Examples/FSet3.thy Sun Dec 20 00:53:35 2009 +0100 @@ -209,15 +209,15 @@ section {* Constants on the Quotient Type *} -quotient_def +quotient_definition "fempty :: 'a fset" as "[]::'a list" -quotient_def +quotient_definition "finsert :: 'a \ 'a fset \ 'a fset" as "op #" -quotient_def +quotient_definition "fin :: 'a \ 'a fset \ bool" ("_ \f _" [50, 51] 50) as "\x X. x \ set X" @@ -226,27 +226,27 @@ where "a \f S \ \(a \f S)" -quotient_def +quotient_definition "fcard :: 'a fset \ nat" as "card_raw" -quotient_def +quotient_definition "fdelete :: 'a fset \ 'a \ 'a fset" as "delete_raw" -quotient_def +quotient_definition "funion :: 'a fset \ 'a fset \ 'a fset" ("_ \f _" [50, 51] 50) as "op @" -quotient_def +quotient_definition "finter :: 'a fset \ 'a fset \ 'a fset" ("_ \f _" [70, 71] 70) as "inter_raw" -quotient_def +quotient_definition "ffold :: ('a \ 'b \ 'b) \ 'b \ 'a fset \ 'b" as "fold_raw" -quotient_def +quotient_definition "fset_to_set :: 'a fset \ 'a set" as "set" @@ -304,7 +304,7 @@ lemma "funion (funion x xa) xb = funion x (funion xa xb)" by (lifting append_assoc) -quotient_def +quotient_definition "fset_case :: 'a \ ('b \ 'b fset \ 'a) \ 'b fset \ 'a" as "list_case" diff -r df053507edba -r 37285ec4387d Quot/Examples/IntEx.thy --- a/Quot/Examples/IntEx.thy Sun Dec 20 00:26:53 2009 +0100 +++ b/Quot/Examples/IntEx.thy Sun Dec 20 00:53:35 2009 +0100 @@ -21,12 +21,12 @@ print_theorems print_quotients -quotient_def +quotient_definition "ZERO :: my_int" as "(0::nat, 0::nat)" -quotient_def +quotient_definition "ONE :: my_int" as "(1::nat, 0::nat)" @@ -36,7 +36,7 @@ where "my_plus (x, y) (u, v) = (x + u, y + v)" -quotient_def +quotient_definition "PLUS :: my_int \ my_int \ my_int" as "my_plus" @@ -46,7 +46,7 @@ where "my_neg (x, y) = (y, x)" -quotient_def +quotient_definition "NEG :: my_int \ my_int" as "my_neg" @@ -61,7 +61,7 @@ where "my_mult (x, y) (u, v) = (x*u + y*v, x*v + y*u)" -quotient_def +quotient_definition "MULT :: my_int \ my_int \ my_int" as "my_mult" @@ -73,7 +73,7 @@ where "my_le (x, y) (u, v) = (x+v \ u+y)" -quotient_def +quotient_definition "LE :: my_int \ my_int \ bool" as "my_le" diff -r df053507edba -r 37285ec4387d Quot/Examples/IntEx2.thy --- a/Quot/Examples/IntEx2.thy Sun Dec 20 00:26:53 2009 +0100 +++ b/Quot/Examples/IntEx2.thy Sun Dec 20 00:53:35 2009 +0100 @@ -20,10 +20,10 @@ ML {* @{term "0 \ int"} *} -quotient_def +quotient_definition "0 \ int" as "(0\nat, 0\nat)" -quotient_def +quotient_definition "1 \ int" as "(1\nat, 0\nat)" fun @@ -31,7 +31,7 @@ where "plus_raw (x, y) (u, v) = (x + u, y + v)" -quotient_def +quotient_definition "(op +) \ (int \ int \ int)" as "plus_raw" fun @@ -39,7 +39,7 @@ where "uminus_raw (x, y) = (y, x)" -quotient_def +quotient_definition "(uminus \ (int \ int))" as "uminus_raw" definition @@ -50,7 +50,7 @@ where "mult_raw (x, y) (u, v) = (x*u + y*v, x*v + y*u)" -quotient_def +quotient_definition mult_int_def: "(op *) :: (int \ int \ int)" as "mult_raw" fun @@ -58,7 +58,7 @@ where "le_raw (x, y) (u, v) = (x+v \ u+y)" -quotient_def +quotient_definition le_int_def: "(op \) :: int \ int \ bool" as "le_raw" definition @@ -206,7 +206,7 @@ definition int_of_nat_raw: "int_of_nat_raw m = (m :: nat, 0 :: nat)" -quotient_def +quotient_definition "int_of_nat :: nat \ int" as "int_of_nat_raw" lemma[quot_respect]: diff -r df053507edba -r 37285ec4387d Quot/Examples/LFex.thy --- a/Quot/Examples/LFex.thy Sun Dec 20 00:26:53 2009 +0100 +++ b/Quot/Examples/LFex.thy Sun Dec 20 00:53:35 2009 +0100 @@ -81,48 +81,48 @@ TRM = trm / atrm by (auto intro: alpha_equivps) -quotient_def +quotient_definition "TYP :: KIND" as "Type" -quotient_def +quotient_definition "KPI :: TY \ name \ KIND \ KIND" as "KPi" -quotient_def +quotient_definition "TCONST :: ident \ TY" as "TConst" -quotient_def +quotient_definition "TAPP :: TY \ TRM \ TY" as "TApp" -quotient_def +quotient_definition "TPI :: TY \ name \ TY \ TY" as "TPi" (* FIXME: does not work with CONST *) -quotient_def +quotient_definition "CONS :: ident \ TRM" as "Const" -quotient_def +quotient_definition "VAR :: name \ TRM" as "Var" -quotient_def +quotient_definition "APP :: TRM \ TRM \ TRM" as "App" -quotient_def +quotient_definition "LAM :: TY \ name \ TRM \ TRM" as "Lam" @@ -138,17 +138,17 @@ thm LAM_def (* FIXME: print out a warning if the type contains a liftet type, like kind \ name set *) -quotient_def +quotient_definition "FV_kind :: KIND \ name set" as "fv_kind" -quotient_def +quotient_definition "FV_ty :: TY \ name set" as "fv_ty" -quotient_def +quotient_definition "FV_trm :: TRM \ name set" as "fv_trm" @@ -164,17 +164,17 @@ perm_trm \ "perm :: 'x prm \ TRM \ TRM" (unchecked) begin -quotient_def +quotient_definition "perm_kind :: 'x prm \ KIND \ KIND" as "(perm::'x prm \ kind \ kind)" -quotient_def +quotient_definition "perm_ty :: 'x prm \ TY \ TY" as "(perm::'x prm \ ty \ ty)" -quotient_def +quotient_definition "perm_trm :: 'x prm \ TRM \ TRM" as "(perm::'x prm \ trm \ trm)" diff -r df053507edba -r 37285ec4387d Quot/Examples/LamEx.thy --- a/Quot/Examples/LamEx.thy Sun Dec 20 00:26:53 2009 +0100 +++ b/Quot/Examples/LamEx.thy Sun Dec 20 00:53:35 2009 +0100 @@ -56,17 +56,17 @@ print_quotients -quotient_def +quotient_definition "Var :: name \ lam" as "rVar" -quotient_def +quotient_definition "App :: lam \ lam \ lam" as "rApp" -quotient_def +quotient_definition "Lam :: name \ lam \ lam" as "rLam" @@ -75,7 +75,7 @@ thm App_def thm Lam_def -quotient_def +quotient_definition "fv :: lam \ name set" as "rfv" @@ -88,7 +88,7 @@ perm_lam \ "perm :: 'x prm \ lam \ lam" (unchecked) begin -quotient_def +quotient_definition "perm_lam :: 'x prm \ lam \ lam" as "perm::'x prm \ rlam \ rlam" diff -r df053507edba -r 37285ec4387d Quot/Examples/LarryDatatype.thy --- a/Quot/Examples/LarryDatatype.thy Sun Dec 20 00:26:53 2009 +0100 +++ b/Quot/Examples/LarryDatatype.thy Sun Dec 20 00:53:35 2009 +0100 @@ -126,22 +126,22 @@ text{*The abstract message constructors*} -quotient_def +quotient_definition "Nonce :: nat \ msg" as "NONCE" -quotient_def +quotient_definition "MPair :: msg \ msg \ msg" as "MPAIR" -quotient_def +quotient_definition "Crypt :: nat \ msg \ msg" as "CRYPT" -quotient_def +quotient_definition "Decrypt :: nat \ msg \ msg" as "DECRYPT" @@ -163,7 +163,7 @@ subsection{*The Abstract Function to Return the Set of Nonces*} -quotient_def +quotient_definition "nonces:: msg \ nat set" as "freenonces" @@ -199,7 +199,7 @@ subsection{*The Abstract Function to Return the Left Part*} -quotient_def +quotient_definition "left:: msg \ msg" as "freeleft" @@ -226,7 +226,7 @@ subsection{*The Abstract Function to Return the Right Part*} -quotient_def +quotient_definition "right:: msg \ msg" as "freeright" @@ -360,7 +360,7 @@ text{*However, as @{text Crypt_Nonce_neq_Nonce} above illustrates, we don't need this function in order to prove discrimination theorems.*} -quotient_def +quotient_definition "discrim:: msg \ int" as "freediscrim" diff -r df053507edba -r 37285ec4387d Quot/Examples/LarryInt.thy --- a/Quot/Examples/LarryInt.thy Sun Dec 20 00:26:53 2009 +0100 +++ b/Quot/Examples/LarryInt.thy Sun Dec 20 00:53:35 2009 +0100 @@ -16,16 +16,16 @@ instantiation int :: "{zero, one, plus, uminus, minus, times, ord}" begin -quotient_def +quotient_definition Zero_int_def: "0::int" as "(0::nat, 0::nat)" -quotient_def +quotient_definition One_int_def: "1::int" as "(1::nat, 0::nat)" definition "add_raw \ \(x, y) (u, v). (x + (u::nat), y + (v::nat))" -quotient_def +quotient_definition "(op +) :: int \ int \ int" as "add_raw" @@ -33,7 +33,7 @@ definition "uminus_raw \ \(x::nat, y::nat). (y, x)" -quotient_def +quotient_definition "uminus :: int \ int" as "uminus_raw" @@ -43,7 +43,7 @@ where "mult_raw (x, y) (u, v) = (x*u + y*v, x*v + y*u)" -quotient_def +quotient_definition "(op *) :: int \ int \ int" as "mult_raw" @@ -51,7 +51,7 @@ definition "le_raw \ \(x, y) (u, v). (x+v \ u+(y::nat))" -quotient_def +quotient_definition le_int_def: "(op \) :: int \ int \ bool" as "le_raw" @@ -343,7 +343,7 @@ definition "nat_raw \ \(x, y).x - (y::nat)" -quotient_def +quotient_definition "nat2::int\nat" as "nat_raw" diff -r df053507edba -r 37285ec4387d Quot/quotient_def.ML --- a/Quot/quotient_def.ML Sun Dec 20 00:26:53 2009 +0100 +++ b/Quot/quotient_def.ML Sun Dec 20 00:53:35 2009 +0100 @@ -127,8 +127,9 @@ (OuterParse.opt_mixfix' --| OuterParse.$$$ "as" -- OuterParse.term) -val _ = OuterSyntax.local_theory "quotient_def" "lifted definition of constants" - OuterKeyword.thy_decl (quotdef_parser >> quotdef_cmd) +val _ = OuterSyntax.local_theory "quotient_definition" + "definition for constants over the quotient type" + OuterKeyword.thy_decl (quotdef_parser >> quotdef_cmd) end; (* structure *) diff -r df053507edba -r 37285ec4387d isar-keywords-quot.el --- a/isar-keywords-quot.el Sun Dec 20 00:26:53 2009 +0100 +++ b/isar-keywords-quot.el Sun Dec 20 00:53:35 2009 +0100 @@ -193,7 +193,7 @@ "quickcheck" "quickcheck_params" "quit" - "quotient_def" + "quotient_definition" "quotient_type" "realizability" "realizers" @@ -477,7 +477,7 @@ "print_ast_translation" "print_translation" "quickcheck_params" - "quotient_def" + "quotient_definition" "realizability" "realizers" "recdef"