isabelle | Instruction Set Architecture Description Format | Architecture library
kandi X-RAY | isabelle Summary
kandi X-RAY | isabelle Summary
Instruction Set Architecture Description Format.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Generates the source
- Indent a string
- Generates a condition
- Generate switch statement
- Return an astroid Function node as string
- Extract the bits that match pattern
- Generate extract bits
- Return an astroid If node as string
- Indent a string
- Generate the ExtractBits
- Extract bits from an ARM instruction
- Generates the function code
- Convert a function tomedian
- Return an astroid Bitfield node as string
- Get the size of a field
- Return an astroid Block node as string
- Return an AST node
- Generates the ARM header
- Generates an extract bit
- Verify an instruction
isabelle Key Features
isabelle Examples and Code Snippets
Community Discussions
Trending Discussions on isabelle
QUESTION
I've been working with Isabelle/HOL for a few months now, but I've been unable to figure out the exact intention of the use of _tac.
Specifically, I'm talking about cases vs case_tac and induct vs indut_tac (although it would be nice to know the meaning of tac in general, since I'm also using other methods such as cut_tac).
I've noticed I can't use cases or induct using apply with ⋀-bound variables, but I can if it's an structured proof. Why?
An example of this:
...ANSWER
Answered 2021-Jun-06 at 01:13*_tac
are built-in tactics used in apply
-scripts. In particular, case_tac
and induct_tac
have been basically superseded by the cases
and induction
proof methods in Isabelle/Isar. As you mentioned, case_tac
and induct_tac
can handle ⋀-bound variables. However, this is quite fragile, since their names are often generated automatically and may change when Isabelle changes (of course, you could use rename_tac
to choose fixed names). That's one of the reasons why nowadays structured proof methods are preferred to unstructured tactic scripts. Now, back to your example: In order to be able to use cases
, you can introduce a structured block as follows:
QUESTION
I have following simple Isabelle/HOL theory:
...ANSWER
Answered 2021-May-28 at 06:13nat set
is interpreted as a function (that does not type correctly). The set of natural numbers can be expressed as UNIV :: nat set
. Then, spec_2
reads
QUESTION
There are meta symbols for implication and universal quantification in Isabelle/Pure (⟹
and ⋀
), which behave differently from its HOL counterparts (∀ and →).
Is there a meta symbol for existential quantification? If not, is there a specific reason for this decision?
...ANSWER
Answered 2021-May-15 at 04:57Pure is based on intuistionistic logic and there is no existential quantifier in this logic.
The rough equivalent is obtains
:
QUESTION
When I have a lot of assumptions, sometimes I end up with a lot of temporary names that clutter the proof.
I'm talking about things like this:
...ANSWER
Answered 2021-May-12 at 21:41If all you want are the last assumptions that you made (and not all of them), you can simulate the effect presented by using a name convention (e.g. assumptions
or assmps
) and bundling the assumptions together (i.e using ""..." "..." "..."
" instead of ""..." and "..." and "..."
"):
QUESTION
I have theory file Test_Func.thy which I have copied in Isabelle src/HOL and which defines function add_123:
...ANSWER
Answered 2021-May-06 at 06:33There is no need to put theory files into the Isabelle distribution (on the contrary, I'd better keep it intact to make sure your development can be used on other machines without touching Isabelle installation).
The issue with the failing proof lies in a different area: the definition of add_123
is inductive on the first argument and has no immediate rule how to handle the expression specified in lemma_02
. (E.g., lemma add_01: "add_123 0 m = m"
could be proved the way you used because it matches the first case specified in the definition.)
The solution is to use a proof by induction on the first argument:
QUESTION
While reading this answer on quotient types, I stumbled upon the construct "case _ of _ ⇒ _
". Upon checking the manual, there's no such definition, but there are separate definitions for "case _
" (§6.5.1) and "of _
" (§6.4.3). Nonetheless, reading these definitions only confused me more about the meaning of this construct.
Consequently, I decided to come up with a simpler version of the lemma that I might be able to prove, which was this one:
...ANSWER
Answered 2021-Apr-25 at 13:22In Isabelle, a statement of the type case _ of _ ⇒ _ | _ ⇒ _ | _ ⇒ _ | ...
is a form of pattern matching.
You might want to take a look at §2.5.4 of Isabelle's tutorial (§2.5.5 and §2.5.6 are also useful). This question on pattern matching and the Wikipedia article may provide more information about pattern matching in general.
What you are missing is that there not guarantee that the patterns are exhaustive. If no pattern matches, the result is undefined
.
Nitpick actually finds a counter-example automatically on your lemma:
QUESTION
Is it possible to write a recursive lambda expression in Isabelle/HOL? If so, how?
For example (a silly one):
...ANSWER
Answered 2021-Apr-25 at 04:59There is only one case where such things are necessary: when defining a function in a proof. I have done so, but this is far from beginner friendly, because you have to derive the simp rules by hand.
The solution is to mimic what fun
is doing internally and expressing your definition in terms of rec_nat
:
QUESTION
I am trying to prove the following basic theorem about the existence of the inverse function of a bijective function (to learn theorem-proving with Isabelle/HOL):
For any set S and its identity map 1_S, α:S→T is bijective iff there exists a map β: T→S such that βα=1_S and αβ=1_S.
Below is what I have so far after some attempts to define relevant things including functions and their inverses. But I am pretty stuck and couldn't make much progress due to my lack of understanding of Isabelle and/or Isar.
...ANSWER
Answered 2021-Apr-16 at 20:22
lemma bij_iff_ex_identity : "bij_betw f A B ⟷ (∃ g. g∘f = restrict id B ∧ f∘g = restrict id A)"
I think this is not exactly what you want an I am doubtful that it is true. g∘f = restrict id B
does not mean that g∘f
and id
are equal on B
. It means that the total function g∘f
(and there are only total functions in HOL) equals the total function restrict id B
. The latter returns id x
on x∈B
and undefined
otherwise. So to make this equality true, g
needs to output undefined
whenever the input of f
is not in B
. But how would g
know that!
If you want to use restrict
, you could write restrict (g∘f) B = restrict id B
. But personally, I would rather go for the simpler (∀x∈B. (g∘f) x = x)
.
So the corrected theorem would be:
lemma bij_iff_ex_identity : "bij_betw f A B ⟷ (∃ g. (∀x∈A. (g∘f) x = x) ∧ (∀y∈B. (f∘g) y = y))"
(Which is still wrong, by the way, as quickcheck tells me in Isabelle/jEdit, see the output window. If A
has one element and B
is empty, f
cannot be a bijection. So the theorem you are attempting is actually mathematically not true. I will not attempt to fix it, but just answer the remaining lines.
unfolding bij_betw_def inj_on_def restrict_def iffI
The iffI
here has no effect. Unfolding can only apply theorems of the form A = B
(unconditional rewriting rules). iffI
is not of that form. (Use thm iffI
to see.)
proof
Personally, I don't use the bare form proof
but always proof -
or proof (some method)
. Because proof
just applies some default method (in this case, equivalent to (rule iffI)
, so I think it's better to make it explicit. proof -
just starts the proof without applying an extra method.
let ?g = "restrict (λ y. (if f x = y then x else undefined)) B"
You have an unbound variable x
here. (Note the background color in the IDE.) That is most likely not what you want. Formally, it is allowed, but x
will be treated as if it was some arbitrary constant.
Generally, I don't think there is any way to define g
in a simple way (i.e., only with quantifiers and function applications and if-then-else). I think the only way to define an inverse (even if you know it exists), is to use the THE
operator, because you need to say something like g y
is "the" x
such that f x = y
. (And then later in the proof you will run into a proof obligation that it indeed exists and that it is unique.) See the definition of inv_into
in Hilbert_Choice.thy
(except it uses SOME
not THE
). Maybe for starters, try to do the proof just using the existing inv_into
constant.
assume "(∀x∈A. ∀y∈A. f x = f y ⟶ x = y)"
All assume
commands must have assumptions exactly as the are in the proof goal. You can test whether you wrote it right by just temporarily writing the command show A for A
(that's an unprovable goal that would, however, finish the proof, so it tricks Isabelle into checking if it would). If this command does not give an error, you got the assume
s right. In your cases, you didn't, it should be (∀x∈A. ∀y∈A. f x = f y ⟶ x = y) ∧ f ' A = B
. (' is the backtick symbol here. Markup doesn't let me write it.)
My recommendation: Try the proof with bij
instead of bij_betw
first. (One direction is in BNF_Fixpoint_Base.o_bij if you want to cheat.)
Once done, you can try to generalize.
QUESTION
I am trying to use https://github.com/dominique-unruh/scala-isabelle for parsing and decomposing the Isabelle terms and I am trying to decompose term - function declaration - from the formalization of quicksort https://isabelle.in.tum.de/library/HOL/HOL-Imperative_HOL/Imperative_Quicksort.html - this Isabelle code:
...ANSWER
Answered 2021-Apr-04 at 00:49This is answer in progress. I have came up with the code:
QUESTION
What is the correct way in Isabelle/HOL (2021) to define a function f
from a specific set A
to another set B
?
From mathematics, a function f: A -> B
is often defined as a map from its domain A
to its co-domain B
. And a function f
is defined as a special kind of relation in A × B
with only one y ∈ B that satisfies x f y
for each x ∈ A.
But in Isabelle/HOL, functions seems to be defined in terms of computation, e.g. f x = Suc x
. It seems that there is no place to define domain and co-domains explicitly.
I was just wondering if there is a conventional way to define functions in Isabelle to be with domain and co-domains and be compatible with the definition of relations above.
...ANSWER
Answered 2021-Apr-14 at 18:39Background
As you have noted, in Isabelle/HOL, conventionally, a function is a term of the type 'a⇒'b
, where 'a
and 'b
can be arbitrary types. As such, all functions in Isabelle are total. There is a blog post by Joachim Breitner that explains this very well: link. I will not restate any elements of the content of the blog post: instead, I will concentrate on the issue that you have raised in your question.
Conventional definitions of a function
I am aware of two methodologies for the definition of a function in traditional mathematics (here I use the term "traditional mathematics" to mean mathematics exposed in some set-theoretic foundation):
- According, for example, to [1,Chapter 6], a function is simply a single-valued binary relation.
- Some authors [2,Chapter 2] identify a function with its domain and codomain by definition, i.e. a function becomes a triple (A,B,r), where r⊆A×B is still a single-valued binary relation and A is exactly the domain of the relation.
You can find some further discussion here. If the function is a binary relation, then the domain and the range are normally identified with the domain and the range of the relation that the function represents. However, it makes little sense to speak about the codomain of such an entity. If the function is defined as a triple (A,B,r), then the codomain is the assigned set B.
Isabelle/HOL I: functions as relations
Isabelle/HOL already provides a definition of the concept of a single-valued relation in the theory Relation.thy
. The definition is implicit in the definition of the predicate single_valued
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install isabelle
You can use isabelle like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page