src/HOL/Hoare/Arith2.ML
changeset 1875 54c0462f8fb2
parent 1714 1a5e0101399d
child 2031 03a843f0f447
equal deleted inserted replaced
1874:35f22792aade 1875:54c0462f8fb2
    12 (*** HOL lemmas ***)
    12 (*** HOL lemmas ***)
    13 
    13 
    14 
    14 
    15 val [prem1,prem2]=goal HOL.thy "[|~P ==> ~Q; Q|] ==> P";
    15 val [prem1,prem2]=goal HOL.thy "[|~P ==> ~Q; Q|] ==> P";
    16 by (cut_facts_tac [prem1 COMP impI,prem2] 1);
    16 by (cut_facts_tac [prem1 COMP impI,prem2] 1);
    17 by (fast_tac HOL_cs 1);
    17 by (Fast_tac 1);
    18 val not_imp_swap=result();
    18 val not_imp_swap=result();
    19 
    19 
    20 
    20 
    21 (*** analogue of diff_induct, for simultaneous induction over 3 vars ***)
    21 (*** analogue of diff_induct, for simultaneous induction over 3 vars ***)
    22 
    22 
    38 br allI 7;
    38 br allI 7;
    39 by (nat_ind_tac "xa" 7);
    39 by (nat_ind_tac "xa" 7);
    40 by (ALLGOALS (resolve_tac prems));
    40 by (ALLGOALS (resolve_tac prems));
    41 ba 1;
    41 ba 1;
    42 ba 1;
    42 ba 1;
    43 by (fast_tac HOL_cs 1);
    43 by (Fast_tac 1);
    44 by (fast_tac HOL_cs 1);
    44 by (Fast_tac 1);
    45 qed "diff_induct3";
    45 qed "diff_induct3";
    46 
    46 
    47 (*** interaction of + and - ***)
    47 (*** interaction of + and - ***)
    48 
    48 
    49 val prems=goal Arith.thy "~m<n+k ==> (m - n) - k = m - ((n + k)::nat)";
    49 val prems=goal Arith.thy "~m<n+k ==> (m - n) - k = m - ((n + k)::nat)";
   159 (*
   159 (*
   160 val prems = goal thy "0<n ==> n mod n = 0";
   160 val prems = goal thy "0<n ==> n mod n = 0";
   161 by (cut_inst_tac [("m","Suc(0)")] (mod_prod_nn_is_0 COMP impI) 1);
   161 by (cut_inst_tac [("m","Suc(0)")] (mod_prod_nn_is_0 COMP impI) 1);
   162 by (cut_facts_tac prems 1);
   162 by (cut_facts_tac prems 1);
   163 by (Asm_full_simp_tac 1);
   163 by (Asm_full_simp_tac 1);
   164 by (fast_tac HOL_cs 1);
   164 by (Fast_tac 1);
   165 *)
   165 *)
   166 
   166 
   167 val prems=goal thy "0<n ==> n mod n = 0";
   167 val prems=goal thy "0<n ==> n mod n = 0";
   168 by (cut_facts_tac prems 1);
   168 by (cut_facts_tac prems 1);
   169 br (mod_def RS wf_less_trans) 1;
   169 br (mod_def RS wf_less_trans) 1;
   289 bd divides_le 1;
   289 bd divides_le 1;
   290 by (Asm_simp_tac 1);
   290 by (Asm_simp_tac 1);
   291 qed "cd_le";
   291 qed "cd_le";
   292 
   292 
   293 val prems=goalw thy [cd_def] "cd x m n = cd x n m";
   293 val prems=goalw thy [cd_def] "cd x m n = cd x n m";
   294 by (fast_tac HOL_cs 1);
   294 by (Fast_tac 1);
   295 qed "cd_swap";
   295 qed "cd_swap";
   296 
   296 
   297 val prems=goalw thy [cd_def] "n<m ==> cd x m n = cd x (m-n) n";
   297 val prems=goalw thy [cd_def] "n<m ==> cd x m n = cd x (m-n) n";
   298 by (cut_facts_tac prems 1);
   298 by (cut_facts_tac prems 1);
   299 br iffI 1;
   299 br iffI 1;