Skip to content

Commit 5c363de

Browse files
committed
added continutation constraint for the lemma
1 parent 66d69ef commit 5c363de

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

Pullback/UnquoteTy/SSA.lean

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,30 @@ def SSADo.toSSAExpr (vars : VarMap) (mutVars : VarMap) (kbreak kcontinue : Optio
405405
#check List.Nodup
406406
#check List.instHasSubset
407407

408-
theorem SSADo.toSSAExpr_wellTyped (vars : VarMap) (mutVars : VarMap) (kbreak kcontinue : Option Name) (hMut₁ : (mutVars.toList.map (·.1)).Nodup) (hMut₂ : mutVars.toList ⊆ vars.toList) (hMut₃ : ∀ mutvar ∈ mutVars.toList, ∃! var ∈ vars.toList, var.1 = mutvar.1) : (prog : SSADo) → (hp : (prog.toSSAExpr vars mutVars kbreak kcontinue).isSome) → (((prog.toSSAExpr vars mutVars kbreak kcontinue).get hp).inferType vars).isSome
409-
| .expr e => sorry
408+
-- returns domain of function type if the type is a function type
409+
def SSAType.funDom? : SSAType → Option SSAType
410+
| .fun α _ => α
411+
| _ => none
412+
413+
-- returns codomain of function type if the type is a function type
414+
def SSAType.funCodom? : SSAType → Option SSAType
415+
| .fun _ β => β
416+
| _ => none
417+
418+
#check Option.getD
419+
420+
/-
421+
`k` is the name of a valid continuation or none
422+
-/
423+
def SSADo.validContinutation (vars : VarMap) (mutVars : VarMap) (k : Option Name) := (do pure <| (← vars.get (← k)).funDom? = (mkMutTuple mutVars).2) = some true ∨ k = none
424+
425+
426+
theorem SSADo.toSSAExpr_wellTyped (vars : VarMap) (mutVars : VarMap) (kbreak kcontinue : Option Name) (hkBreak : validContinutation vars mutVars kbreak) (hkContinue : validContinutation vars mutVars kbreak) (hMut₁ : (mutVars.toList.map (·.1)).Nodup) (hMut₂ : mutVars.toList ⊆ vars.toList) (hMut₃ : ∀ mutvar ∈ mutVars.toList, ∃! var ∈ vars.toList, var.1 = mutvar.1) : (prog : SSADo) → (hp : (prog.toSSAExpr vars mutVars kbreak kcontinue).isSome) → (((prog.toSSAExpr vars mutVars kbreak kcontinue).get hp).inferType vars).isSome
427+
| .expr (.const (.ofUnit ())) => by
428+
unfold toSSAExpr
429+
cases hkc : kcontinue with
430+
| none => simp [SSAExpr.inferType]
431+
| some x => sorry
410432
| _ => sorry
411433

412434
#check SSADo

0 commit comments

Comments
 (0)