src/Provers/Arith/fast_lin_arith.ML
changeset 14821 241d2db86fc2
parent 14510 73ea1234bb23
child 15027 d23887300b96
equal deleted inserted replaced
14820:3f80d6510ee9 14821:241d2db86fc2
   427                                         then LA_Data.decomp sg (concl_of thm)
   427                                         then LA_Data.decomp sg (concl_of thm)
   428                                         else None) asms)
   428                                         else None) asms)
   429 
   429 
   430       fun add2 thm1 thm2 =
   430       fun add2 thm1 thm2 =
   431         let val conj = thm1 RS (thm2 RS LA_Logic.conjI)
   431         let val conj = thm1 RS (thm2 RS LA_Logic.conjI)
   432         in get_first (fn th => Some(conj RS th) handle _ => None) add_mono_thms
   432         in get_first (fn th => Some(conj RS th) handle THM _ => None) add_mono_thms
   433         end;
   433         end;
   434 
   434 
   435       fun try_add [] _ = None
   435       fun try_add [] _ = None
   436         | try_add (thm1::thm1s) thm2 = case add2 thm1 thm2 of
   436         | try_add (thm1::thm1s) thm2 = case add2 thm1 thm2 of
   437              None => try_add thm1s thm2 | some => some;
   437              None => try_add thm1s thm2 | some => some;
   451         let fun mul(i,th) = if i=1 then th else mul(i-1, addthms thm th)
   451         let fun mul(i,th) = if i=1 then th else mul(i-1, addthms thm th)
   452         in if n < 0 then mul(~n,thm) RS LA_Logic.sym else mul(n,thm) end;
   452         in if n < 0 then mul(~n,thm) RS LA_Logic.sym else mul(n,thm) end;
   453 
   453 
   454       fun multn2(n,thm) =
   454       fun multn2(n,thm) =
   455         let val Some(mth,cv) =
   455         let val Some(mth,cv) =
   456               get_first (fn (th,cv) => Some(thm RS th,cv) handle _ => None) mult_mono_thms
   456               get_first (fn (th,cv) => Some(thm RS th,cv) handle THM _ => None) mult_mono_thms
   457             val ct = cterm_of sg (LA_Data.number_of(n,#T(rep_cterm cv)))
   457             val ct = cterm_of sg (LA_Data.number_of(n,#T(rep_cterm cv)))
   458         in instantiate ([],[(cv,ct)]) mth end
   458         in instantiate ([],[(cv,ct)]) mth end
   459 
   459 
   460       fun simp thm =
   460       fun simp thm =
   461         let val thm' = trace_thm "Simplified:" (full_simplify simpset thm)
   461         let val thm' = trace_thm "Simplified:" (full_simplify simpset thm)
   693     let val (thm1,js1) = fwdproof sg tree1 js
   693     let val (thm1,js1) = fwdproof sg tree1 js
   694         val (thm2,js2) = fwdproof sg tree2 js1
   694         val (thm2,js2) = fwdproof sg tree2 js1
   695         val thm1' = implies_intr ct1 thm1
   695         val thm1' = implies_intr ct1 thm1
   696         val thm2' = implies_intr ct2 thm2
   696         val thm2' = implies_intr ct2 thm2
   697     in (thm2' COMP (thm1' COMP thm), js2) end;
   697     in (thm2' COMP (thm1' COMP thm), js2) end;
   698 (* needs handle _ => None ? *)
   698 (* needs handle THM _ => None ? *)
   699 
   699 
   700 fun prover sg thms Tconcl js pos =
   700 fun prover sg thms Tconcl js pos =
   701 let val nTconcl = LA_Logic.neg_prop Tconcl
   701 let val nTconcl = LA_Logic.neg_prop Tconcl
   702     val cnTconcl = cterm_of sg nTconcl
   702     val cnTconcl = cterm_of sg nTconcl
   703     val nTconclthm = assume cnTconcl
   703     val nTconclthm = assume cnTconcl