Skip to content

Commit ffc8688

Browse files
authored
Merge pull request #9 from gauravpartha/int_to_real_conversion
add support for integer to real conversion
2 parents 4667c53 + 649486b commit ffc8688

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
- name: Download and install Isabelle
2121
run: |
22-
wget --quiet https://isabelle.in.tum.de/dist/Isabelle2022_linux.tar.gz
22+
wget --quiet https://isabelle.in.tum.de/website-Isabelle2022/dist/Isabelle2022_linux.tar.gz
2323
tar -xf Isabelle2022_linux.tar.gz
2424
rm Isabelle2022_linux.tar.gz
2525
mv Isabelle2022 isabelle_dir

BoogieLang/Lang.thy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type_synonym pname = string (* procedure name *)
1111
datatype lit = LBool bool | LInt int | LReal real
1212

1313
datatype binop = Eq | Neq | Add | Sub | Mul | Div | RealDiv | Mod | Lt | Le | Gt | Ge | And | Or | Imp | Iff
14-
datatype unop = Not | UMinus
14+
datatype unop = Not | UMinus | IntToReal
1515

1616
datatype prim_ty
1717
= TBool | TInt | TReal

BoogieLang/PassificationML.thy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
theory PassificationML
2-
imports Boogie_Lang.Semantics HelperML Passification
2+
imports Semantics HelperML Passification
33
begin
44

55
ML \<open>

BoogieLang/Semantics.thy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,16 @@ fun unop_minus :: "lit \<rightharpoonup> lit"
367367
| "unop_minus (LReal r) = Some (LReal (-r))"
368368
| "unop_minus _ = None"
369369

370+
fun unop_int_to_real :: "lit \<rightharpoonup> lit"
371+
where
372+
"unop_int_to_real (LInt i) = Some (LReal (real_of_int i))"
373+
| "unop_int_to_real _ = None"
374+
370375
fun unop_eval :: "unop \<Rightarrow> lit \<rightharpoonup> lit"
371376
where
372377
"unop_eval Not v = unop_not v"
373378
| "unop_eval UMinus v = unop_minus v"
379+
| "unop_eval IntToReal v = unop_int_to_real v"
374380

375381
fun unop_eval_val :: "unop \<Rightarrow> 'a val \<rightharpoonup> 'a val"
376382
where

BoogieLang/Typing.thy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ fun unop_type :: "unop \<Rightarrow> prim_ty \<Rightarrow> prim_ty option"
1616
| "unop_type Not TInt = None"
1717
| "unop_type Not TReal = None"
1818
| "unop_type Not TBool = Some TBool"
19+
| "unop_type IntToReal TInt = Some TReal"
20+
| "unop_type IntToReal TReal = None"
21+
| "unop_type IntToReal TBool = None"
1922

2023
primrec binop_type :: "binop \<Rightarrow> ((prim_ty \<times> prim_ty) set \<times> prim_ty) option"
2124
where

0 commit comments

Comments
 (0)