src/HOL/Library/Sum_of_Squares/positivstellensatz_tools.ML
changeset 59580 cbc38731d42f
parent 58629 a6a6cd499d4e
child 59582 0fbed69ff081
equal deleted inserted replaced
59579:d8fff0b94c53 59580:cbc38731d42f
   112 fun repeat_sep s f = f ::: Scan.repeat (str s |-- f)
   112 fun repeat_sep s f = f ::: Scan.repeat (str s |-- f)
   113 
   113 
   114 val parse_id = Scan.one Symbol.is_letter ::: Scan.many Symbol.is_letdig >> implode
   114 val parse_id = Scan.one Symbol.is_letter ::: Scan.many Symbol.is_letdig >> implode
   115 
   115 
   116 fun parse_varpow ctxt = parse_id -- Scan.optional (str "^" |-- nat) 1 >>
   116 fun parse_varpow ctxt = parse_id -- Scan.optional (str "^" |-- nat) 1 >>
   117   (fn (x, k) => (cterm_of (Proof_Context.theory_of ctxt) (Free (x, @{typ real})), k))
   117   (fn (x, k) => (Proof_Context.cterm_of ctxt (Free (x, @{typ real})), k))
   118 
   118 
   119 fun parse_monomial ctxt = repeat_sep "*" (parse_varpow ctxt) >>
   119 fun parse_monomial ctxt = repeat_sep "*" (parse_varpow ctxt) >>
   120   (fn xs => fold FuncUtil.Ctermfunc.update xs FuncUtil.Ctermfunc.empty)
   120   (fn xs => fold FuncUtil.Ctermfunc.update xs FuncUtil.Ctermfunc.empty)
   121 
   121 
   122 fun parse_cmonomial ctxt =
   122 fun parse_cmonomial ctxt =