diff -r 54f186bb5e3e -r 3b21b24a5fb6 Quot/Examples/AbsRepTest.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Quot/Examples/AbsRepTest.thy Wed Dec 23 10:31:54 2009 +0100 @@ -0,0 +1,78 @@ +theory AbsRepTest +imports "../QuotMain" "../QuotList" "../QuotOption" "../QuotSum" "../QuotProd" List +begin + + +(* +quotient_type + fset = "'a list" / "\(xs::'a list) ys. \e. e \ set xs \ e \ set ys" + apply(rule equivpI) + unfolding reflp_def symp_def transp_def + apply(auto) + sorry + done +*) + +inductive + list_eq (infix "\" 50) +where + "a#b#xs \ b#a#xs" +| "[] \ []" +| "xs \ ys \ ys \ xs" +| "a#a#xs \ a#xs" +| "xs \ ys \ a#xs \ a#ys" +| "\xs1 \ xs2; xs2 \ xs3\ \ xs1 \ xs3" + +quotient_type + fset = "'a list" / "list_eq" + sorry + + +fun + intrel :: "(nat \ nat) \ (nat \ nat) \ bool" +where + "intrel (x, y) (u, v) = (x + v = u + y)" + +quotient_type int = "nat \ nat" / intrel + sorry + + +ML {* +open Quotient_Term; +*} + +ML {* +absrep_fun_chk absF @{context} (@{typ "(((nat * nat) list) * 'a) option"}, @{typ "((int fset) * 'a) option"}) +|> Syntax.string_of_term @{context} +|> writeln +*} + +term "option_map (prod_fun (abs_fset \ map abs_int) id)" +term "option_map (prod_fun (map rep_int \ rep_fset) id)" +term "option_map (map rep_int \ rep_fset)" +term "option_map (abs_fset o (map abs_int))" +term "abs_fset" + +ML {* +absrep_fun_chk absF @{context} (@{typ "(nat * nat) list"}, @{typ "int fset"}) +|> Syntax.string_of_term @{context} +|> writeln +*} + +term "map abs_int" +term "abs_fset o map abs_int" + + +ML {* +absrep_fun_chk absF @{context} (@{typ "('a list) list"}, @{typ "('a fset) fset"}) +|> Syntax.string_of_term @{context} +|> writeln +*} + +ML {* +absrep_fun_chk absF @{context} (@{typ "('a list) list \ 'a"}, @{typ "('a fset) fset \ 'a"}) +|> Syntax.string_of_term @{context} +|> writeln +*} + +end \ No newline at end of file