Skip to content

Commit ed9e5cd

Browse files
authored
Merge pull request #29 from gaetanserre/dev
Refactor
2 parents 6859346 + 40e1c41 commit ed9e5cd

7 files changed

Lines changed: 45 additions & 123 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'master'
8+
paths:
9+
- 'lean-toolchain'
10+
11+
jobs:
12+
lean-release-tag:
13+
name: Add Lean release tag
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- name: lean-release-tag action
19+
uses: leanprover-community/lean-release-tag@v1
20+
with:
21+
do-release: true
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/create_release.yml‎

Lines changed: 0 additions & 70 deletions
This file was deleted.

‎KernelHom/Kernel/Hom.lean‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ lemma tensorHom {κ : Kernel X Y} [IsSFiniteKernel κ] {η : Kernel V Z} [IsSFin
247247
ext : 1; dsimp
248248
simp only [hom]
249249
rw [id_parallelComp_comp_parallelComp_id, comap_parallelComp_comap, map_parallelComp_map]
250-
· congr
250+
· rfl
251251
all_goals fun_prop
252252

253253
end tensorHom

‎KernelHom/Tactic/Hom/HomKernel.lean‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ def mkHomKernelEqProof (eqProofType : Expr) (eLevel : Level)
290290
| [forwardGoal, backwardGoal] =>
291291
setGoals [forwardGoal]
292292
evalTactic (← `(tactic| intro h))
293-
for e in op_data do
294-
match e with
293+
for op in op_data do
294+
match op with
295295
| .leftUnitor_hom _ sfinker equiv =>
296296
let sfinkerStx ← Term.exprToSyntax sfinker
297297
let equivStx ← Term.exprToSyntax equiv
@@ -372,8 +372,8 @@ def mkHomKernelEqProof (eqProofType : Expr) (eLevel : Level)
372372
evalTactic congr_tac
373373
catch _ =>
374374
pure ()
375-
for e in op_data do
376-
match e with
375+
for op in op_data do
376+
match op with
377377
| .WhiskerLeft sfinker equiv =>
378378
let sfinkerStx ← Term.exprToSyntax sfinker
379379
let equivStx ← Term.exprToSyntax equiv
@@ -415,8 +415,8 @@ def mkHomKernelEqProof (eqProofType : Expr) (eLevel : Level)
415415

416416
setGoals [backwardGoal]
417417
evalTactic (← `(tactic| intro h))
418-
for e in op_data do
419-
match e with
418+
for op in op_data do
419+
match op with
420420
| .leftUnitor_hom _ sfinker equiv =>
421421
let sfinkerStx ← Term.exprToSyntax sfinker
422422
let equivStx ← Term.exprToSyntax equiv
@@ -497,8 +497,8 @@ def mkHomKernelEqProof (eqProofType : Expr) (eLevel : Level)
497497
evalTactic congr_tac
498498
catch _ =>
499499
pure ()
500-
for e in op_data do
501-
match e with
500+
for op in op_data do
501+
match op with
502502
| .WhiskerLeft sfinker equiv =>
503503
let sfinkerStx ← Term.exprToSyntax sfinker
504504
let equivStx ← Term.exprToSyntax equiv
@@ -542,7 +542,7 @@ def mkHomKernelEqProof (eqProofType : Expr) (eLevel : Level)
542542
throwError "Expected exactly two goals after `constructor`"
543543
if !(← getGoals).isEmpty then
544544
setGoals savedGoals
545-
throwError "Failed to solve all goals while building kernel_hom equivalence proof"
545+
throwError "Failed to solve all goals while building hom_kernel equivalence proof"
546546
setGoals savedGoals
547547
instantiateMVars mvar
548548

‎KernelHom/Tactic/Hom/KernelHom.lean‎

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ module
77

88
public import Lean.Elab.Tactic.Location
99
public import KernelHom.Kernel.MonoidalComp
10-
public import KernelHom.Mathlib.MeasurableEquiv
1110
public import KernelHom.Tactic.LocTactic
1211
public import KernelHom.Tactic.Hom.Universe
1312
public import KernelHom.Tactic.Hom.Utils
@@ -24,7 +23,7 @@ kernels into equivalent equalities in the monoidal category.
2423
categorical morphism expressions.
2524
* `mkKernelHomEqProof`: construction of the equivalence proof used by the
2625
tactic.
27-
* `applyKernelHom`: core implementation on goals and hypotheses.
26+
* `applyKernelHom`: core implementation of `kernel_hom` on goals and hypotheses.
2827
* `kernel_hom`: user-facing tactic (with location support).
2928
-/
3029

@@ -342,8 +341,8 @@ def mkKernelHomEqProof (eqProofType rhs lhs : Expr) (maxLvl : Level)
342341
| [forwardGoal, backwardGoal] =>
343342
setGoals [forwardGoal]
344343
evalTactic (← `(tactic| intro h))
345-
for e in op_data do
346-
match e with
344+
for op in op_data do
345+
match op with
347346
| .leftUnitor_hom lvl sfinker equiv =>
348347
let punitLevelStx ← liftMacroM <| levelToSyntax lvl
349348
let sfinkerStx ← Term.exprToSyntax sfinker
@@ -412,10 +411,9 @@ def mkKernelHomEqProof (eqProofType rhs lhs : Expr) (maxLvl : Level)
412411
evalTactic congr_tac
413412
catch _ =>
414413
pure ()
415-
for e in op_data do
416-
match e with
414+
for op in op_data do
415+
match op with
417416
| .WhiskerLeft sfinker equiv =>
418-
logInfo m! "WhiskerLeft: {sfinker}, {equiv}"
419417
let sfinkerStx ← Term.exprToSyntax sfinker
420418
let equivStx ← Term.exprToSyntax equiv
421419
evalTactic (← `(tactic| nth_rw 1 [
@@ -425,7 +423,6 @@ def mkKernelHomEqProof (eqProofType rhs lhs : Expr) (maxLvl : Level)
425423
catch _ =>
426424
pure ()
427425
| .WhiskerRight sfinker equiv =>
428-
logInfo m! "WhiskerRight: {sfinker}, {equiv}"
429426
let sfinkerStx ← Term.exprToSyntax sfinker
430427
let equivStx ← Term.exprToSyntax equiv
431428
evalTactic (← `(tactic| nth_rw 1 [
@@ -435,7 +432,6 @@ def mkKernelHomEqProof (eqProofType rhs lhs : Expr) (maxLvl : Level)
435432
catch _ =>
436433
pure ()
437434
| .MonoidalComp sfinkerW ew sfinkerX ex sfinkerY ey sfinkerZ ez =>
438-
logInfo m! "MonoidalComp: {sfinkerW}, {ew}, {sfinkerX}, {ex}, {sfinkerY}, {ey}, {sfinkerZ}, {ez}"
439435
let sfinkerWStx ← Term.exprToSyntax sfinkerW
440436
let ewStx ← Term.exprToSyntax ew
441437
let sfinkerXStx ← Term.exprToSyntax sfinkerX
@@ -459,8 +455,8 @@ def mkKernelHomEqProof (eqProofType rhs lhs : Expr) (maxLvl : Level)
459455

460456
setGoals [backwardGoal]
461457
evalTactic (← `(tactic| intro h))
462-
for e in op_data do
463-
match e with
458+
for op in op_data do
459+
match op with
464460
| .leftUnitor_hom lvl sfinker equiv =>
465461
let punitLevelStx ← liftMacroM <| levelToSyntax lvl
466462
let sfinkerStx ← Term.exprToSyntax sfinker
@@ -531,8 +527,8 @@ def mkKernelHomEqProof (eqProofType rhs lhs : Expr) (maxLvl : Level)
531527
evalTactic congr_tac
532528
catch _ =>
533529
pure ()
534-
for e in op_data do
535-
match e with
530+
for op in op_data do
531+
match op with
536532
| .WhiskerLeft sfinker equiv =>
537533
let sfinkerStx ← Term.exprToSyntax sfinker
538534
let equivStx ← Term.exprToSyntax equiv
@@ -581,33 +577,6 @@ def mkKernelHomEqProof (eqProofType rhs lhs : Expr) (maxLvl : Level)
581577
setGoals savedGoals
582578
instantiateMVars mvar
583579

584-
/-- Construct the proof of equivalence between the original equality and the transformed one. -/
585-
def mkKernelHomEqProofSorry (eqProofType rhs lhs : Expr) (maxLvl : Level)
586-
(op_data : List CategoryOP) : TacticM Expr := do
587-
let maxLvlStx ← liftMacroM <| levelToSyntax maxLvl
588-
let rhsStx ← Term.exprToSyntax rhs
589-
let lhsStx ← Term.exprToSyntax lhs
590-
let op_data := op_data.reverse
591-
let savedGoals ← getGoals
592-
let mvar ← mkFreshExprSyntheticOpaqueMVar eqProofType
593-
let mvarId := mvar.mvarId!
594-
setGoals [mvarId]
595-
evalTactic (← `(tactic| apply propext))
596-
evalTactic (← `(tactic| constructor))
597-
let goalsAfterConstructor ← getGoals
598-
match goalsAfterConstructor with
599-
| [forwardGoal, backwardGoal] =>
600-
setGoals [forwardGoal]
601-
evalTactic (← `(tactic| sorry))
602-
603-
setGoals [backwardGoal]
604-
evalTactic (← `(tactic| sorry))
605-
| _ =>
606-
setGoals savedGoals
607-
throwError "Expected exactly two goals after `constructor`"
608-
setGoals savedGoals
609-
instantiateMVars mvar
610-
611580
/-- The `kernel_hom` tactic transforms a kernel equality to an equivalent equality in
612581
the category of measurable spaces and s-finite kernels.
613582

‎KernelHom/Tactic/Hom/Universe.lean‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def computeMaxUniverse (levels : List Level) : MetaM Level :=
6868
| [] => throwError "Expected at least one universe level, got an empty list"
6969
| head :: tail => pure (tail.foldl Level.max head)
7070

71-
/-- Get the category universe level from the left side of an equality expression. -/
71+
/-- Get the universe level from the left side of an equality expression. -/
7272
def getUniverseFromEq (eq : Expr) : MetaM Level := do
7373
let eq ← instantiateMVars eq
7474
let eq ← zetaReduce eq

‎KernelHom/Tactic/Hom/Utils.lean‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Authors: Gaëtan Serré
55
-/
66
module
77

8+
public import KernelHom.Mathlib.MeasurableEquiv
89
public import Lean
910
public import Mathlib.Probability.Kernel.Composition.Prod
1011
public import Mathlib.Probability.Kernel.Composition.CompProd
@@ -57,10 +58,10 @@ partial def constructMeasurableEquiv (e : Expr) (eLevel maxLvl : Level) : MetaM
5758
let yLevel := univs[1]!
5859
let ex ← constructMeasurableEquiv X xLevel maxLvl
5960
let ey ← constructMeasurableEquiv Y yLevel maxLvl
60-
let res ← mkAppOptM' (Expr.const `MeasurableEquiv.prod [maxLvl, xLevel, yLevel])
61+
let res ← mkAppOptM' (Expr.const ``MeasurableEquiv.prod [maxLvl, xLevel, yLevel])
6162
#[none, none, none, none, none, none, none, none, ex, ey]
6263
return res
63-
| _ => mkAppOptM' (Expr.const `MeasurableEquiv.ulift [eLevel, maxLvl]) #[e, none]
64+
| _ => mkAppOptM' (Expr.const ``MeasurableEquiv.ulift [eLevel, maxLvl]) #[e, none]
6465

6566
/-- Categorical operations recorded during transformation for later rewriting. -/
6667
inductive CategoryOP

0 commit comments

Comments
 (0)