src/HOL/ex/Reflected_Presburger.thy
changeset 25134 3d4953e88449
parent 25112 98824cc791c0
child 25162 ad4d5365d9d8
equal deleted inserted replaced
25133:b933700f0384 25134:3d4953e88449
    61   "fmsize (A p) = 4+ fmsize p"
    61   "fmsize (A p) = 4+ fmsize p"
    62   "fmsize (Dvd i t) = 2"
    62   "fmsize (Dvd i t) = 2"
    63   "fmsize (NDvd i t) = 2"
    63   "fmsize (NDvd i t) = 2"
    64   "fmsize p = 1"
    64   "fmsize p = 1"
    65   (* several lemmas about fmsize *)
    65   (* several lemmas about fmsize *)
    66 lemma fmsize_pos: "fmsize p > 0"	
    66 lemma fmsize_pos: "fmsize p \<noteq> 0"	
    67 by (induct p rule: fmsize.induct) simp_all
    67 by (induct p rule: fmsize.induct) simp_all
    68 
    68 
    69   (* Semantics of formulae (fm) *)
    69   (* Semantics of formulae (fm) *)
    70 consts Ifm ::"bool list \<Rightarrow> int list \<Rightarrow> fm \<Rightarrow> bool"
    70 consts Ifm ::"bool list \<Rightarrow> int list \<Rightarrow> fm \<Rightarrow> bool"
    71 primrec
    71 primrec
   112   "prep (Or p q) = Or (prep p) (prep q)"
   112   "prep (Or p q) = Or (prep p) (prep q)"
   113   "prep (And p q) = And (prep p) (prep q)"
   113   "prep (And p q) = And (prep p) (prep q)"
   114   "prep (Imp p q) = prep (Or (NOT p) q)"
   114   "prep (Imp p q) = prep (Or (NOT p) q)"
   115   "prep (Iff p q) = Or (prep (And p q)) (prep (And (NOT p) (NOT q)))"
   115   "prep (Iff p q) = Or (prep (And p q)) (prep (And (NOT p) (NOT q)))"
   116   "prep p = p"
   116   "prep p = p"
   117 (hints simp add: fmsize_pos)
   117 (hints simp add: fmsize_pos neq0_conv[symmetric])
   118 lemma prep: "Ifm bbs bs (prep p) = Ifm bbs bs p"
   118 lemma prep: "Ifm bbs bs (prep p) = Ifm bbs bs p"
   119 by (induct p arbitrary: bs rule: prep.induct, auto)
   119 by (induct p arbitrary: bs rule: prep.induct, auto)
   120 
   120 
   121 
   121 
   122   (* Quantifier freeness *)
   122   (* Quantifier freeness *)
   186 | "numsubst0 t (Add a b) = Add (numsubst0 t a) (numsubst0 t b)"
   186 | "numsubst0 t (Add a b) = Add (numsubst0 t a) (numsubst0 t b)"
   187 | "numsubst0 t (Sub a b) = Sub (numsubst0 t a) (numsubst0 t b)" 
   187 | "numsubst0 t (Sub a b) = Sub (numsubst0 t a) (numsubst0 t b)" 
   188 | "numsubst0 t (Mul i a) = Mul i (numsubst0 t a)"
   188 | "numsubst0 t (Mul i a) = Mul i (numsubst0 t a)"
   189 
   189 
   190 lemma numsubst0_I:
   190 lemma numsubst0_I:
   191   shows "Inum (b#bs) (numsubst0 a t) = Inum ((Inum (b#bs) a)#bs) t"
   191   "Inum (b#bs) (numsubst0 a t) = Inum ((Inum (b#bs) a)#bs) t"
   192   by (induct t rule: numsubst0.induct,auto simp add: gr0_conv_Suc neq0_conv)
   192 by (induct t rule: numsubst0.induct,auto dest: not0_implies_Suc)
   193 
   193 
   194 lemma numsubst0_I':
   194 lemma numsubst0_I':
   195   assumes nb: "numbound0 a"
   195   "numbound0 a \<Longrightarrow> Inum (b#bs) (numsubst0 a t) = Inum ((Inum (b'#bs) a)#bs) t"
   196   shows "Inum (b#bs) (numsubst0 a t) = Inum ((Inum (b'#bs) a)#bs) t"
   196 by (induct t rule: numsubst0.induct, auto dest: not0_implies_Suc simp: numbound0_I[where b="b" and b'="b'"])
   197   using nb
       
   198   by (induct t rule: numsubst0.induct, auto simp add: neq0_conv gr0_conv_Suc numbound0_I[where b="b" and b'="b'"])
       
   199 
   197 
   200 primrec
   198 primrec
   201   "subst0 t T = T"
   199   "subst0 t T = T"
   202   "subst0 t F = F"
   200   "subst0 t F = F"
   203   "subst0 t (Lt a) = Lt (numsubst0 t a)"
   201   "subst0 t (Lt a) = Lt (numsubst0 t a)"