Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
isabelle_contrib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Frédéric Tuong
isabelle_contrib
Commits
24139bc7
Commit
24139bc7
authored
5 years ago
by
Frédéric Tuong
Browse files
Options
Downloads
Patches
Plain Diff
continue the example
parent
d1190818
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
C11-BackEnds/AutoCorres_wrapper/examples/Parse_for_loop.thy
+22
-14
22 additions, 14 deletions
C11-BackEnds/AutoCorres_wrapper/examples/Parse_for_loop.thy
with
22 additions
and
14 deletions
C11-BackEnds/AutoCorres_wrapper/examples/Parse_for_loop.thy
+
22
−
14
View file @
24139bc7
...
...
@@ -61,8 +61,8 @@ text \<open>The invocation of AutoCorres:\<close>
declare
[[
AutoCorres
]]
text
\<open>
Setup
of
AutoCorres
for
semantically
representing
this
C
element
:
\<close>
declare_autocorres
parse_for_loop
[
ts_rules
=
nondet
,
unsigned_word_abs
=
f
g
h
f2
]
declare_autocorres
parse_for_loop
[
ts_rules
=
nondet
,
unsigned_word_abs
=
g
]
(*
C\<open>
/*
* Copyright 2014, NICTA
...
...
@@ -86,18 +86,25 @@ int *f(int *i, int c)
i[0]++;
return i;
}
\<close>
*)
setup
\<open>
C_Module
.
C_Term
.
map_expression
(
fn
_
=
>
fn
_
=
>
fn
_
=
>
@
{
term
"1 :: nat"
}
)
\<close>
C
\<open>
int
g
(
int
c
)
{
for
(
unsigned
int
j
=
10;
0
<
j;
j
--)
//*
+
@
INVARIANT
\<open>
0
<
\<^C>\<^sub>e\<^sub>x\<^sub>p\<^sub>r\<open>j\<close>
\<and>
\<^C>\<^sub>e\<^sub>x\<^sub>p\<^sub>r\<open>j\<close>
\<le>
10\<close>
//*
+
@
highlight
{
c
=
c
+
j;
}
return
c;
}
\<close>
int
g
(
int
c
)
{
/**
+
@
INVARIANT
:
"
\<lbrace>
0 <=
\<acute>
j
\<and>
\<acute>
j <= 10
\<rbrace>
"
+
@
highlight
*/
for
(
unsigned
int
j
=
10;
0
<
j;
j
--)
//
This
is
where
the
above
invariant
gets
ultimately
attached
:
/**
INVARIANT
:
"
\<lbrace>
0 <=
\<acute>
j
\<and>
\<acute>
j <= 10
\<rbrace>
"
*/
{
c
=
c
+
j;
}
return
c;
}
(*
C \<open>
int h(int c)
{
...
...
@@ -115,6 +122,7 @@ int f2(int *a)
}
\<close>
*)
find_theorems
name
:
"parse_for_loop"
...
...
@@ -135,7 +143,7 @@ lemma
Guard DontReach {} SKIP
CATCH SKIP
END"
by
(
simp
add
:
assms
parse_for_loop_global_addresses
.
g_body_def
)
oops
text
\<open>
During
the
initialization
phases
of
\<^theory_text>\<open>autocorres\<close>
,
the
invariant
information
of
\<^term>\<open>parse_for_loop_global_addresses.g_body\<close>
gets
lost
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment