Skip to content

Commit

Permalink
More cleanup (#27)
Browse files Browse the repository at this point in the history
* this wont work

* remove some stuff

* remove stuff
  • Loading branch information
h0nzZik authored Jul 6, 2024
1 parent de73b75 commit dce78bb
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 5,481 deletions.
1 change: 0 additions & 1 deletion minuska/_CoqProject
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ theories/string_variables.v
theories/BuiltinValue.v
theories/builtins.v
theories/basic_matching.v
theories/try_match.v
theories/naive_interpreter.v
theories/interpreter_results.v
theories/default_static_model.v
Expand Down
65 changes: 65 additions & 0 deletions minuska/theories/BuiltinValue.v
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,71 @@ Section sec.
{_sc : Countable symbol}
.

(* This is an attempt at an alternative definition that avoids lowlang.
I could not figure out how to implement decision procedure for equality,
so it is left for future work.
(* TODO make parametric in a user type *)
Inductive BuiltinValue0 :=
| bv_error
| bv_bool (b : bool)
(* | bv_nat (n : nat) *)
| bv_Z (z : Z)
| bv_sym (s : symbol)
| bv_str (s : string)
| bv_list (m : list (@TermOver' symbol BuiltinValue0))
| bv_pmap (m : Pmap (@TermOver' symbol BuiltinValue0))
.
Fixpoint BVsize (r : BuiltinValue0) : nat :=
match r with
| bv_error => 1
| bv_bool _ => 1
| bv_Z _ => 1
| bv_sym _ => 1
| bv_str _ => 1
| bv_list l =>
let TermBVsize := (fix TermBVsize (t : @TermOver' symbol BuiltinValue0) : nat :=
match t with
| t_over m => S (BVsize m)
| t_term _ l => S (
(fix helper (l' : list (@TermOver' symbol BuiltinValue0)) : nat :=
match l' with
| [] => 1
| x::xs => S (TermBVsize x + helper xs)
end
)l)
end) in
S (sum_list_with TermBVsize l)
| bv_pmap PEmpty => 1
| bv_pmap (PNodes m) =>
let TermBVsize := (fix TermBVsize (t : @TermOver' symbol BuiltinValue0) : nat :=
match t with
| t_over m => S (BVsize m)
| t_term _ l => S (
(fix helper (l' : list (@TermOver' symbol BuiltinValue0)) : nat :=
match l' with
| [] => 1
| x::xs => S (TermBVsize x + helper xs)
end
)l)
end) in
S ((fix mypmsz (m' : Pmap_ne (@TermOver' symbol BuiltinValue0)) :=
match m' with
| PNode001 m'' => S (mypmsz m'')
| PNode010 m'' => S (TermBVsize m'')
| PNode011 m1 m2 => S (TermBVsize m1 + mypmsz m2)
| PNode100 m'' => mypmsz m''
| PNode101 m1 m2 => S (mypmsz m1 + mypmsz m2)
| PNode110 m1 m2 => S (mypmsz m1 + TermBVsize m2)
| PNode111 m1 m2 m3 => S (mypmsz m1 + TermBVsize m2 + mypmsz m3)
end
) m)
end
.
*)

(* TODO make parametric in a user type *)
Inductive BuiltinValue0 :=
| bv_error
Expand Down
Loading

0 comments on commit dce78bb

Please sign in to comment.