Skip to content

Commit

Permalink
Add missing definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Anatolay committed Jan 23, 2024
1 parent fac9c8a commit 900ec60
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions Minimal/Calculus.lean
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ inductive IsAttached : { lst : List Attr } β†’ Attr β†’ Term β†’ AttrList lst
β†’ IsAttached a t l
β†’ IsAttached a t (AttrList.cons b not_in u l)

def isAttachedIsIn
{ lst : List Attr }
{ a : Attr }
{ t : Term }
{ l : AttrList lst }
: IsAttached a t l
β†’ a ∈ lst
| @IsAttached.zeroth_attached lst' _ _ _ _ => List.Mem.head lst'
| IsAttached.next_attached _ _ _ b _ _ _ isAttached' => List.Mem.tail b (isAttachedIsIn isAttached')

namespace Insert

def insertAttachedStep
Expand Down Expand Up @@ -231,7 +241,17 @@ namespace Insert
(a : Attr)
(t t' : Term)
: insert (insert l a (attached t')) a (attached t) = insert l a (attached t)
:= sorry
:= match lst with
| [] => match l with
| AttrList.nil => by simp [insert]
| b :: bs => match l with
| AttrList.cons _ not_in _ tail => dite (a = b)
(Ξ» eq => by simp [insert, eq])
(Ξ» neq =>
let neq' : b β‰  a := Ξ» eq => neq eq.symm
by simp [insert, neq']
exact insertTwice tail a t t'
)

def insert_new_isAttached
{ lst : List Attr }
Expand Down Expand Up @@ -450,6 +470,17 @@ def clos_trans { t t' t'' : Term } : (t ⇝* t') β†’ (t' ⇝* t'') β†’ (t ⇝* t
| RedMany.nil, reds => reds
| RedMany.cons lm mn_many, reds => RedMany.cons lm (clos_trans mn_many reds)

def notEqByMem
{ lst : List Attr }
{ a b : Attr }
(a_is_in : a ∈ lst)
(b_not_in : b βˆ‰ lst)
: a β‰  b
:= Ξ» eq =>
let memEq : List.Mem a lst = List.Mem b lst :=
congrArg (Ξ» x => Membership.mem x lst) eq
b_not_in (Eq.mp memEq a_is_in)

def mapRedManyObj
{ lst : List Attr}
(a : Attr)
Expand All @@ -463,12 +494,14 @@ def mapRedManyObj
| RedMany.cons (@congOBJ t t' c _ _ red_tt' isAttached) reds =>
have one_step : (obj (AttrList.cons a not_in_a u_a l1) ⇝
obj (AttrList.cons a not_in_a u_a (insert l1 c (attached t')))) := by
have neq_c_a : c β‰  a := sorry
have c_is_in := isAttachedIsIn isAttached
have a_not_in := not_in_a
have neq_c_a : c β‰  a := notEqByMem c_is_in a_not_in
have intermediate := congOBJ c (AttrList.cons a not_in_a u_a l1) red_tt'
(IsAttached.next_attached c _ _ _ neq_c_a _ _ isAttached)
simp [insert, neq_c_a.symm] at intermediate
assumption
(RedMany.cons (one_step) (mapRedManyObj _ _ reds))
(RedMany.cons one_step (mapRedManyObj _ _ reds))

def congOBJClos
{ t t' : Term }
Expand Down

0 comments on commit 900ec60

Please sign in to comment.