With int_of_nat as a quotient_def, lemmas about it can be easily lifted.
authorCezary Kaliszyk <kaliszyk@in.tum.de>
Thu, 10 Dec 2009 02:42:09 +0100
changeset 679 fe64784b38c3
parent 678 569f0e286400
child 682 8aa67d037b3c
With int_of_nat as a quotient_def, lemmas about it can be easily lifted.
Quot/Examples/IntEx2.thy
--- a/Quot/Examples/IntEx2.thy	Thu Dec 10 01:48:39 2009 +0100
+++ b/Quot/Examples/IntEx2.thy	Thu Dec 10 02:42:09 2009 +0100
@@ -218,9 +218,19 @@
 apply(simp_all add: rep_abs_rsp_left[OF Quotient_int])
 done
 
-lemma int_def: 
-  shows "of_nat m = ABS_int (m, 0)"
-by (induct m) (simp_all add: zero_int_def one_int_def add)
+definition int_of_nat_raw: "int_of_nat_raw m = (m :: nat, 0 :: nat)"
+
+quotient_def
+  int_of_nat :: "int_of_nat :: nat \<Rightarrow> int" where "int_of_nat_raw"
+
+lemma[quot_respect]: "(op = ===> op \<approx>) int_of_nat_raw int_of_nat_raw"
+by (simp add: equivp_reflp[OF int_equivp])
+
+lemma int_def:
+  shows "of_nat m = int_of_nat m"
+apply (induct m)
+apply (simp_all add: zero_int_def one_int_def int_of_nat_def int_of_nat_raw add)
+done
 
 lemma le_antisym_raw:
   shows "less_eq_raw i j \<Longrightarrow> less_eq_raw j i \<Longrightarrow> i \<approx> j"
@@ -297,7 +307,7 @@
 lemma int_induct_raw:
   assumes a: "P (0::nat, 0)"
   and     b: "\<And>i. P i \<Longrightarrow> P (plus_raw i (1,0))"
-  and     c: "\<And>i. P i \<Longrightarrow> P (plus_raw i (minus_raw (1,0)))"
+  and     c: "\<And>i. P i \<Longrightarrow> P (plus_raw i (uminus_raw (1,0)))"
   shows      "P x"
 apply(case_tac x) apply(simp)
 apply(rule_tac x="b" in spec)
@@ -314,10 +324,20 @@
   shows      "P x"
 using a b c by (lifting int_induct_raw)
 
-lemma zero_le_imp_eq_int: 
+lemma zero_le_imp_eq_int_raw:
+  fixes k::"(nat \<times> nat)"
+  shows "less_raw (0,0) k \<Longrightarrow> (\<exists>n > 0. k \<approx> int_of_nat_raw n)"
+apply(cases k)
+apply(simp add:int_of_nat_raw)
+apply(auto)
+apply(rule_tac i="b" and j="a" in less_Suc_induct)
+apply(auto)
+done
+
+lemma zero_le_imp_eq_int:
   fixes k::int
-  shows "0 < k \<Longrightarrow> \<exists>n > 0. k = of_nat n"
-sorry
+  shows "0 < k \<Longrightarrow> \<exists>n > 0. k = int_of_nat n"
+unfolding less_int_def by (lifting zero_le_imp_eq_int_raw)
 
 lemma zmult_zless_mono2: 
   fixes i j k::int