-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathCom.lean
39 lines (30 loc) · 1.02 KB
/
Com.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/-
Copyright (c) 2022 Jannis Limperg. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jannis Limperg
-/
import Aesop
set_option aesop.check.all false
-- With this option, the test becomes unbearably slow.
abbrev State := String → Int
inductive Com where
| Skip : Com
| Seq : Com → Com → Com
declare_syntax_cat com
syntax "SKIP" : com
syntax com ";" com : com
syntax "(" com ")" : com
syntax term : com
syntax "[Com|" com "]" : term
macro_rules
| `([Com| SKIP]) => `(Com.Skip)
| `([Com| $x ; $y]) => `(Com.Seq [Com| $x] [Com| $y])
| `([Com| ( $x:com )]) => `([Com| $x])
| `([Com| $x:term ]) => `($x)
@[aesop safe [constructors, -100 cases (index := [hyp BigStep Com.Skip _ _, hyp BigStep [Com| _;_] _ _])]]
inductive BigStep : Com → State → State → Prop where
| Skip : BigStep Com.Skip s s
| Seq (h1 : BigStep c₁ s t) (h2 : BigStep c₂ t u) : BigStep [Com| c₁;c₂] s u
theorem seq_assoc :
BigStep [Com| (c1;c2);c3] s s' ↔ BigStep [Com| c1;c2;c3] s s' := by
aesop