isabelle

How to define an inductive predicate on fset?

蹲街弑〆低调 提交于 2019-12-23 19:00:09
问题 I defined 2 kinds of values and a cast function: theory FSetIndTest imports Main "~~/src/HOL/Library/FSet" begin datatype val1 = A | B datatype val2 = C | D inductive cast_val :: "val1 ⇒ val2 ⇒ bool" where "cast_val A C" | "cast_val B D" Also, I defined cast function for a list of values: inductive cast_list :: "val1 list ⇒ val2 list ⇒ bool" where "cast_list [] []" | "cast_val x y ⟹ cast_list xs ys ⟹ cast_list (x#xs) (y#ys)" code_pred [show_modes] cast_list . values "{x. cast_list [A, B] x}"

isabelle proving commutativity for add

被刻印的时光 ゝ 提交于 2019-12-23 14:56:11
问题 Im trying to prove commutativity in Isabelle/HOL for a self-defined add function. I managed to prove associativity but I'm stuck on this. The definition of add : fun add :: "nat ⇒ nat ⇒ nat" where "add 0 n = n" | "add (Suc m) n = Suc(add m n)" The proof of associativity: lemma add_Associative: "add(add k m) z = add k (add m z)" apply(induction k) apply(auto) done The proof of commutativity: theorem add_commutativity: "add k m = add m k" apply(induction k) apply(induction m) apply(auto) I get

Isabelle2016 and Proof General

断了今生、忘了曾经 提交于 2019-12-23 09:08:41
问题 I've been trying to learn to use Isabelle 2016. While in principle I like the idea of asynchronous proof checking, I don't like Isabelle/jEdit for a number of reasons, the most severe of which is that it uses too much memory (for me). It'd be great if I could use the good old Proof General with Isabelle 2016. I set the variable isa-isabelle-command to point the file bin/isabelle under the Isabelle distribution directory. When I start Isabelle using Proof General's menu, Emacs hangs, and when

Degree of polynomial smaller than a number

喜夏-厌秋 提交于 2019-12-23 05:24:05
问题 I am working on a lemma that shows that the degree of a sum of monomials is always less or equal to n if the exponent of each monomial is less or equal to n . lemma degree_poly_smaller: fixes a :: "('a::comm_ring_1 poly)" and n::nat shows "degree (∑x∷nat | x ≤ n . monom (coeff a x) x) ≤ n" sorry What I have to so far is the following (please mind that I am a beginner in Isabelle): lemma degree_smaller: fixes a :: "('a::comm_ring_1 poly)" and n::nat shows "degree (∑x∷nat | x ≤ n . monom (coeff

How to define functions with overlapping patterns?

烂漫一生 提交于 2019-12-23 04:29:18
问题 I'm trying to define a conjunction function for 4-valued logic (false, true, null, and error): datatype 'a maybe = Just "'a" | Nothing | Error type_synonym bool4 = "bool maybe" abbreviation JF :: "bool4" where "JF ≡ Just False" abbreviation JT :: "bool4" where "JT ≡ Just True" abbreviation BN :: "bool4" where "BN ≡ Nothing" abbreviation BE :: "bool4" where "BE ≡ Error" fun and4 :: "bool4 ⇒ bool4 ⇒ bool4" where "and4 JF b = JF" | "and4 a JF = JF" | "and4 BE b = BE" | "and4 a BE = BE" | "and4

Isabelle: difference between A * 1 and A ** mat 1

北城以北 提交于 2019-12-23 03:57:10
问题 What is the difference between * and ** for matrices and also A * 1 and A ** mat 1`? Example: lemma myexample: fixes A :: "('a::comm_ring_1)^'n∷finite^'n∷finite" shows "(A * 1 = A) ∧ (A ** (mat 1) = A)" by (metis comm_semiring_1_class.normalizing_semiring_rules(12) matrix_mul_rid) 回答1: Matrices in Isabelle are defined simply as vectors of vectors, so the * on matrices is inherited from vectors, and * on vectors is just componentwise multiplication. Therefore, you have (A*B) $ i $ j = A $ i $

Isabelle matrix arithmetic: det_linear_row_setsum in library with different notation

五迷三道 提交于 2019-12-23 02:16:13
问题 I recently started using the Isabelle theorem prover. As I want to prove another lemma, I would like to use a different notation than the one used in the lemma "det_linear_row_setsum", which can be found in the HOL library. More specifically, I would like to use the "χ i j notation" instead of "χ i". I have been trying to formulate an equivalent expression for some time, but couldn't figure it out yet. (* ORIGINAL lemma from library *) (* from HOL/Multivariate_Analysis/Determinants.thy *)

How to use persistent heap images to make loading of theories faster in Isabelle/jEdit?

白昼怎懂夜的黑 提交于 2019-12-22 10:29:46
问题 Let's assume I have a directory isabelle_afp where a lot of theories are stored. This directory is a library and I do not plan to change the files in it. I want to speed up the start-up time of Isabelle/jEdit (by default, all theories in isabelle_afp my current theory depends on are processed anew). How can I skip this step? The system manual tells me to build a persistent heap image . What is the easiest way to do so? And how can I tell Isabelle/jEdit to load this heap image? 回答1: Isabelle

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

二次信任 提交于 2019-12-22 09:26:55
问题 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

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

旧城冷巷雨未停 提交于 2019-12-22 06:06:22
问题 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