isabelle

How to get a typedef type to inherit operators from its mother type for type classes

久未见 提交于 2019-12-05 15:17:48
Post Answer Follow Up Question Brian provided an answer with a suggested solution being to use lifting and transfer. However, I can't find enough tutorial information on lifting and transfer to know how to tweak his answer to finish off what I would need to do. Here, I work in the dark, and use the answer given as a plug'n'play template to ask this follow up question. The command in my initial code, typedef trivAlg = "{x::sT. x = emS}" gives me a new type that is a subset of the mother type sT . I have my membership operator consts inP :: "sT => sT => bool" , and so in my naive view of lifting

Defining overloaded constants in Isabelle

坚强是说给别人听的谎言 提交于 2019-12-05 11:54:26
How can one define a function in Isabelle that has a different definition depending on either the type of its argument, or the type of the context it is used in? For example, I might want to define a functions is_default with type 'a ⇒ bool , where each different type 'a has a potentially different "default value". (I am also assuming, for the sake of argument, that existing concepts such as zero are not suitable.) This kind of overloading looks like a perfect fit for type classes. First you define a type class for your desired function is_default : class is_default = fixes is_default :: "'a ⇒

What's the difference between “arith” and “presburger” in Isabelle?

丶灬走出姿态 提交于 2019-12-05 11:22:32
Every goal that I have encountered in Isabelle so far that could be solved using arith could also be solved by presburger and vice versa, for example lemma "odd (n::nat) ⟹ Suc (2 * (n div 2)) = n" by presburger (* or arith *) What's the difference between the two solvers? Examples of goals that one can solve but the other can't would be nice. Edit: I managed to come up with a lemma proved by arith that presburger can't handle. It seems like this has something to do with real numbers: lemma "max i (i + 1) > (i::nat)" by arith -- ✔ lemma "max i (i + 1) > (i::nat)" by presburger -- ✔ lemma "max i

Drop a premise in a goal in apply style

浪尽此生 提交于 2019-12-05 07:53:10
let's assume I want to show the following lemma lemma "⟦ A; B; C ⟧ ⟹ D" I get the goal 1. A ⟹ B ⟹ C ⟹ D However, I don't need B . How can I transfer my goal to something like 1. A ⟹ C ⟹ D I don't want to alter the original lemma statement, just the current goal in apply style. What you want is apply (thin_tac B) . However, the last time I did this, Peter Lammich shouted "Oh god, why are you doing this!" in disgust and rewrote my proof in order to get rid of the thin_tac. So using this tactic doesn't exactly seem to be encouraged anymore. Normally it is better to avoid unwanted stuff in a goal

Isabelle: Power of a matrix (A^n)?

戏子无情 提交于 2019-12-04 21:56:14
There is a matrix multiplication definition in Cartesian_Euclidean_Space (in directory HOL/Multivariate_Analysis"): definition matrix_matrix_mult :: "('a::semiring_1) ^'n^'m ⇒ 'a ^'p^'n ⇒ 'a ^ 'p ^'m" (infixl "**" 70) where "m ** m' == (χ i j. setsum (λk. ((m$i)$k) * ((m'$k)$j)) (UNIV :: 'n set)) ::'a ^ 'p ^'m" Now the the squared matrix would be A ** A and A^3 would be A ** A ** A . I couldn't find a powerfunction, to define A^n (i.e., A ** A ** ... ** A n times). Is there a power function in the library? Is a manual definition needed? I have found the following definition in HOL/Power.thy :

Isabelle: maximum value in a vector

試著忘記壹切 提交于 2019-12-04 11:49:39
I would like to find the maximum in a vector of natural numbers. Vector (i.e., ‘vec’), however, is a different type than Set or List. I thought about several ideas that did not work, like leveling or lifting the type of vec or the definition of a recursive function. What solution do you suggest to get the maximum value in a vector? (* IMPORTS: "~~/src/HOL/Algebra/Ring" "~~/src/HOL/Library/Numeral_Type" "~~/src/HOL/Library/Permutations" "~~/src/HOL/Library/Polynomial" "~~/src/HOL/Big_Operators" vec (VECTOR) is from Finite_Cartesian_Product degree is from Polynomial Max is from Big_Operators *)

What is the difference between primrec and fun in Isabelle/HOL?

守給你的承諾、 提交于 2019-12-04 08:18:24
I'm reading the Isabelle tutorial and been trying to clear my concept on use of primrec and fun. With what I've searched so far, including the answer here ; I understand that constructor inside primrec can have only one equation and primrec has [simp] by default whereas fun can have multiple equations and the automation tactics need to be specified explicitly. However, I still struggle to understand it clearly. Anyone kind enough to explain with some examples? Manuel Eberl primrec does primitive recursion on an algebraic datatype (or something that has been set up to look like one, like the

How to pass assumptions to interpretation of locale

巧了我就是萌 提交于 2019-12-04 05:34:38
问题 I would like to use some properties of my structure in the proof required by a locale interpretation As an example, suppose I defined the predicate P and proved some lemmas ( add is a closed binary operation, add is associative and there exists zero the neutral element) about the add operation on elements that satisfy the predicate P I would like to interpret then the set of my elements as a structure that satisfy some locale, e.g. monoid interpretation "{s . P s}" :: monoid "(add)" "(zero)"

Can I name the variables generated by case analysis?

狂风中的少年 提交于 2019-12-04 03:49:12
问题 Is it possible to give my own names to the variables generated when using case analysis or induction? 回答1: If you are using structured proofs (starting with the proof keyword), you can use the case keywoard to select the case you want to prove and give names to the variables created by case analysis / induction: lemma "length (rev xs) = length xs" proof (induct xs) case Nil then show ?case ... next case (Cons x xs) then show ?case ... qed Here case (Cons x xs) tells Isabelle that you want to

How do I generate LaTeX from Isabelle/HOL? [closed]

邮差的信 提交于 2019-12-04 01:31:39
How can I use Isabelle/HOL to automatically generate LaTeX from my source theory files? Isabelle/HOL's tutorial.pdf is very beautiful. I'm going to write a paper in LaTeX with a lot of Isabelle code in it. You should first have a look at the existing documentation and come back with more specific questions afterwards (if there remain any; but I'm sure there will ;)). What you want to do is called document preparation in Isabelle. The first place to look is Chapter 4 Presenting Theories of the Isabelle System Manual . (Actually it is also a good idea to first read the previous chapter on