Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
83dc576
cosmetic changes to docs.; minor cosmetic change in isarare_config.pr…
Mallku2 Oct 1, 2025
0f8da5c
minor updates in ROOT
Mallku2 Oct 6, 2025
56fd197
Merge remote-tracking branch 'upstream'
Mallku2 Oct 7, 2025
47c7e8b
Merge remote-tracking branch 'upstream'
Mallku2 Oct 9, 2025
395af22
adding tests for RareAsEunoia
Mallku2 Oct 13, 2025
251fd4e
fixes in parser to make it able to parse eunoia rules that include pr…
Mallku2 Oct 14, 2025
eb51d9b
removing fixes in docs
Mallku2 Oct 14, 2025
82acee0
removing fixes in docs
Mallku2 Oct 14, 2025
bb34694
removing fixes in docs
Mallku2 Oct 14, 2025
473ca5f
Merge remote-tracking branch 'upstream'
Mallku2 Oct 14, 2025
9a65707
merging with upstream main
Mallku2 Oct 15, 2025
845595a
progress in parsing and generating lemmas for eunoia rules with premises
Mallku2 Oct 15, 2025
59edb87
removing missing singleton_elim occurrences in tests
Mallku2 Oct 16, 2025
ae207f4
Merge branch 'main' into parser_rare_as_eunoia
Mallku2 Oct 16, 2025
1a69618
minor fix in rule in level3_rewrites
Mallku2 Oct 16, 2025
6e415c1
support more operators
Lachnitt Oct 17, 2025
94fb02a
relocating tests with eo::define
Mallku2 Oct 17, 2025
337d5af
minor fix to the printing of sorts
Mallku2 Oct 17, 2025
cd23fbd
minor fix in shallow embedding of abs
Mallku2 Oct 17, 2025
79a1310
adding support to BitVec in Eunoia
Mallku2 Oct 17, 2025
b30cf26
Merge remote-tracking branch 'upstream'
Mallku2 Nov 3, 2025
4828bb9
Merge branch 'main' into parser_rare_as_eunoia
Mallku2 Nov 3, 2025
4e9648a
renaming rare 2.0 tests folder
Mallku2 Nov 3, 2025
2b73320
polishing benchmarks of rewrites
Mallku2 Nov 4, 2025
ee94861
level1 rewrites: removing remaining rules that require subtyping
Mallku2 Nov 4, 2025
af78f6f
minor improvement to better deal with Type variables
Mallku2 Nov 11, 2025
a30f60b
Merge remote-tracking branch 'upstream'
Mallku2 Nov 20, 2025
fa45101
fixing merge issues with main branch
Mallku2 Nov 20, 2025
621696e
finishing adding better support to Type variables
Mallku2 Nov 25, 2025
ba532f0
merging with upstream main
Mallku2 Nov 25, 2025
e8226ed
removing debugging prints, added some minor docs
Mallku2 Nov 25, 2025
540ada6
replacing different occurrences of (curry (op =) c) by a single function
Mallku2 Nov 25, 2025
b61f72e
minor fixes following PR review
Mallku2 Dec 25, 2025
e510008
minor fixes following PR review
Mallku2 Dec 25, 2025
79a6f49
Merge remote-tracking branch 'upstream' into support_for_type_variables
Mallku2 Jan 26, 2026
032fec1
abstract_type_parser: adding some docs
Mallku2 Jan 26, 2026
ce8122b
merging with parse_rare_as_eunoia
Mallku2 Jan 26, 2026
a9cdac9
merging with parse_rare_as_eunoia
Mallku2 Jan 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion IsaRARE.thy
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ val _ = Outer_Syntax.local_theory \<^command_keyword>\<open>parse_rare_file\<cl

declare[[IsaRARE_debug=false]]


(*parse_rare_file "~/Downloads/int2.smt2" "HOL.Real" "TestKey2"*)


Expand Down Expand Up @@ -279,6 +278,8 @@ parse_rare_file "Tests/level2a_rewrites" "HOL.Real" "Level2a_Rewrites"
parse_rare_file "Tests/level2b_rewrites" "HOL.Real" "Level2b_Rewrites"
parse_rare_file "Tests/level2_rewrites" "HOL.Real" "Level2_Rewrites"
parse_rare_file "Tests/level3a_rewrites" "HOL.Real" "Level3a_Rewrites"
parse_rare_file "Tests/level3b_rewrites" "HOL.Real" "Level3b_Rewrites"
parse_rare_file "Tests/level3c_rewrites" "HOL.Real" "Level3c_Rewrites"



Expand Down
360 changes: 360 additions & 0 deletions Tests/RareAsEunoiaTests/level0_rewrites.eo
Original file line number Diff line number Diff line change
@@ -0,0 +1,360 @@
;;;;;;;;;;;;;;;;;
;; Arith
;;;;;;;;;;;;;;;;;

(declare-rule arith-int-div-total ((t1 Int) (s1 Int))
:premises ((= (= s1 0) false))
:args (t1 s1)
:conclusion (= (div t1 s1) (div_total t1 s1))
)
(declare-rule arith-int-div-total-one ((t1 Int))
:args (t1)
:conclusion (= (div_total t1 1) t1)
)
(declare-rule arith-int-div-total-zero ((t1 Int))
:args (t1)
:conclusion (= (div_total t1 0) 0)
)
(declare-rule arith-int-div-total-neg ((t1 Int) (s1 Int))
:premises ((= (< s1 0) true))
:args (t1 s1)
:conclusion (= (div_total t1 s1) (- (div_total t1 (- s1))))
)
(declare-rule arith-int-mod-total ((t1 Int) (s1 Int))
:premises ((= (= s1 0) false))
:args (t1 s1)
:conclusion (= (mod t1 s1) (mod_total t1 s1))
)
(declare-rule arith-int-mod-total-one ((t1 Int))
:args (t1)
:conclusion (= (mod_total t1 1) 0)
)
(declare-rule arith-int-mod-total-zero ((t1 Int))
:args (t1)
:conclusion (= (mod_total t1 0) t1)
)
(declare-rule arith-int-mod-total-neg ((t1 Int) (s1 Int))
:premises ((= (< s1 0) true))
:args (t1 s1)
:conclusion (= (mod_total t1 s1) (mod_total t1 (- s1)))
)
(declare-rule arith-elim-int-gt ((t1 Int) (s1 Int))
:args (t1 s1)
:conclusion (= (> t1 s1) (>= t1 (+ s1 1)))
)
(declare-rule arith-elim-int-lt ((t1 Int) (s1 Int))
:args (t1 s1)
:conclusion (= (< t1 s1) (>= s1 (+ t1 1)))
)
(declare-rule arith-leq-norm ((t1 Int) (s1 Int))
:args (t1 s1)
:conclusion (= (<= t1 s1) (not (>= t1 (+ s1 1))))
)
(declare-rule arith-geq-tighten ((t1 Int) (s1 Int))
:args (t1 s1)
:conclusion (= (not (>= t1 s1)) (>= s1 (+ t1 1)))
)
(declare-rule arith-geq-norm1-int ((t1 Int) (s1 Int))
:args (t1 s1)
:conclusion (= (>= t1 s1) (>= (- t1 s1) 0))
)
(declare-rule arith-geq-norm1-real ((t1 Real) (s1 Real))
:args (t1 s1)
:conclusion (= (>= t1 s1) (>= (- t1 s1) 0/1))
)
(declare-rule arith-eq-elim-real ((t1 Real) (s1 Real))
:args (t1 s1)
:conclusion (= (= t1 s1) (and (>= t1 s1) (<= t1 s1)))
)
(declare-rule arith-eq-elim-int ((t1 Int) (s1 Int))
:args (t1 s1)
:conclusion (= (= t1 s1) (and (>= t1 s1) (<= t1 s1)))
)
(declare-rule arith-int-eq-conflict ((t1 Int) (c1 Real))
:premises ((= (= (to_real (to_int c1)) c1) false))
:args (t1 c1)
:conclusion (= (= (to_real t1) c1) false)
)
(declare-rule arith-int-geq-tighten ((t1 Int) (c1 Real) (cc1 Int))
:premises ((= (= (to_real (to_int c1)) c1) false) (= cc1 (+ (to_int c1) 1)))
:args (t1 c1 cc1)
:conclusion (= (>= (to_real t1) c1) (>= t1 cc1))
)
(declare-rule arith-divisible-elim ((n1 Int) (t1 Int))
:premises ((= (= n1 0) false))
:args (n1 t1)
:conclusion (= (divisible n1 t1) (= (mod_total t1 n1) 0))
)

;;;;;;;;;;;;;;;;;
;; Boolean
;;;;;;;;;;;;;;;;;

(declare-rule bool-double-not-elim ((t1 Bool))
:args (t1)
:conclusion (= (not (not t1)) t1)
)
(declare-rule bool-not-true ((t1 Bool))
:premises ((= t1 false))
:args (t1)
:conclusion (= (not t1) true)
)
(declare-rule bool-not-false ((t1 Bool))
:premises ((= t1 true))
:args (t1)
:conclusion (= (not t1) false)
)
(declare-rule bool-eq-true ((t1 Bool))
:args (t1)
:conclusion (= (= t1 true) t1)
)
(declare-rule bool-eq-false ((t1 Bool))
:args (t1)
:conclusion (= (= t1 false) (not t1))
)
(declare-rule bool-eq-nrefl ((x1 Bool))
:args (x1)
:conclusion (= (= x1 (not x1)) false)
)
(declare-rule bool-impl-false1 ((t1 Bool))
:args (t1)
:conclusion (= (=> t1 false) (not t1))
)
(declare-rule bool-impl-false2 ((t1 Bool))
:args (t1)
:conclusion (= (=> false t1) true)
)
(declare-rule bool-impl-true1 ((t1 Bool))
:args (t1)
:conclusion (= (=> t1 true) true)
)
(declare-rule bool-impl-true2 ((t1 Bool))
:args (t1)
:conclusion (= (=> true t1) t1)
)
(declare-rule bool-impl-elim ((t1 Bool) (s1 Bool))
:args (t1 s1)
:conclusion (= (=> t1 s1) (or (not t1) s1))
)
(declare-rule bool-dual-impl-eq ((t1 Bool) (s1 Bool))
:args (t1 s1)
:conclusion (= (and (=> t1 s1) (=> s1 t1)) (= t1 s1))
)
(declare-rule bool-implies-de-morgan ((x1 Bool) (y1 Bool))
:args (x1 y1)
:conclusion (= (not (=> x1 y1)) (and x1 (not y1)))
)
(declare-rule bool-xor-refl ((x1 Bool))
:args (x1)
:conclusion (= (xor x1 x1) false)
)
(declare-rule bool-xor-nrefl ((x1 Bool))
:args (x1)
:conclusion (= (xor x1 (not x1)) true)
)
(declare-rule bool-xor-false ((x1 Bool))
:args (x1)
:conclusion (= (xor x1 false) x1)
)
(declare-rule bool-xor-true ((x1 Bool))
:args (x1)
:conclusion (= (xor x1 true) (not x1))
)
(declare-rule bool-xor-comm ((x1 Bool) (y1 Bool))
:args (x1 y1)
:conclusion (= (xor x1 y1) (xor y1 x1))
)
(declare-rule bool-xor-elim ((x1 Bool) (y1 Bool))
:args (x1 y1)
:conclusion (= (xor x1 y1) (= (not x1) y1))
)
(declare-rule bool-not-xor-elim ((x1 Bool) (y1 Bool))
:args (x1 y1)
:conclusion (= (not (xor x1 y1)) (= x1 y1))
)
(declare-rule bool-not-eq-elim1 ((x1 Bool) (y1 Bool))
:args (x1 y1)
:conclusion (= (not (= x1 y1)) (= (not x1) y1))
)
(declare-rule bool-not-eq-elim2 ((x1 Bool) (y1 Bool))
:args (x1 y1)
:conclusion (= (not (= x1 y1)) (= x1 (not y1)))
)

;;;;;;;;;;;;;;;;;
;; Ite
;;;;;;;;;;;;;;;;;

(declare-rule ite-neg-branch ((c1 Bool) (x1 Bool) (y1 Bool))
:premises ((= (not y1) x1))
:args (c1 x1 y1)
:conclusion (= (ite c1 x1 y1) (= c1 x1))
)
(declare-rule ite-then-true ((c1 Bool) (x1 Bool))
:args (c1 x1)
:conclusion (= (ite c1 true x1) (or c1 x1))
)
(declare-rule ite-else-false ((c1 Bool) (x1 Bool))
:args (c1 x1)
:conclusion (= (ite c1 x1 false) (and c1 x1))
)
(declare-rule ite-then-false ((c1 Bool) (x1 Bool))
:args (c1 x1)
:conclusion (= (ite c1 false x1) (and (not c1) x1))
)
(declare-rule ite-else-true ((c1 Bool) (x1 Bool))
:args (c1 x1)
:conclusion (= (ite c1 x1 true) (or (not c1) x1))
)
(declare-rule ite-then-lookahead-self ((c1 Bool) (x1 Bool))
:args (c1 x1)
:conclusion (= (ite c1 c1 x1) (ite c1 true x1))
)
(declare-rule ite-else-lookahead-self ((c1 Bool) (x1 Bool))
:args (c1 x1)
:conclusion (= (ite c1 x1 c1) (ite c1 x1 false))
)
(declare-rule ite-then-lookahead-not-self ((c1 Bool) (x1 Bool))
:args (c1 x1)
:conclusion (= (ite c1 (not c1) x1) (ite c1 false x1))
)
(declare-rule ite-else-lookahead-not-self ((c1 Bool) (x1 Bool))
:args (c1 x1)
:conclusion (= (ite c1 x1 (not c1)) (ite c1 x1 true))
)
(declare-rule ite-expand ((c1 Bool) (x1 Bool) (y1 Bool))
:args (c1 x1 y1)
:conclusion (= (ite c1 x1 y1) (and (or (not c1) x1) (or c1 y1)))
)
(declare-rule bool-not-ite-elim ((c1 Bool) (x1 Bool) (y1 Bool))
:args (c1 x1 y1)
:conclusion (= (not (ite c1 x1 y1)) (ite c1 (not x1) (not y1)))
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Strings and regular expressions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(declare-rule str-eq-len-false ((x1 String) (y1 String))
:premises ((= (= (str.len x1) (str.len y1)) false))
:args (x1 y1)
:conclusion (= (= x1 y1) false)
)
(declare-rule str-indexof-re-none ((t1 String) (n1 Int))
:args (t1 n1)
:conclusion (= (str.indexof_re t1 re.none n1) -1)
)
(declare-rule str-indexof-re-emp-re ((t1 String) (r1 RegLan) (n1 Int))
:premises ((= (str.in_re "" r1) true) (= (>= (str.len t1) n1) true))
:args (t1 r1 n1)
:conclusion (= (str.indexof_re t1 r1 n1) n1)
)
(declare-rule str-to-lower-upper ((s1 String))
:args (s1)
:conclusion (= (str.to_lower (str.to_upper s1)) (str.to_lower s1))
)
(declare-rule str-to-upper-lower ((s1 String))
:args (s1)
:conclusion (= (str.to_upper (str.to_lower s1)) (str.to_upper s1))
)
(declare-rule str-to-lower-len ((s1 String))
:args (s1)
:conclusion (= (str.len (str.to_lower s1)) (str.len s1))
)
(declare-rule str-to-upper-len ((s1 String))
:args (s1)
:conclusion (= (str.len (str.to_upper s1)) (str.len s1))
)
(declare-rule str-to-lower-from-int ((n1 Int))
:args (n1)
:conclusion (= (str.to_lower (str.from_int n1)) (str.from_int n1))
)
(declare-rule str-to-upper-from-int ((n1 Int))
:args (n1)
:conclusion (= (str.to_upper (str.from_int n1)) (str.from_int n1))
)
(declare-rule str-leq-empty ((s1 String))
:args (s1)
:conclusion (= (str.<= "" s1) true)
)
(declare-rule str-leq-empty-eq ((s1 String))
:args (s1)
:conclusion (= (str.<= s1 "") (= s1 ""))
)
(declare-rule str-lt-elim ((s1 String) (t1 String))
:args (s1 t1)
:conclusion (= (str.< s1 t1) (and (not (= s1 t1)) (str.<= s1 t1)))
)
(declare-rule str-from-int-no-ctn-nondigit ((n1 Int) (s1 String))
:premises ((= (= s1 "") false) (= (str.to_int s1) -1))
:args (n1 s1)
:conclusion (= (str.contains (str.from_int n1) s1) false)
)
(declare-rule re-all-elim ()
:args ()
:conclusion (= re.all (re.* re.allchar))
)
(declare-rule re-opt-elim ((x1 RegLan))
:args (x1)
:conclusion (= (re.opt x1) (re.union (str.to_re "") x1))
)
(declare-rule re-diff-elim ((x1 RegLan) (y1 RegLan))
:args (x1 y1)
:conclusion (= (re.diff x1 y1) (re.inter x1 (re.comp y1)))
)
(declare-rule re-plus-elim ((x1 RegLan))
:args (x1)
:conclusion (= (re.+ x1) (re.++ x1 (re.* x1)))
)
(declare-rule re-repeat-elim ((n1 Int) (x1 RegLan))
:args (n1 x1)
:conclusion (= (re.^ n1 x1) (re.loop n1 n1 x1))
)
(declare-rule re-union-const-elim ((r1 RegLan) (s1 String))
:premises ((= (str.in_re s1 r1) true))
:args (r1 s1)
:conclusion (= (re.union (str.to_re s1) r1) r1)
)
(declare-rule re-star-none ()
:args ()
:conclusion (= (re.* re.none) (str.to_re ""))
)
(declare-rule re-star-emp ()
:args ()
:conclusion (= (re.* (str.to_re "")) (str.to_re ""))
)
(declare-rule re-star-star ((x1 RegLan))
:args (x1)
:conclusion (= (re.* (re.* x1)) (re.* x1))
)
(declare-rule re-loop-neg ((n1 Int) (m1 Int) (r1 RegLan))
:premises ((= (> n1 m1) true))
:args (n1 m1 r1)
:conclusion (= (re.loop n1 m1 r1) re.none)
)
(declare-rule re-in-empty ((t1 String))
:args (t1)
:conclusion (= (str.in_re t1 re.none) false)
)
(declare-rule re-in-sigma ((t1 String))
:args (t1)
:conclusion (= (str.in_re t1 re.allchar) (= (str.len t1) 1))
)
(declare-rule re-in-sigma-star ((t1 String))
:args (t1)
:conclusion (= (str.in_re t1 (re.* re.allchar)) true)
)
(declare-rule re-in-cstring ((t1 String) (s1 String))
:args (t1 s1)
:conclusion (= (str.in_re t1 (str.to_re s1)) (= t1 s1))
)
(declare-rule re-in-comp ((t1 String) (r1 RegLan))
:args (t1 r1)
:conclusion (= (str.in_re t1 (re.comp r1)) (not (str.in_re t1 r1)))
)

(declare-rule str-in-re-from-int-dig-range ((n1 Int))
:args (n1)
:conclusion (= (str.in_re (str.from_int n1) (re.* (re.range "0" "9"))) true)
)
Loading