doc-src/TutorialI/Rules/Forward.thy
changeset 11711 ecdfd237ffee
parent 11480 0fba0357c04c
child 12156 d2758965362e
equal deleted inserted replaced
11710:f5401162c9f0 11711:ecdfd237ffee
    19 apply (rule is_gcd)
    19 apply (rule is_gcd)
    20 apply (subst is_gcd_commute)
    20 apply (subst is_gcd_commute)
    21 apply (simp add: is_gcd)
    21 apply (simp add: is_gcd)
    22 done
    22 done
    23 
    23 
    24 lemma gcd_1 [simp]: "gcd(m,1') = 1'"
    24 lemma gcd_1 [simp]: "gcd(m, Suc 0) = Suc 0"
    25 apply simp
    25 apply simp
    26 done
    26 done
    27 
    27 
    28 lemma gcd_1_left [simp]: "gcd(1',m) = 1'"
    28 lemma gcd_1_left [simp]: "gcd(Suc 0, m) = Suc 0"
    29 apply (simp add: gcd_commute [of "1'"])
    29 apply (simp add: gcd_commute [of "Suc 0"])
    30 done
    30 done
    31 
    31 
    32 text{*\noindent
    32 text{*\noindent
    33 as far as HERE.
    33 as far as HERE.
    34 *}
    34 *}
   123 theorem arg_cong, useful in forward steps
   123 theorem arg_cong, useful in forward steps
   124 @{thm[display] arg_cong[no_vars]}
   124 @{thm[display] arg_cong[no_vars]}
   125 \rulename{arg_cong}
   125 \rulename{arg_cong}
   126 *}
   126 *}
   127 
   127 
   128 lemma "#2 \<le> u \<Longrightarrow> u*m \<noteq> Suc(u*n)"
   128 lemma "2 \<le> u \<Longrightarrow> u*m \<noteq> Suc(u*n)"
   129 apply intro
   129 apply intro
   130 txt{*
   130 txt{*
   131 before using arg_cong
   131 before using arg_cong
   132 @{subgoals[display,indent=0,margin=65]}
   132 @{subgoals[display,indent=0,margin=65]}
   133 *};
   133 *};
   175 
   175 
   176 lemma relprime_dvd_mult_iff: "gcd(k,n)=1 \<Longrightarrow> (k dvd m*n) = (k dvd m)";
   176 lemma relprime_dvd_mult_iff: "gcd(k,n)=1 \<Longrightarrow> (k dvd m*n) = (k dvd m)";
   177 by (blast intro: relprime_dvd_mult dvd_trans)
   177 by (blast intro: relprime_dvd_mult dvd_trans)
   178 
   178 
   179 
   179 
   180 lemma relprime_20_81: "gcd(#20,#81) = 1";
   180 lemma relprime_20_81: "gcd(20,81) = 1";
   181 by (simp add: gcd.simps)
   181 by (simp add: gcd.simps)
   182 
   182 
   183 text {*
   183 text {*
   184 Examples of 'OF'
   184 Examples of 'OF'
   185 
   185 
   197 @{thm[display] dvd_add [OF dvd_refl dvd_refl]}
   197 @{thm[display] dvd_add [OF dvd_refl dvd_refl]}
   198 
   198 
   199 @{thm[display] dvd_add [OF _ dvd_refl]}
   199 @{thm[display] dvd_add [OF _ dvd_refl]}
   200 *};
   200 *};
   201 
   201 
   202 lemma "\<lbrakk>(z::int) < #37; #66 < #2*z; z*z \<noteq> #1225; Q(#34); Q(#36)\<rbrakk> \<Longrightarrow> Q(z)";
   202 lemma "\<lbrakk>(z::int) < 37; 66 < 2*z; z*z \<noteq> 1225; Q(34); Q(36)\<rbrakk> \<Longrightarrow> Q(z)";
   203 apply (subgoal_tac "z = #34 \<or> z = #36")
   203 apply (subgoal_tac "z = 34 \<or> z = 36")
   204 txt{*
   204 txt{*
   205 the tactic leaves two subgoals:
   205 the tactic leaves two subgoals:
   206 @{subgoals[display,indent=0,margin=65]}
   206 @{subgoals[display,indent=0,margin=65]}
   207 *};
   207 *};
   208 apply blast
   208 apply blast
   209 apply (subgoal_tac "z \<noteq> #35")
   209 apply (subgoal_tac "z \<noteq> 35")
   210 txt{*
   210 txt{*
   211 the tactic leaves two subgoals:
   211 the tactic leaves two subgoals:
   212 @{subgoals[display,indent=0,margin=65]}
   212 @{subgoals[display,indent=0,margin=65]}
   213 *};
   213 *};
   214 apply arith
   214 apply arith